changeset 83231:549734260e34

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-714 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-271
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 08 Dec 2004 22:20:27 +0000
parents d8738586aaec (current diff) a1e4505728bf (diff)
children 5e454dd0d649
files ChangeLog admin/FOR-RELEASE etc/TODO lisp/ChangeLog lisp/calc/calc-maint.el lisp/faces.el lisp/files.el lisp/font-lock.el lisp/ldefs-boot.el lisp/progmodes/gdb-ui.el lisp/progmodes/tcl.el lisp/simple.el lisp/startup.el lisp/subr.el lisp/term/x-win.el lisp/textmodes/org.el lisp/url/url-http.el lisp/vc-cvs.el lisp/vc-hooks.el lisp/vc.el man/ChangeLog man/kmacro.texi man/org.texi src/Makefile.in src/alloc.c src/buffer.c src/buildobj.lst src/coding.c src/coding.h src/config.in src/dispextern.h src/emacs.c src/fringe.c src/indent.c src/keyboard.c src/keymap.c src/lisp.h src/lread.c src/macterm.c src/macterm.h src/minibuf.c src/sysdep.c src/term.c src/window.c src/xdisp.c src/xfaces.c src/xfns.c src/xmenu.c
diffstat 200 files changed, 25904 insertions(+), 10698 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,25 @@
+2004-12-07  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* configure.in: If $HAVE_GTK_FILE_CHOOSER = yes, check for 
+	pthreads and define HAVE_GTK_AND_PTHREAD.
+	* configure: Regenerate.
+
+2004-12-05  Richard M. Stallman  <rms@gnu.org>
+
+	* Makefile.in (info): Ignore errors building info files.
+
+2004-11-27  Eli Zaretskii  <eliz@gnu.org>
+
+	* config.bat: If 8-byte alignment is not supported, define
+	NO_DECL_ALIGN in src/config.h, instead of trivially defining
+	DECL_ALIGN.  Protect & with "" because & is special for cmd.exe;
+	filter through Sed to remove the quotes.
+
+2004-11-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* info/.cvsignore: Ignore everything.  It's OK since .cvsignore does
+	not apply to files explicitly `cvs add'ed.
+
 2004-11-12  Eli Zaretskii  <eliz@gnu.org>
 
 	* config.bat: Don't require djecho.exe for the v1.x build.
@@ -18,23 +40,23 @@
 
 2004-11-02  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* configure.in (HAVE_GTK_FILE_CHOOSER, $HAVE_GTK_FILE_SELECTION): New
-	tests for new and old GTK file dialogs.
+	* configure.in (HAVE_GTK_FILE_CHOOSER, $HAVE_GTK_FILE_SELECTION):
+	New tests for new and old GTK file dialogs.
 	(HAVE_GTK): Only set with_toolkit_scroll_bars if not explicitly set
 	to no.
 
-	* configure: Rebuild
+	* configure: Rebuild.
 
 2004-10-20  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* configure.in (HAVE_PERSONALITY_LINUX32): New test if PER_LINUX32
 	can be set.  Remove SETARCH test.
-	* configure: Rebuild
+	* configure: Rebuild.
 
 2004-10-08  Steven Tamm  <steventamm@mac.com>
 
 	* configure.in (HAVE_MALLOC_MALLOC_H): Test for malloc/malloc.h
-	* configure: Rebuild
+	* configure: Rebuild.
 
 2004-10-06  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
@@ -43,7 +65,7 @@
 
 2004-10-05  Jan Dj,Ad(Brv.  <jan.h.d@swipnet.se>
 
-	* configure.in (HAVE_RANDOM_HEAPSTART): Renamed HAVE_EXECSHIELD.
+	* configure.in (HAVE_RANDOM_HEAPSTART): Rename HAVE_EXECSHIELD.
 	Run test to see if heap start address is random.
 
 2004-09-29  Miles Bader  <miles@gnu.org>
@@ -71,7 +93,7 @@
 
 2004-08-02  Reiner Steib  <Reiner.Steib@gmx.de>
 
-	* Makefile.in (install-arch-indep): Added pgg and sieve.
+	* Makefile.in (install-arch-indep): Add pgg and sieve.
 
 	* info/.cvsignore: Added pgg and sieve.
 
--- a/Makefile.in	Sun Nov 28 14:39:06 2004 +0000
+++ b/Makefile.in	Wed Dec 08 22:20:27 2004 +0000
@@ -719,9 +719,9 @@
 # put the info files in $(srcdir),
 # so we can do ok running make in the build dir.
 info: force-info
-	(cd man; $(MAKE) $(MFLAGS) info)
-	(cd lispref; $(MAKE) $(MFLAGS) info)
-	(cd lispintro; $(MAKE) $(MFLAGS) info)
+	-(cd man; $(MAKE) $(MFLAGS) info)
+	-(cd lispref; $(MAKE) $(MFLAGS) info)
+	-(cd lispintro; $(MAKE) $(MFLAGS) info)
 dvi:
 	(cd man; $(MAKE) $(MFLAGS) dvi)
 	(cd lispref; $(MAKE) $(MFLAGS) elisp.dvi)
--- a/admin/FOR-RELEASE	Sun Nov 28 14:39:06 2004 +0000
+++ b/admin/FOR-RELEASE	Wed Dec 08 22:20:27 2004 +0000
@@ -36,6 +36,32 @@
 
 * BUGS
 
+** Ange-ftp should ignore irrelevant IPv6 errors:
+
+Message-Id: <4121-Tue23Mar2004165249+0100-piet@cs.uu.nl>
+From: "Piet van Oostrum" <piet@cs.uu.nl>
+To: emacs-pretest-bug@gnu.org
+Subject: Ange-ftp can't deal with IPV6/IPV4 fallback
+
+Symptoms:
+
+C-x C-f /ftp.nluug.nl:/
+
+The problem is that the DNS first gives an IPV6 address. However our
+router doesn't do IPV6. Ftp then falls back to IPV4:
+
+ftp> open ftp.nluug.nl
+Trying 2001:610:1:80aa:192:87:102:36...
+ftp: connect to address 2001:610:1:80aa:192:87:102:36: No route to host
+Trying 192.87.102.36...
+Connected to ftp.nluug.nl.
+
+Ange-ftp chokes on the `No route to host' message and doesn't look any
+further. 
+
+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
 
--- a/config.bat	Sun Nov 28 14:39:06 2004 +0000
+++ b/config.bat	Wed Dec 08 22:20:27 2004 +0000
@@ -161,8 +161,9 @@
 Rem See if DECL_ALIGN can be supported with this GCC
 rm -f junk.c junk.o junk junk.exe
 echo struct { int i; char *p; } __attribute__((__aligned__(8))) foo;  >junk.c
-rem Two percent signs because it is a special character for COMMAND.COM
-echo int main(void) { return (unsigned long)&foo %% 8; }             >>junk.c
+rem Two percent signs because it is a special character for COMMAND.COM/CMD
+rem Filter thru Sed because "&" is special for CMD.EXE
+echo int main(void) { return (unsigned long)"&"foo %% 8; } | sed "s/.&./\&/"         >>junk.c
 gcc -o junk junk.c
 if not exist junk.exe coff2exe junk
 junk
@@ -171,7 +172,7 @@
 Echo WARNING: Therefore Emacs cannot support buffers larger than 128MB.
 rem The following line disables DECL_ALIGN which in turn disables USE_LSB_TAG
 rem For details see lisp.h where it defines USE_LSB_TAG
-echo #define DECL_ALIGN(type, var) type var >>config.h2
+echo #define NO_DECL_ALIGN >>config.h2
 :alignOk
 rm -f junk.c junk junk.exe
 update config.h2 config.h >nul
--- a/configure	Sun Nov 28 14:39:06 2004 +0000
+++ b/configure	Wed Dec 08 22:20:27 2004 +0000
@@ -10127,6 +10127,238 @@
 _ACEOF
 
   fi
+
+      if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
+    HAVE_GTK_AND_PTHREAD=no
+
+for ac_header in pthread.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { 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=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+    if test "$ac_cv_header_pthread_h"; then
+      echo "$as_me:$LINENO: checking for pthread_self in -lpthread" >&5
+echo $ECHO_N "checking for pthread_self in -lpthread... $ECHO_C" >&6
+if test "${ac_cv_lib_pthread_pthread_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char pthread_self ();
+int
+main ()
+{
+pthread_self ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { 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=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_pthread_pthread_self=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pthread_pthread_self=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_self" >&5
+echo "${ECHO_T}$ac_cv_lib_pthread_pthread_self" >&6
+if test $ac_cv_lib_pthread_pthread_self = yes; then
+  HAVE_GTK_AND_PTHREAD=yes
+fi
+
+    fi
+    if test "$HAVE_GTK_AND_PTHREAD" = yes; then
+      GTK_LIBS="$GTK_LIBS -lpthread"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GTK_AND_PTHREAD 1
+_ACEOF
+
+    fi
+  fi
 fi
 
 if test x"${USE_X_TOOLKIT}" = xmaybe; then
--- a/configure.in	Sun Nov 28 14:39:06 2004 +0000
+++ b/configure.in	Wed Dec 08 22:20:27 2004 +0000
@@ -1994,6 +1994,21 @@
     AC_DEFINE(HAVE_GTK_FILE_BOTH, 1,
               [Define to 1 if GTK has both file selection and chooser dialog.])
   fi
+
+  dnl Check if pthreads are available.  Emacs only needs this when using
+  dnl gtk_file_chooser under Gnome.
+  if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
+    HAVE_GTK_AND_PTHREAD=no
+    AC_CHECK_HEADERS(pthread.h)
+    if test "$ac_cv_header_pthread_h"; then
+      AC_CHECK_LIB(pthread, pthread_self, HAVE_GTK_AND_PTHREAD=yes)
+    fi
+    if test "$HAVE_GTK_AND_PTHREAD" = yes; then
+      GTK_LIBS="$GTK_LIBS -lpthread"
+      AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1,
+               [Define to 1 if you have GTK and pthread (-lpthread).])
+    fi
+  fi
 fi
 
 dnl Do not put whitespace before the #include statements below.
--- a/etc/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/etc/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,11 @@
+2004-12-07  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* PROBLEMS: Update information about klipper on KDE.
+
+2004-11-26  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* NEWS: Rename use-old-gtk-file-dialog to x-use-old-gtk-file-dialog.
+
 2004-10-08  Fr,Ai(Bd,Ai(Bric Bothamy  <frederic.bothamy@free.fr>  (tiny change)
 
 	* TUTORIAL.fr: Minor wording fix.
--- a/etc/NEWS	Sun Nov 28 14:39:06 2004 +0000
+++ b/etc/NEWS	Wed Dec 08 22:20:27 2004 +0000
@@ -675,17 +675,16 @@
 point according to context (bound to M-tab).
 
 *** The new commands bibtex-find-entry and bibtex-find-crossref
-locate entries and crossref'd entries.  Crossref fields are clickable
-(bound to mouse-2, RET).
+locate entries and crossref'd entries (bound to C-c C-s and C-c C-x).
+Crossref fields are clickable (bound to mouse-2, RET).
 
 *** In BibTeX mode the command fill-paragraph (bound to M-q) fills
 individual fields of a BibTeX entry.
 
+*** The new variables bibtex-files and bibtex-file-path define a set
+of BibTeX files that are searched for entry keys.
+
 *** The new command bibtex-validate-globally checks for duplicate keys
-in multiple BibTeX files.  See also the new variables bibtex-files
-and bibtex-file-path.
-
-*** The new command bibtex-find-entry-globally searches BibTeX entries
 in multiple BibTeX files.
 
 *** The new command bibtex-copy-summary-as-kill pushes summary
@@ -953,7 +952,7 @@
 
 +++
 ** For Gtk+ version 2.4, you can make Emacs use the old file dialog
-by setting the variable `use-old-gtk-file-dialog' to t.  Default is to use
+by setting the variable `x-use-old-gtk-file-dialog' to t.  Default is to use
 the new dialog.
 
 +++
@@ -1482,9 +1481,9 @@
 
 ---
 ** The functions `holiday-easter-etc' and `holiday-advent' now take
-arguments, and only report on the specified holiday rather than all.
-This makes customization of the variable `christian-holidays' simpler,
-but existing customizations may need to be updated.
+optional arguments, in order to only report on the specified holiday
+rather than all. This makes customization of variables such as
+`christian-holidays' simpler.
 
 ** The function `simple-diary-display' now by default sets a header line.
 This can be controlled through the variables `diary-header-line-flag'
@@ -1960,6 +1959,10 @@
 majority.
 
 ---
+** The new function `f90-backslash-not-special' can be used to change
+the syntax of backslashes in F90 buffers.
+
+---
 ** Prolog mode has a new variable `prolog-font-lock-keywords'
 to support use of font-lock.
 
@@ -2360,9 +2363,6 @@
 ** The new function syntax-after returns the syntax code
 of the character after a specified buffer position, taking account
 of text properties as well as the character code.
-It returns the value compatibly with char-syntax, except
-that the value can be a list (SYNTAX . MATCHER) which says
-what the matching character is.
 
 +++
 ** The new primitive `get-internal-run-time' returns the processor
@@ -2458,10 +2458,6 @@
 modification times.  Magic file name handlers can handle this
 operation.
 
-** file-remote-p now returns an identifier for the remote system,
-if the file is indeed remote.  (Before, the return value was t in
-this case.)
-
 +++
 ** The display space :width and :align-to text properties are now
 supported on text terminals.
@@ -2585,6 +2581,9 @@
 around potentially blocking or long-running code in timers
 and post-command-hooks.
 
+** An unconditional face specification in defface (one where the DISPLAY part
+is just t) applies to all cases and does not override subsequent entries.
+
 +++
 ** New face attribute `min-colors' can be used to tailor the face color
 to the number of colors supported by a display, and define the
@@ -3227,6 +3226,7 @@
 ** The new function `file-remote-p' tests a file name and returns
 non-nil if it specifies a remote file (one that Emacs accesses using
 its own special methods and not directly through the file system).
+The value in that case is an identifier for the remote file system.
 
 ---
 ** When a Lisp file uses CL functions at run-time, compiling the file
--- a/etc/PROBLEMS	Sun Nov 28 14:39:06 2004 +0000
+++ b/etc/PROBLEMS	Wed Dec 08 22:20:27 2004 +0000
@@ -1051,11 +1051,12 @@
 requests the X clipboard contents from applications.  Early versions
 of klipper don't implement the ICCM protocol for large selections,
 which leads to Emacs being flooded with selection requests.  After a
-while, Emacs will print a message:
+while, Emacs may print a message:
 
   Timed out waiting for property-notify event
 
-A workaround is to not use `klipper'.
+A workaround is to not use `klipper'.  An upgrade to the `klipper' that
+comes with KDE 3.3 or later also solves the problem.
 
 *** CDE: Frames may cover dialogs they created when using CDE.
 
--- a/etc/TODO	Sun Nov 28 14:39:06 2004 +0000
+++ b/etc/TODO	Wed Dec 08 22:20:27 2004 +0000
@@ -9,7 +9,7 @@
 
 * Small but important fixes needed in existing features:
 
-** Fix the kill/yank treatment of invisible text. At the moment,
+** Fix the kill/yank treatment of invisible text.  At the moment,
   invisible text is placed in the kill-ring, so that the contents of
   the ring may not correspond to the text as displayed to the user. It
   ought to be possible to omit text which is invisible (due to a
@@ -32,7 +32,8 @@
   properly with variable-pitch faces.
 
 ** Implement a smoother vertical scroll facility, one that allows
-  C-v to scroll through a tall image.
+  C-v to scroll through a tall image.  The primitive operations
+  posn-at-point and posn-at-x-y should now make it doable in elisp.
 
 ** Implement intelligent search/replace, going beyond query-replace
   (see http://graphics.csail.mit.edu/~rcm/chi04.pdf).
@@ -67,7 +68,6 @@
 
 ** ange-ftp
 *** understand sftp
-*** ignore some irrelevant errors (like IPv6 and kerberos thingies).
 *** Use MLS for ange-ftp-insert-directory if a list of files is specified.
 
 ** Ability to map a key, including all modified-combinations.
@@ -122,9 +122,6 @@
 ** Save undo information in special temporary files, and reload it
   when needed for undoing.  This could extend undo capacity.
 
-** Merge the Emacs regex.c with the Glibc regex.c.
-  They split off a few years ago through negligence.
-
 ** Change the Windows NT menu code
   so that it handles the deep_p argument and avoids
   regenerating the whole menu bar menu tree except
@@ -150,6 +147,10 @@
 ** Implement popular parts of the rest of the CL functions as compiler
   macros in cl-macs.
 
+** Make compiler warnings about functions that might be undefined at run time
+ smarter, so that they know which files are required by the file being
+ compiled and don't warn about functions defined in them.
+
 ** Highlight rectangles (`mouse-track-rectangle-p' in XEmacs).  Already in CUA,
   but it's a valuable feature worth making more general.
 
@@ -317,6 +318,8 @@
 
 * Internal changes
 
+** Replace Emacs's regex.c with the new DFA-based glibc regex code.
+
 ** Replace gmalloc.c with the modified Doug Lea code from the current
   GNU libc so that the special mmapping of buffers can be removed --
   that apparently loses under Solaris, at least.  [fx has mostly done
@@ -326,7 +329,8 @@
 
 ** Add an inferior-comint-minor-mode to capture the common set of operations
    offered by major modes that offer an associated inferior
-   comint-derived mode.  I.e. basically make cmuscheme.el generic.
-   For use by sml-mode, python-mode, tex-mode, scheme-mode, ...
+   comint-derived mode.  I.e. basically make cmuscheme.el/inf-lisp.el generic.
+   For use by sml-mode, python-mode, tex-mode, scheme-mode, lisp-mode,
+   haskell-mode, tuareg-mode, ...
 
 ;;; arch-tag: b0a3e40b-726a-457d-9999-ba848321b036
--- a/etc/compilation.txt	Sun Nov 28 14:39:06 2004 +0000
+++ b/etc/compilation.txt	Wed Dec 08 22:20:27 2004 +0000
@@ -110,15 +110,7 @@
 
 * Fortran checker
 
-symbols: ftnchek-file ftnchek-line-file ftnchek-line
-
-File average.f:
-
-Warning in module COMPAV: Variables may be used before set:
-    SUM used at line 14
-    SUM set at line 14
-
-Warning near line 16 col 20: integer quotient expr I/J  converted to real
+symbols: ftnchek
 
     Dummy arg W in module SUBA line 8 file arrayclash.f is array
     L4 used at line 55 file test/assign.f; never set
@@ -274,8 +266,8 @@
 
 This stupid precompiler wraps lines at column 80 in the middle of a file name.
 There is no obvious way of detecting this or turning it off.  But if you
-delete the newline, the file name will automatically be reparsed, so that you
-can then go there.
+delete the newline (probably needs M-x toggle-read-only), the file name will
+automatically be reparsed, so that you can then go there.
 
 Semantic error at line 528, column 5, file erosacqdb.pc:
 Error at line 41, column 10 in file /usr/src/sb/ODBI_BHP.hpp
--- a/leim/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/leim/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,12 @@
+2004-12-04  Kenichi Handa  <handa@m17n.org>
+
+	* quail/lao.el (lao-key-alist): Declare it by defvar.
+	(lao-key-alist-vector): New variable.
+	(lao-consonant-key-alist, lao-semivowel-key-alist)
+	(lao-vowel-key-alist, lao-voweltone-key-alist)
+	(lao-tone-key-alist, lao-other-key-alist): Initialize them from
+	lao-key-alist-vector.
+
 2004-09-25  Kenichi Handa  <handa@m17n.org>
 
 	* quail/uni-input.el (ucs-input-method): Add error clause to
--- a/leim/quail/lao.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/leim/quail/lao.el	Wed Dec 08 22:20:27 2004 +0000
@@ -2,6 +2,9 @@
 
 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
 ;; Licensed to the Free Software Foundation.
+;; Copyright (C) 2004
+;;   National Institute of Advanced Industrial Science and Technology (AIST)
+;;   Registration Number H14PRO021
 
 ;; Keywords: multilingual, input method, Lao
 
@@ -42,7 +45,7 @@
 	  (compose-string (quail-lookup-map-and-concat quail-current-key))))
   control-flag)
 
-(defconst lao-key-alist
+(defvar lao-key-alist
   '(("!" . "1")
     ("\"" . "=")
     ("#" . "3")
@@ -146,38 +149,50 @@
     ("\\7" . "(1w(B")
     ("\\8" . "(1x(B")
     ("\\9" . "(1y(B")
-    ))
+    )
+  "Alist of key sequences vs the corresponding Lao string to input.
+This variable is for the input method \"lao\".
+If you change the value of this variable while quail/lao is already loaded,
+you need to re-load it to properly re-initialize related alists.")
 
-(defconst lao-consonant-key-alist nil)
-(defconst lao-semivowel-key-alist nil)
-(defconst lao-vowel-key-alist nil)
-(defconst lao-voweltone-key-alist nil)
-(defconst lao-tone-key-alist nil)
-(defconst lao-other-key-alist nil)
-
-(let ((tail lao-key-alist)
-      elt phonetic-type)
-  (while tail
-    (setq elt (car tail) tail (cdr tail))
-    (if (stringp (cdr elt))
-	(setq phonetic-type (get-char-code-property (aref (cdr elt) 0)
+;; Temporary variable to initialize lao-consonant-key-alist, etc.
+(defconst lao-key-alist-vector
+  (let ((tail lao-key-alist)
+	consonant-key-alist semivowel-key-alist vowel-key-alist 
+	voweltone-key-alist tone-key-alist other-key-alist
+	elt phonetic-type)
+    (while tail
+      (setq elt (car tail) tail (cdr tail))
+      (if (stringp (cdr elt))
+	  (setq phonetic-type (get-char-code-property (aref (cdr elt) 0)
+						      'phonetic-type))
+	(setq phonetic-type (get-char-code-property (aref (aref (cdr elt) 0) 0)
 						    'phonetic-type))
-      (setq phonetic-type (get-char-code-property (aref (aref (cdr elt) 0) 0)
-						  'phonetic-type))
-      (aset (cdr elt) 0 (compose-string (aref (cdr elt) 0))))
-    (cond ((eq phonetic-type 'consonant)
-	   (setq lao-consonant-key-alist (cons elt lao-consonant-key-alist)))
-	  ((memq phonetic-type '(vowel-upper vowel-lower))
-	   (if (stringp (cdr elt))
-	       (setq lao-vowel-key-alist (cons elt lao-vowel-key-alist))
-	     (setq lao-voweltone-key-alist
-		   (cons elt lao-voweltone-key-alist))))
-	  ((eq  phonetic-type 'tone)
-	   (setq lao-tone-key-alist (cons elt lao-tone-key-alist)))
-	  ((eq phonetic-type 'semivowel-lower)
-	   (setq lao-semivowel-key-alist (cons elt lao-semivowel-key-alist)))
-	  (t
-	   (setq lao-other-key-alist (cons elt lao-other-key-alist))))))
+	(aset (cdr elt) 0 (compose-string (aref (cdr elt) 0))))
+      (cond ((eq phonetic-type 'consonant)
+	     (setq consonant-key-alist (cons elt consonant-key-alist)))
+	    ((memq phonetic-type '(vowel-upper vowel-lower))
+	     (if (stringp (cdr elt))
+		 (setq vowel-key-alist (cons elt vowel-key-alist))
+	       (setq voweltone-key-alist (cons elt voweltone-key-alist))))
+	    ((eq  phonetic-type 'tone)
+	     (setq tone-key-alist (cons elt tone-key-alist)))
+	    ((eq phonetic-type 'semivowel-lower)
+	     (setq semivowel-key-alist (cons elt semivowel-key-alist)))
+	    (t
+	     (setq other-key-alist (cons elt other-key-alist)))))
+    (vector consonant-key-alist semivowel-key-alist vowel-key-alist 
+	    voweltone-key-alist tone-key-alist other-key-alist)))
+
+(defconst lao-consonant-key-alist (aref lao-key-alist-vector 0))
+(defconst lao-semivowel-key-alist (aref lao-key-alist-vector 1))
+(defconst lao-vowel-key-alist (aref lao-key-alist-vector 2))
+(defconst lao-voweltone-key-alist (aref lao-key-alist-vector 3))
+(defconst lao-tone-key-alist (aref lao-key-alist-vector 4))
+(defconst lao-other-key-alist (aref lao-key-alist-vector 5))
+
+;; Done with it.
+(makunbound 'lao-key-alist-vector)
 
 (quail-define-package
  "lao" "Lao" "(1E(B" t
--- a/lisp/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,1000 @@
+2004-12-06  Stefan  <monnier@iro.umontreal.ca>
+
+	* font-lock.el (font-lock-unfontify-region): Save buffer state.
+	(font-lock-default-unfontify-region): Don't save buffer state any
+	more.
+
+2004-12-07  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-help.el (calc-describe-key):
+	Set calc-summary-indentation even when Calc Summary buffer exists.
+
+2004-12-07  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+	* calendar/holidays.el (holiday-easter-etc): Make arguments
+	optional for backwards compatibility.  Doc fix.
+	Remove un-necessary local vars mandatory, output-list.
+	(holiday-advent):  Make arguments optional for backwards
+	compatibility.  Doc fix.
+
+2004-12-06  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* paren.el (show-paren-function): Fix last change (2004-12-02).
+
+	* international/mule-util.el (char-displayable-p): Return nil for
+	unibyte mode.
+
+	* subr.el (subregexp-context-p): New function.
+
+	* isearch.el (isearch-quote-char): Use it.
+
+	* emacs-lisp/regexp-opt.el (regexp-opt-depth): Use it.
+	(regexp-opt-not-groupie*-re): Remove.
+	(regexp-opt): Properly handle inputs with duplicate entries.
+
+2004-12-06  Richard M. Stallman  <rms@gnu.org>
+
+	* info-look.el (info-lookup-maybe-add-help cfengine-mode): Regexp typo.
+
+	* cus-edit.el (custom-file): Doc fix.
+
+	* textmodes/org.el: New file.
+
+2004-12-06  Kenichi Handa  <handa@m17n.org>
+
+	* ldefs-boot.el: Update international/mule-util.el section.
+
+2004-12-05  Sam Steingold  <sds@gnu.org>
+
+	* net/tramp.el (tramp-handle-file-accessible-directory-p):
+	Fix `tramp-time-diff' comparison logic.
+
+2004-12-05  Paul Pogonyshev  <pogonyshev@gmx.net>
+
+	* progmodes/which-func.el (which-function):
+	Use `run-hook-with-args-until-success' instead of a custom loop.
+	Fixes bug with local hooks.
+
+2004-12-05  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
+
+	* textmodes/bibtex.el (bibtex-font-lock-url-regexp):
+	Use delete-dups when calculating the initial value.
+	(bibtex-autokey-get-title): Use <=.
+	(bibtex-goto-line): New function.
+	(bibtex-reposition-window): Use line numbers instead of point
+	positions.  Use window-body-height.
+	(bibtex-find-crossref): Use bibtex-reposition-window.
+	(bibtex-find-entry): Use bibtex-reposition-window.  Always return
+	position of entry if key is found or nil if not found.
+
+2004-12-05  Richard M. Stallman  <rms@gnu.org>
+
+	* cus-edit.el (custom-file): Doc fix.
+
+	* progmodes/sh-script.el (sh-indent-for-then): Change default.
+
+2004-12-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* simple.el (blink-matching-open):
+	* textmodes/tex-mode.el (tex-validate-region):
+	Obey syntax-table text properties.
+
+2004-12-02  Per Abrahamsen  <abraham@dina.kvl.dk>
+
+	* wid-edit.el (widget-specify-field): Add `real-field' property to
+	boundary.
+	(widget-field-at): Use it.
+
+2004-12-02  Richard M. Stallman  <rms@gnu.org>
+
+	* progmodes/cc-mode.el (awk-mode autoload):
+	Supply t meaning interactive function.
+
+	* isearch.el (search-whitespace-regexp): Remove the group.  Doc fix.
+	(isearch-mode-map): No special definition for space.
+	(isearch-whitespace-chars): Command deleted.
+	(isearch-forward-regexp): Doc fix.
+	(isearch-quote-char): When a space is not inside brackets,
+	use `[ ]' instead of just space.
+	(isearch-lazy-highlight-search): Bind search-spaces-regexp.
+
+	* imenu.el (imenu--generic-function): Delete code to exclude
+	matches in comments.
+
+	* man.el (Man-reverse-face): Change default to `highlight'.
+
+	* replace.el (occur-1): Specify t for KEEP-PROPS to occur-engine.
+	(occur-engine): Use `face' prop rather than `font-lock-face'
+	when specifying use of `match-face'.
+	(occur-accumulate-lines): Change arg from NO-PROPS to KEEP-PROPS.
+
+	* emacs-lisp/elint.el (elint-standard-variables): Update list.
+
+	* add-log.el (add-log-current-defun): Handle the case where point
+	is in the header part of a DEFUN construct.
+
+2004-12-02  Dave Love  <fx@gnu.org>
+
+	* progmodes/python.el (python-font-lock-syntactic-keywords):
+	Fix previous change.
+
+2004-12-02  Richard G Bielawski  <Richard.G.Bielawski@wellsfargo.com>  (tiny change)
+
+	* paren.el (show-paren-function): Check for matching chars
+	specified by text props.
+
+2004-12-02  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc.el (calc-read-key-sequence): Leave the old message visible
+	when reading a new key sequence.
+
+2004-12-02  Kim F. Storm  <storm@cua.dk>
+
+	* faces.el (escape-glyph): Rename from glyph.
+	(standard-display-table): Set it here.  Add escape-glyph face to
+	extra slot characters.
+
+	* disp-table.el: Undo 2004-12-01 change.  Display table is now
+	setup in faces.el.
+
+2004-12-02  Mark A. Hershberger  <mah@everybody.org>
+
+	* xml.el (xml-parse-dtd): Don't show validity messages when
+	xml-validating-parser is nil.
+	(xml-substitute-special): Fix validity error messages to
+	actually show the unexpandable entity.  Added validity error if &
+	isn't followed by an entity.
+	(xml-parse-tag): Concatenate any string following the a
+	<![CDATA[]]> section to the parsed CDATA.
+	(xml-parse-dtd): Skip parameter entity declarations and use of
+	parameter entities.
+
+2004-12-01  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* kmacro.el (kmacro-default-counter-format): New var.
+	(kmacro-set-format): Use it.  Delete `(printf format)' from prompt.
+	(kmacro-display): Remove `nil' from `and' form.  Delete call to
+	`format' inside `message'.
+	(kmacro-start-macro): Use `kmacro-default-counter-format'.
+
+2004-12-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* pcvs.el (cvs-header-msg): New function.
+	(cvs-update-header): Use it.  Change calling convention.
+	Correctly handle the case of having simultaneous active processes.
+	(cvs-sentinel): Don't call cvs-update-header any more.
+	(cvs-mode-run): Update call and add cvs-update-header to postproc.
+
+2004-12-01  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-ext.el (calc-inverse, calc-hyperbolic):
+	Change message.
+
+2004-12-01  Juri Linkov  <juri@jurta.org>
+
+	* progmodes/prolog.el (prolog-mode-variables):
+	Fix imenu-generic-expression.
+
+2004-12-01  Daniel Pfeiffer  <occitan@esperanto.org>
+
+	* faces.el (glyph): New face.
+
+	* disp-table.el: Add an autoloaded table, that doesn't require
+	this library, with glyph face.
+
+	* textmodes/conf-mode.el (conf-ppd-mode-syntax-table): New var.
+	(conf-ppd-mode): New conf-mode wrapper for printer descriptions.
+	(conf-quote-normal): Allow normalizing only ' or ".
+	(conf-mode): Regexp-quote constructed comment-start and don't
+	match section {} where "name" contains braces.
+
+	* files.el (auto-mode-alist): Add conf-ppd-mode, inittab and acpid
+	files.
+
+2004-12-01  Kenichi Handa  <handa@m17n.org>
+
+	* term/x-win.el (x-last-selected-text-cut-encoded): New variable.
+	(x-select-text): Don't treat eight-bit-control/graphic chars
+	specially.  Store the encoded text in the X cut buffer.
+	(x-cut-buffer-or-selection-value): Compare the X cut buffer text
+	with x-last-selected-text-cut-encoded.
+
+2004-11-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* man.el (Man-fontify-manpage): Improve handling of ANSI escapes.
+
+2004-11-30  Markus Rost  <rost@ias.edu>
+
+	* textmodes/tex-mode.el (tex-main-file): Add a compatibility with
+	AUCTeX.
+
+2004-11-30  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-arith.el (math-possible-signs): Made stronger checks
+	on signs of intervals.
+	(math-pow-of-zero): Strengthen checks for positive and negative
+	exponents.
+
+	* calc/calc-aent.el, calc/calc-alg.el, calc/calc-arith.el
+	* calc/calc-bin.el, calc/calc-comb.el, calc/calc-cplx.el
+	* calc/calc-embed.el, calc/calc-fin.el, calc/calc-forms.el
+	* calc/calc-frac.el, calc/calc-funcs.el, calc/calc-graph.el
+	* calc/calc-help.el, calc/calc-incom.el, calc/calc-keypd.el
+	* calc/calc-lang.el, calc/calc-map.el, calc/calc-math.el
+	* calc/calc-misc.el, calc/calc-mode.el, calc/calc-mtx.el
+	* calc/calc-poly.el, calc/calc-prog.el, calc/calc-rewr.el
+	* calc/calc-rules.el, calc/calc-sel.el, calc/calc-stat.el
+	* calc/calc-store.el, calc/calc-stuff.el, calc/calc-trail.el
+	* calc/calc-undo.el, calc/calc-units.el, calc/calc-vec.el
+	* calc/calc-yank.el, calc/calcalg2.el, calc/calcalg3.el
+	* calc/calccomp.el, calc/calcsel2.el: Replace dummy autoloaded functions
+	with provide statements.
+
+	* calc/calc-alg.el (math-defsimplify): Move from calc-ext.el.
+
+	* calc/calc-embed.el (calc-do-embedded-activate): Remove from autoloads.
+
+	* calc/calc-ext.el: Remove dummy autoloading functions from autoloads.
+	(calc-load-everything, math-defsimplify): Replace dummy autoloading
+	functions by require statements.
+	(math-defsimplify): Move to calc-alg.el, add to autoloads.
+
+	* calc/calc-graph.el (calc-gnuplot-name, calc-gnuplot-plot-command)
+	(calc-gnuplot-print): Give them values.
+
+	* calc/calc.el: Remove calc-Need-calc-aent and calc-Need-calc-misc from
+	autoloads.
+	Add calc-do-embedded-activate to autoloads.
+	(calc-gnuplot-name, calc-gnuplot-plot-command)
+	(calc-gnuplot-print-command): Move them to calc-graph.el.
+
+2004-11-30  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* term/mac-win.el (ccl-encode-mac-roman-font)
+	(ccl-encode-mac-cyrillic-font)
+	(ccl-encode-mac-centraleuropean-font, encoder-list)
+	(fontset-add-mac-fonts, create-fontset-from-mac-roman-font):
+	Support Cyrillic, CentralEuropean, and Dingbat font display
+
+2004-11-30  Andre Spiegel  <spiegel@gnu.org>
+
+	* vc-hooks.el (vc-recompute-state): Move here from vc.el.
+
+	* vc-cvs.el (vc-cvs-state): Handle the case where vc-state is
+	still nil.
+
+2004-11-29  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* emulation/tpu-edt.el (tpu-help-keypad-map, tpu-help-text)
+	(tpu-word-separator-list, tpu-skip-chars): defconst->defvar.
+
+2004-11-29  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-arith.el (math-pow-of-zero): Take into account different
+	cases of the base and exponent.
+
+2004-11-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+	* simple.el (next-error-buffer-p): Allow for inclusive and
+	exclusive tests for finding a buffer.
+	(next-error-find-buffer): Pass the exclusive and inclusive tests
+	to next-error-buffer-p.
+
+	* replace.el (occur-next-error): Switch to the Occur buffer when
+	appropriate, use the exclusive filter to next-error-find-buffer to
+	do it.  Use the absolute value of the motion amount.
+
+2004-11-29  Kenichi Handa  <handa@m17n.org>
+
+	* startup.el (command-line): Decode all default-directory by
+	locale-coding-system.
+
+2004-11-29  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-aent.el: Remove unnecessary eval-when-compile.
+	(calc-do-quick-calc, calc-do-calc-eval, calc-alg-entry)
+	(math-read-expr-level, calc-check-user-syntax, math-read-factor):
+	Replace calls to calc-extensions by appropriate require, replace
+	calc-extensions-loaded by appropriate featurep.
+
+	* calc/calc-ext.el: Move require to end of file.
+	Remove redundant loading of calc.el.
+	(calc-extensions-loaded): Remove unnecessary variable.
+	(calc-extensions): Remove unnecessary function.
+	(calc-load-everything): Replace calc-need-macros by appropriate require.
+
+	* calc/calc-macs.el: Move provide to end of file.
+	(calc-need-macros): Remove unnecessary function.
+
+	* calc/calc-misc.el (calc-do-handle-whys, calc-last-args-stub)
+	(calc-missing-key, calc-shift-Y-prefix-help, math-concat)
+	(math-trunc, math-floor, calcFunc-inv, math-mod, math-pow):
+	Replace calc-extensions by appropriate require.
+	(calc-power): Replace calc-extensions-loaded by appropriate featurep.
+
+	* calc/calc-prog.el (calc-user-define-formula, calc-do-defmath):
+	Replace calc-need-macros by appropriate require.
+
+	* calc/calc.el: Move require to end of file.
+	(calc-info-filename, calc-autoload-directory, calc-extensions-loaded):
+	Remove unnecessary variable.
+	(calc-do-dispatch, calc-mode, calc-check-defines, calc-create-buffer)
+	(calc, calc-keypad, full-calc-keypad, calc-do, calc-normalize)
+	(calc-binary-op, calc-unary-op, calcDigit-start, calcDigit-key)
+	(math-normalize, math-add, math-mul, math-div, math-format-stack-value)
+	(math-stack-value-offset, math-format-value, math-format-flat-expr)
+	(math-format-number, math-format-bignum, math-read-number)
+	(calc-grab-region, calc-grab-rectangle, calc-grab-sum-down)
+	(calc-grab-sum-across, calc-embedded, defmath): Replace calc-extensions
+	by appropriate require.
+	(calc-check-defines): Replace calc-need-macros by appropriate require.
+
+2004-11-29  Kim F. Storm  <storm@cua.dk>
+
+	* macros.el (insert-kbd-macro): Handle kmacro functions.
+
+2004-11-28  Juri Linkov  <juri@jurta.org>
+
+	* compare-w.el (compare-windows-highlight): Attach each overlay
+	to its window to properly highlight differences while comparing
+	two windows of the same buffer.  Fix arguments.
+	(compare-windows-sync-default-function): Fix arguments of
+	`compare-windows-highlight'.
+
+	* emacs-lisp/edebug.el (edebug-set-global-break-condition):
+	Use `read-expression-history'.  Set initial contents only if
+	`edebug-global-break-condition' is non-nil.  Set histpos to 1
+	if initial contents is equal to the last history element.
+	(edebug-set-conditional-breakpoint): Instead of temporarily
+	prepending the current condition to the history, set initial
+	contents to the current condition.  Set histpos to 1 if initial
+	contents is equal to the last history element.
+
+	* info.el (Info-search-whitespace-regexp): Remove shy group.
+	(Info-search): Forward line if search is on the header line.
+	Use search-whitespace-regexp in two other places.
+
+2004-11-27  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* fringe.el (fringe-indicators): Add fake defvar to avoid compiler
+	warning.  Delay real definition, which uses
+	`set-fringe-indicators-1' till after the definition of that function.
+
+2004-11-28  Kim F. Storm  <storm@cua.dk>
+
+	* fringe.el (fringe): New defgroup.
+	(fringe-mode): Move to fringe group.
+	(fringe-indicators): New defcustom.
+	(set-fringe-indicators-1): New defun.
+
+	* menu-bar.el (menu-bar-options-save): Add fringe-indicators.
+	(menu-bar-showhide-fringe-ind-menu): New keymap.
+	(menu-bar-showhide-fringe-ind-empty)
+	(menu-bar-showhide-fringe-ind-mixed)
+	(menu-bar-showhide-fringe-ind-box)
+	(menu-bar-showhide-fringe-ind-right)
+	(menu-bar-showhide-fringe-ind-left)
+	(menu-bar-showhide-fringe-ind-none): New defuns.
+	(menu-bar-showhide-fringe-menu): Add "Indicators" sub-menu.
+
+2004-11-27  Richard M. Stallman  <rms@gnu.org>
+
+	* comint.el (comint-read-noecho): Add trivial compatibility definition.
+
+	* generic.el (define-generic-mode): Doc fix.
+
+	* menu-bar.el (menu-bar-options-save): For the options
+	that are toggled with menu-bar-make-mm-toggle, don't check
+	for customized-value prop.
+
+2004-11-27  Eli Zaretskii  <eliz@gnu.org>
+
+	* mail/supercite.el (sc-cite-region): Handle the case where
+	sc-cite-frame-alist is a symbol.
+	(sc-uncite-region): Handle the case where sc-uncite-frame-alist is
+	a symbol.
+	(sc-recite-region): Handle the case where sc-recite-frame-alist is
+	a symbol.
+
+2004-11-27  Arne J,Ax(Brgensen  <arne@arnested.dk>  (tiny change)
+
+	* wid-edit.el (widget-narrow-to-field): New function.
+	(widget-complete): Use it.
+
+2004-11-27  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-aent.el (calc-eval-error): Declare and initialize the
+	variable.
+	(calc-eval-error): Don't check if the variable calc-eval-error is bound.
+	(calc-buffer, calc-digit-value, math-expr-data): Declare them.
+	(math-alg-inequalities): Move declaration to earlier in the file.
+
+	* calc/calc-ext.el (calc-command-flags, calc-gnuplot-buffer)
+	(calc-gnuplot-input, math-normalize-a, math-integral-cache):
+	Declare them.
+
+	* calc/calc-lang.el (math-expr-data, math-expr-token)
+	(math-exp-old-pos): Declare them.
+
+	* calc/calc-vec.el (math-exp-pos, math-exp-str, math-exp-old-pos)
+	(math-exp-token, math-exp-keep-spaces, math-expr-data):	Declare them.
+
+2004-11-27  Kim F. Storm  <storm@cua.dk>
+
+	* progmodes/flymake.el: Use (featurep 'xemacs).
+	(flymake-makehash): Change to defsubst.  Use fboundp.
+	(flymake-time-to-float): Remove.
+	(flymake-float-time): Merge code from flymake-time-to-float here.
+	(flymake-replace-regexp-in-string): Change to defsubst.
+	(flymake-split-string-remove-empty-edges):
+	Rename to flymake-split-string.
+	(flymake-split-string): Remove previous defalias.
+	(flymake-get-temp-dir): Change to defsubst.
+	(flymake-make-xemacs-menu, flymake-xemacs-window-edges):
+	Define for xemacs only.
+	(flymake-master-file-count-limit): Change into compiler defvar only.
+	(flymake-find-possible-master-files): Let-bind it dynamically while
+	sorting files using flymake-master-file-compare.
+
+2004-11-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* font-lock.el (font-lock-compile-keywords): Don't complain if the end
+	of defun-prompt-regexp matches inside a comment/string but the
+	beginning is correctly outside everything.
+
+	* progmodes/tcl.el (tcl-omit-ws-regexp): Avoid the case where { or [
+	appears within a string or a comment.
+
+	* emacs-lisp/cl-macs.el (cl-parse-loop-clause, labels): Use gensym
+	rather than make-symbol for symbols which are used in
+	a symbol-macrolet or equivalent.
+
+2004-11-26  Jay Belanger  <belanger@truman.edu>
+
+	* calc-misc.el (calc-last-why-command): Declare it.
+
+	* calc-vec.el (math-grade-vec): New variable.
+	(calcFunc-grade, calcFunc-rgrade, math-grade-beforep):
+	Replace variable grade-vec by declared variable.
+	(math-rb-close): New variable.
+	(math-read-brackets, math-read-vector): Replace variable close by
+	declared variable.
+
+	* calc/calc-yank.el (calc-original-buffer, calc-return-buffer)
+	(calc-one-window, calc-edit-handler, calc-restore-trail)
+	(calc-allow-ret): Declare them.
+
+	* calc/calc-stuff.el (calc-flush-caches): Remove unnecessary variables.
+	(math-lud-cache, math-log2-cache, math-radix-digits-cache)
+	(math-radix-float-cache-tag, math-random-cache)
+	(math-max-digits-cache, math-integral-cache, math-units-table)
+	(math-format-date-cache, math-holidays-cache-tag): Declare them.
+	(math-moc-func): New variable.
+	(math-map-over-constants, math-map-over-constants-rec):
+	Replace variable func by declared variable.
+
+	* calc/calc-store.el (calc-given-value, calc-store-opers):
+	Declare them.
+	(calc-var-name-map): Move declaration to earlier in the file.
+	(calc-pv-pos): New variable.
+	(calc-permanent-variable, calc-insert-permanent-variable):
+	Replace variable pos by declared variable.
+
+	* calc/calc-mtx.el (calc-det-lu): New variable.
+	(math-det-raw, math-det-step): Replace variable lu by declared variable.
+
+	* calc/calc-map.el (math-ms-temp, math-ms-args): New variables.
+	(math-multi-subst, math-multi-subst-rec): Replace variables temp
+	and arg by declared variables.
+	(calcFunc-reducer): Fix incorrect variable.
+	(math-inner-mul-func, math-inner-add-func): New variables.
+	(calcFunc-inner, math-inner-mats): Replace variables mul-func
+	and add-func by declared variables.
+
+	* calc/calc-incom.el (calc-prev-char, calc-prev-prev-char)
+	(calc-digit-value): Declare them.
+
+	* calc/calc-help.el (Info-history): Declare it.
+	(calc-describe-key): Make calc-summary-indentation a local variable.
+	(calc-help-long-names): Move declaration to earlier in file.
+
+	* calc/calc-embed.el (calc-original-buffer): Declare it.
+	(calc-embed-outer-top, calc-embed-outer-bot, calc-embed-top)
+	(calc-embed-bot): New variables.
+	(calc-do-embedded, calc-embedded-mark-formula)
+	(calc-embedded-find-bounds, calc-embedded-duplicate)
+	(calc-embedded-new-formula, calc-embedded-make-info):
+	Replace vars outer-top, outer-bot, bot and top by declared variables.
+	(calc-embed-prev-modes): New variable.
+	(calc-embedded-set-modes, calc-embedded-update): Replace variable
+	prev-modes with declared variable.
+	(calc-embed-vars-used): New variable.
+	(calc-embedded-make-info, calc-embedded-evaluate-expr)
+	(calc-embedded-update, calc-embedded-find-vars): Replace variable
+	vars-used by declared variable.
+
+	* calc/calc-bin.el (math-format-radix-float): Make pos a local variable.
+	(math-format-radix-float): Remove unnecessary setq.
+	(math-radix-float-cache): Declare it.
+
+	* calc/calcsel2.el (calc-keep-selection): Declare it.
+
+	* calc/calc-maint.el: Remove file.
+
+2004-11-26  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
+
+	* textmodes/bibtex.el (bibtex-sort-entry-class)
+	(bibtex-comment-start): Use defcustom.
+	(bibtex-entry-field-alist): Use nil if initial content of the
+	field is undefined.  Fix docstring.
+	(bibtex-parse-keys-timeout, bibtex-autokey-additional-names)
+	(bibtex-generate-autokey, bibtex-parse-buffers-stealthily)
+	(bibtex-mode, bibtex-field-list, bibtex-entry-updat)
+	(bibtex-autofill-entry, bibtex-entry-index, bibtex-next-field):
+	Fix docstring.
+	(bibtex-autokey-title-terminators): Use only one regexp.
+	(bibtex-string-maybe-empty-head): New variable.
+	(bibtex-remove-delimiters-string): New function.
+	(bibtex-text-in-field-bounds, bibtex-text-in-string):
+	Use bibtex-remove-delimiters-string.
+	(bibtex-progress-message, bibtex-field-left-delimiter)
+	(bibtex-field-right-delimiter, bibtex-entry-left-delimiter)
+	(bibtex-entry-right-delimiter, bibtex-search-entry): Use eq.
+	(bibtex-insert-kill): Rename from `bibtex-insert-current-kill'.
+	Simplify.
+	(bibtex-format-entry): Use save-excursion for inherited booktitle.
+	Use eq and bibtex-remove-delimiters-string.  For end markers use
+	insertion type so that marker stays after inserted text.
+	(bibtex-autokey-get-names): Return empty string if name is missing.
+	(bibtex-autokey-demangle-name): Call bibtex-autokey-abbrev before
+	calling bibtex-autokey-name-case-convert.
+	(bibtex-autokey-demangle-title):
+	Call bibtex-autokey-titleword-case-convert.  Remove call to
+	bibtex-autokey-titleword-case-convert from bibtex-autokey-get-title.
+	(bibtex-global-key-alist, bibtex-read-string-key): New functions.
+	(bibtex-read-key): New optional arg global.
+	(bibtex-files-expand): New optional arg force.
+	(bibtex-complete-string-cleanup): Expansion of abbrev can be absent.
+	(bibtex-complete-crossref-cleanup): Rename from
+	bibtex-complete-key-cleanup.  Simplify code.
+	(bibtex-copy-summary-as-kill): Remove arg key.  Use looking-at.
+	Operate on current entry.
+	(bibtex-button): Add docstring.
+	(bibtex-entry): Simplify.
+	(bibtex-make-field): Replace optional arg called-by-yank with more
+	specific args move and interactive.
+	(bibtex-end-of-entry): Use forward-sexp.
+	(bibtex-find-entry-globally): Remove.
+	(bibtex-find-crossref): Allow for crossref key located in other buffer.
+	Bound to C-c C-x.
+	(bibtex-find-entry): New optional args global and display.
+	(bibtex-find-text): Fix docstring.  Remove arg as-if-interactive.
+	(bibtex-validate): Use arg force of bibtex-files-expand.
+	(bibtex-clean-entry): Bugfix, clean string entries properly.
+	Always keep point at beginning of entry.
+	(bibtex-complete): Bugfix.  Handle string entries properly.
+	Call cleanup functions only if needed.
+	(bibtex-String): Use bibtex-read-string-key.
+	(bibtex-url): Use bibtex-remove-delimiters-string.  Do not alter
+	case of replacement text.
+
+2004-11-26  Lars Hansen  <larsh@math.ku.dk>
+
+	* tramp.el (tramp-handle-directory-files-and-attributes): New function.
+	(tramp-perl-directory-files-and-attributes): New constant.
+	(tramp-file-name-handler-alist): Delete file-directory-files, add
+	directory-files-and-attributes.
+	(tramp-perl-file-attributes): Surround uid and gid by double
+	quotes. Change parameter id-format from nonnumeric.
+	(tramp-convert-file-attributes): New function.
+	(tramp-handle-file-attributes): Use it.
+	(tramp-maybe-send-perl-script): New function.
+	(tramp-handle-file-attributes-with-perl): Use it. Don't convert
+	file mode. Change parameter id-format from nonnumeric.
+	(tramp-handle-file-attributes-with-ls): Change parameter id-format
+	from nonnumeric.
+	(tramp-post-connection): Don't send tramp-perl-file-attributes
+	script. Reset connection property "perl-scripts".
+	(tramp-handle-insert-directory): Run real handler when ls-lisp is
+	in use.
+
+2004-11-26  Lars Hansen  <larsh@math.ku.dk>
+
+	* desktop.el (desktop-read): Replace mapcar with mapc.
+	(desktop-create-buffer): Replace mapcar with mapc.
+	Remove redundant piece of code.
+
+2004-11-27  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gud.el (gud-display-line): Use display-buffer
+	for GDB-UI as for GUD.
+
+	* progmodes/gdb-ui.el (gdb-view-source, gdb-selected-view):
+	Delete variables.
+	(gdb-ann3): Don't make GUD buffer dedicated.
+	(gdb-goto-breakpoint, gdb-display-buffer): Don't always dedicate.
+	(gdb-display-source-buffer): Delete function.
+	(gdb-view-source-function, gdb-view-assembler): Delete functions.
+	(menu): Delete menu bindings for viewing source/assembler.
+	(gdb-setup-windows, gdb-restore-windows):
+	Don't dedicate GUD. No assembler now.
+	(gdb-reset): No need to undedicate source buffers now.
+	(gdb-source-info): No assembler now.
+
+2004-11-26  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-frame-parameters): Match height and
+	width to those for special frames.
+	(gdb-frame-breakpoints-buffer): Use gdb-frame-parameters.
+	Use display-buffer.
+	(gdb-frame-stack-buffer, gdb-frame-threads-buffer)
+	(gdb-frame-registers-buffer, gdb-frame-locals-buffer)
+	(gdb-frame-assembler-buffer): Rework like
+	gdb-frame-breakpoints-buffer.
+
+2004-11-25  Richard M. Stallman  <rms@gnu.org>
+
+	* progmodes/flymake.el: Reindent.
+	(flymake-split-string):	Turn into defalias.
+	(flymake-fix-file-name): Rename from flymake-fix-path-name.
+	(flymake-ensure-ends-with-slash): Rename arg to FILENAME.
+	(flymake-get-common-file-prefix): Rename from ...path...  Doc fix.
+	(flymake-build-relative-filename): Rename from ...path.
+	Fix error message.
+
+2004-11-25  Cheng Gao  <chenggao@gmail.com>
+
+	* progmodes/flymake.el: Much whitespace and capitalization change.
+	Move `provide' to end.  Require `compile' only when compiling.
+
+2004-11-24  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-alg.el: Added comment.
+	(math-polynomial-base): Replace variable mpb-top-expr by
+	math-poly-base-top-expr.
+
+	* calc/calc-poly.el (math-poly-base-top-expr): New variable.
+	(math-polynomial-p1): Replace variable mpb-top-expr by declared
+	variable.
+	(math-poly-base-total-base): New variable.
+	(math-total-polynomial-base, math-polynomial-p1): Replace variable
+	mpb-total-base by declared variable.
+	(math-factored-vars, math-to-list): Declare it.
+	(math-fact-expr): New variable.
+	(calcFunc-factors, calcFunc-factor, math-factor-expr)
+	(math-factor-expr-try, math-factor-expr-part): Replace variable
+	expr by declared variable.
+	(math-fet-x): New variable.
+	(math-factor-expr-try, math-factor-poly-coefs): Replace variable x
+	by declared variable.
+	(math-factor-poly-coefs): Make temp a local variable.
+
+	* calc/calc-units.el (calc-convert-units): Make units a local
+	variable.
+	(calc-num-units, calc-den-units): New variables.
+	(calc-explain-units, calc-explain-units-rec): Replace variables
+	num-units and den-units by declared variables.
+	(math-cu-unit-list): New variable.
+	(math-build-units-table, math-compare-unit-names)
+	(math-convert-units, math-convert-units-rec): Replace variable
+	unit-list by declared variable.
+	(math-fbu-base, math-fbu-entry): New variables.
+	(math-find-base-units, math-find-base-units-rec): Replace variables
+	base and entry by declared variables.
+	(math-which-standard): New variable.
+	(math-to-standard-units, math-to-standard-rec): Replace variable
+	which-standard by declared variable.
+	(math-fcu-u): New variable.
+	(math-find-compatible-unit, math-find-compatible-unit-rec):
+	Replace variable u by declared variable.
+	(math-cu-new-units, math-cu-pure): New variables.
+	(math-convert-units, math-convert-units-rec): Replace variables
+	new-units and pure by declared variables.
+	(math-try-cancel-units): New variable.
+	(math-simplify-units-quotient): Replace variable try-cancel-units by
+	declared variable.
+
+2004-11-24  Richard M. Stallman  <rms@gnu.org>
+
+	* textmodes/ispell.el (ispell-check-version):
+	If default-directory is nonexistent, use home dir.
+
+	* progmodes/grep.el (grep-regexp-alist):
+	Don't match parens around line numbers.
+
+	* progmodes/cperl-mode.el (cperl-indent-region)
+	(cperl-imenu--create-perl-index, cperl-xsub-scan):
+	Don't print progress messages.
+
+	* progmodes/compile.el (compilation-mode-map):
+	Don't inherit from compilation-minor-mode-map;
+	copy its bindings instead.  But the menu bar Compile
+	entry now does inherit from compilation-menu-map.
+
+	* emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
+	Use with-no-warnings around compiler-macroexpand.
+
+	* imenu.el: Don't always require newcomment.
+	(imenu--generic-function): Call comment-normalize-vars
+	if we have a comment syntax.
+	Exit the loop if REGEXP matches the null string.
+	Test comment-start as well as comment-start-skip
+	when deciding whether to check for comments.
+
+	* tooltip.el (tooltip-mode): Doc fix.
+
+	* term.el (term-escape-char, term-mode): Doc fixes.
+
+2004-11-24  Dave Love  <fx@gnu.org>
+
+	* progmodes/python.el (python-font-lock-syntactic-keywords):
+	Check for escapes in the regexp.
+	(python-quote-syntax): Don't do it here.
+
+2004-11-24  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-breakpoints-mode-map)
+	(gdb-frames-mode-map, gdb-threads-mode-map)
+	(gdb-registers-mode-map, gdb-locals-mode-map)
+	(gdb-assembler-mode-map): Bind "q" to kill-this-buffer.
+	(gdb-set-window-buffer): Rename from dedicated-switch-to-buffer.
+
+	Suggested by Stefan Monnier <monnier@iro.umontreal.ca>:
+	(dedicated-switch-to-buffer): Rework.
+	(gdb-var-evaluate-expression-handler, gdb-put-string):
+	Remove unused variable bindings.
+	(gdb-setup-windows, gdb-display-buffer):
+	Simplify. Use pop-to-buffer.
+	(gdb-view-source-function): Simplify.
+	(gdb-frame-breakpoints-buffer):
+	Use pop-to-buffer, special-display-regexps.
+
+2004-11-24  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+	* progmodes/f90.el (f90-smart-end)
+	(f90-previous-statement, f90-beginning-of-block): Doc fix.
+	(f90-calculate-indent): Handle un-named PROGRAM blocks.
+	(f90-end-of-block): Doc fix.  Make check of outermost block
+	conditional on value of `f90-smart-end'.
+	(f90-block-match): Hack to deal with un-named PROGRAM blocks.
+	Handle case where END-BLOCK is nil.
+	(f90-match-end): Handle un-named PROGRAM blocks.
+	(f90-backslash-not-special): New function.
+
+2004-11-24  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc.el (calc-embedded-active): Removed unnecessary
+	declaration.
+	(calc-show-banner): Removed redundant declaration.
+
+	* calc/calc-graph.el (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):
+	Remove redundant initial values.
+
+	* calc/calc-arith.el (math-scalar-functions)
+	(math-nonscalar-functions, math-scalar-if-args-functions)
+	(math-real-functions, math-positive-functions)
+	(math-nonnegative-functions, math-real-scalar-functions)
+	(math-real-if-arg-functions, math-integer-functions)
+	(math-num-integer-functions, math-rounding-functions)
+	(math-float-rounding-functions, math-integer-if-args-functions)
+	(math-super-types): Move declarations to earlier in file.
+	(math-unit-prefixes): Declared it.
+	(math-floor-prec, math-trunc-prec): New variables.
+	(math-trunc-fancy): Replace variable prec by declared variable.
+	(math-floor-fancy): Replace variable prec by declared variable.
+	(math-com-bterms): New variable.
+	(math-commutative-equal, math-commutative-collect):
+	Replace variable bterms by declared variable.
+
+	* calc/calc-misc.el (math-trunc): Replace variable prec by
+	math-trunc-prec.
+	(math-floor): Replace variable prec by math-floor-prec.
+
+	* calc/calc-forms.el (math-fd-date, math-fd-dt, math-fd-year)
+	(math-fd-month, math-fd-day, math-fd-weekday, math-fd-hour)
+	(math-fd-minute, math-fd-second, math-fd-bc-flag): New variables.
+	(math-format-date, math-format-date-part): Replace variables
+	date, dt, year, month, day, weekday, hour, minute, second and
+	bc-flag by declared variables.
+	(math-pd-str): New variable.
+	(math-parse-date, math-parse-date-word, math-parse-standard-date):
+	Replace variable str by declared variable.
+	(math-daylight-savings-hook, math-tzone-names): Move definitions
+	to earlier in the file.
+	(var-TimeZone, math-exp-str, math-exp-pos): Declare them.
+	(math-sh-year): New variable.
+	(math-setup-add-holidays, math-setup-holidays)
+	(math-setup-year-holidays): Replace variable `year' by declared
+	variable.
+
+	* calc/calc-math.el (math-nrf-n, math-nrf-nf, math-nrf-nfm1):
+	New variables.
+	(math-nth-root-float, math-nth-root-float-iter): Replace variables
+	n, nf and nfm1 by declared variables.
+	(math-nri-n): New variable.
+	(math-nth-root-integer, math-nth-root-int-iter): Replace variable
+	n by declared variable.
+	(calcFunc-log): Removed misplaced condition.
+
+2004-11-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* generic.el (generic-mode-set-comments): Accept an empty comment-end.
+
+2004-11-24  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (dedicated-switch-to-buffer): New function.
+	(gdb-ann3, gdb-setup-windows, gdb-restore-windows):
+	Dedicate gdb-related windows.
+	(gdb-display-buffer): Dedicate gdb-related windows. Don't grab
+	other frames.
+	(gdb-reset): Remove dedicated property after debugging.
+
+2004-11-24  Jay Belanger <belanger@truman.edu>
+
+	* calc/calc-sel.el: Add comment.
+
+	* calc/calc.el (math-stack-value-offset): Replace variables c,
+	wid and off with math-svo-c, math-svo-wid and math-svo-off.
+
+	* calc/calccomp.el (math-comp-sel-tag): Declare it.
+	(math-svo-c, math-svo-wid, math-svo-off): New variables.
+	(math-stack-value-offset-fancy): Replace variables c, wid and off
+	by declared variables.
+	(math-comp-just, math-comp-comma-spc): New variables.
+	(math-compose-expr, math-compose-matrix): Replace variables `just'
+	and comma-spc by declared variable.
+	(math-comp-vector-prec): New variable.
+	(math-compose-expr, math-compose-matrix, math-compose-rows):
+	Replace variable vector-prec by declared variable.
+	(math-comp-left-bracket, math-comp-right-bracket)
+	(math-comp-comma): New variables.
+	(math-compose-expr, math-compose-rows): Replace variables
+	left-bracket, right-bracket and comma by declared variables.
+	(math-comp-full-width): New variable.
+	(math-comp-to-string-flat, math-comp-to-string-flat-term):
+	Replace variable full-width by declared variable.
+	(math-comp-highlight, math-comp-word, math-comp-level)
+	(math-comp-margin, math-comp-pos, math-comp-buf, math-comp-base)
+	(math-comp-hgt, math-comp-tag, math-comp-hpos, math-comp-vpos):
+	New variables.
+	(math-comp-to-string-flat, math-comp-to-string-flat-term)
+	(math-comp-sel-flat-term): Replace variables comp-highlight,
+	comp-word, comp-level, comp-margin, comp-pos and comp-buf by
+	declared variables.
+	(math-comp-simplify, math-comp-simplify-term)
+	(math-comp-add-string, math-comp-add-string-sel):
+	Replace	variables comp-highlight, comp-buf, comp-base,
+	comp-height, comp-tag, comp-hpos and comp-vpos by declared variables.
+
+2004-11-23  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* cus-start.el (all): Add x-use-old-gtk-file-dialog.
+
+	* mail/emacsbug.el (report-emacs-bug): Catch error that x-server-vendor
+	and x-server-version may throw.
+
+2004-11-23  Kim F. Storm  <storm@cua.dk>
+
+	* subr.el (substitute-key-definition-key): Optimize.
+	Don't call indirect-function for nil defn (always signals error).
+
+	* ido.el (ido-read-internal): Fix require-match check when
+	ido-directory-too-big is set.
+
+2004-11-23  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-ext.el (math-read-replacement-list)
+	(math-read-superscripts): New variables.
+	(math-read-preprocess-string): New function.
+	(math-read-expr): Filter input through math-read-preprocess-string.
+
+	* calc/calc-aent.el (math-read-exprs): Filter input through
+	math-read-preprocess-string.
+
+2004-11-23  Daniel Pfeiffer  <occitan@esperanto.org>
+
+	* progmodes/compile.el (compilation-start): In cd command use
+	substitute-env-vars -- not quite shell compatible but better than
+	nothing.
+	(compilation-error-regexp-alist-alist): Simplify ftnchek to only
+	handle the newer versions messages, which are more parseable.
+
+2004-11-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* reveal.el (reveal-mode-map): New var.
+	(reveal-mode): Use it.
+
+2004-11-23  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-flush-pending-output): New variable.
+	(gdb-send-item, gdb-resync, gud-gdba-marker-filter): Use it.
+
+2004-11-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* buff-menu.el (list-buffers-noselect): Re-add the leading space in the
+	header-line when needed.
+	Use fixed-pitch only in the header-line.
+	Build the underline automatically.  Use emdash if available.
+
+2004-11-22  Richard M. Stallman  <rms@gnu.org>
+
+	* dired.el (dired-recursive-copies): Move from dired-aux.el.
+	* dired-aux.el (dired-recursive-copies): Move to dired.el.
+
+2004-11-22  Nick Roberts  <nickrob@snap.net.nz>
+
+	* progmodes/gdb-ui.el (gdb-resync): New function.
+	(gdb-pre-prompt, gdb-prompt, gdb-starting, gdb-stopping)
+	(gdb-frame-begin, gdb-stopped, gdb-post-prompt):
+	Use it to fail more gracefully.
+	(gdb-variables): Delete variable.
+	Re-order variables to reduce byte-compiler warnings.
+
+2004-11-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* descr-text.el (describe-char):
+	* paren.el (show-paren-function):
+	* subr.el (syntax-after): Undo last change.
+
+	* progmodes/python.el (run-python): Don't hard code *Python*.
+	Don't modify global process-environment.
+	(python-send-region, python-load-file): Don't assume that
+	python-buffer == (process-buffer (python-proc)).
+	(python-switch-to-python): Simplify.
+
+	* dired.el (dired-align-file): Don't assume line starts with spaces.
+
+2004-11-21  Jay Belanger  <belanger@truman.edu>
+
+	* calc/calc-ext.el (math-read-big-expr, math-read-big-bigp):
+	Replace variable `lines' by math-read-big-lines.
+	(math-read-big-expr): Replace variables the-baseline, the-h2
+	and err-msg by math-read-big-baseline, math-read-big-h2 and
+	math-read-err-msg.
+	(math-read-big-bigp): Replace variable h2 with math-rb-h2.
+
+	* calc/calc-lang.el (math-read-big-rec): Fix typo.
+	(math-read-big-balance): Replace unbound variable by value.
+	(math-read-big-lines): New variable.
+	(math-read-big-rec, math-read-big-char, math-read-big-emptyp)
+	(math-read-big-error, math-read-big-balance): Replace variable
+	`lines' by declared variable.
+	(math-read-big-baseline, math-read-big-h2): New variables.
+	(math-read-big-rec): Replace variables the-baseline and the-h2
+	by declared variables.
+	(math-rb-h1, math-rb-h2, math-rb-v1, math-rb-v2): New variables.
+	(math-read-big-rec, math-read-big-char, math-read-big-emptyp)
+	(math-read-big-balance): Replace variables h1, h2, v1 and v2 by
+	declared variables.
+	(math-read-big-err-msg): New variable.
+	(math-read-big-error): Replace variable err-msg by declared variable.
+
+2004-11-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* ses.el: Add coding cookie.
+	Fix up docstrings, follow new commenting conventions.
+	(ses-header-line-menu): Fix missing variable rename for header-row.
+	(ses-cell-size): Remove.
+	(ses-make-cell): New function.
+	(ses-cell, ses-insert-row, ses-insert-column): Use it.
+	(ses-calculate-cell): Remove unused var `symbol'.
+	(ses-narrowed-p): New function.
+	(ses-goto-data, undo-more, ses-reconstruct-all): Use it.
+	(ses-initial-file-trailer): Change ;;; to ;; for local vars.
+	(ses-load, ses-reconstruct-all): Adjust string search accordingly.
+	(ses-setup): Use restore-buffer-modified-p.
+	(ses-cleanup): Remove unused var `end'.
+	(ses-header-string-left-offset): Remove.
+	(ses-create-header-string): Adjust to new behavior of `align-to'.
+	Truncate excessively large fields to preserve alignment.
+	(ses-reconstruct-all): Remove unused var `refs'.
+	(ses-read-cell-printer): Remove unused var `prompt'.
+	(ses-delete-row): Remove unused var `pos'.
+	(ses-delete-column): Remove unused var `new'.
+
 2004-11-21  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 
 	* ps-print.el: Insert :version tag into all defgroup and defcustom.
@@ -12,48 +1009,35 @@
 
 	* calc/calc-prog.el (math-integral-cache-state, calc-lang)
 	(calc-original-buffer): Declare them.
-
 	(calc-user-formula-alist): New variable.
 	(calc-user-define-formula, calc-fix-user-formula)
 	(calc-user-define-composition, calc-finish-formula-edit):
 	Replace variable `alist' by declared variable.
-
 	(var-q0, var-q1, var-q2, var-q3, var-q4, var-q5, var-q6)
 	(var-q7, var-q7, var-q8, var-q9): Declare them.
 	(calc-kbd-push): Don't check to see if var-q0 through var-q9
 	are bound.
-
 	(calcFunc-typeof): Replace undeclared variable by expression.
-
 	(math-exp-env): New variable.
-	(math-define-body, math-define-exp): Replace exp-env by declared
-	variable.
-
+	(math-define-body, math-define-exp): Replace exp-env by declared var.
 	(math-define-exp): Replace misplaced variable by expression.
 
 	* calc/calcalg3.el (calc-curve-nvars, calc-curve-varnames)
 	(calc-curve-model, calc-curve-coefnames): New variables.
 	(calc-curve-fit, calc-get-fit-variables): Replace variables nvars,
 	varnames, model and coefnames by declared variables.
-
 	(math-root-widen): New variable.
 	(math-search-root, math-find-root): Replace variable root-widen by
 	declared variable.
-
 	(var-DUMMY): Declare it.
 	(math-root-vars, math-min-vars): Move the declarations to earlier in
 	the file.
-
 	(math-brent-min): Make d a local variable.
-
 	(math-find-minimum): Replace non-existent variable.
-
 	(math-ninteg-romberg): Remove unnecessary variable.
-
 	(math-ninteg-temp): New variable.
 	(math-ninteg-romberg, math-ninteg-midpoint): Replace variable
 	integ-temp by declared variable.
-
 	(math-fit-first-var, math-fit-first-coef, math-fit-new-coefs):
 	New variables.
 	(math-general-fit): Replace variables first-var, first-coef and
@@ -61,7 +1045,6 @@
 	(calcFunc-fitvar): Replace variable first-var by declared variable.
 	(calcFunc-fitparam): Replace variable first-coef by declared variable.
 	(calcFunc-fitdummy): Replace variable new-coefs by declared variable.
-
 	(math-all-vars-vars, math-all-vars-found): New variables.
 	(math-all-vars-in, math-all-vars-rec): Replace variables vars and
 	found by declared variable math-all-vars-vars.
@@ -73,6 +1056,13 @@
 
 2004-11-20  Richard M. Stallman  <rms@gnu.org>
 
+	* isearch.el (isearch-mode-map): Don't bind SPC.
+	(isearch-whitespace-chars): Function deleted.
+	(isearch-search): Bind search-spaces-regexp.
+	(isearch-lazy-highlight-search): Likewise.
+	(search-whitespace-regexp): Doc fix.
+	(isearch-forward-regexp): Doc fix.
+
 	* emacs-lisp/bytecomp.el (byte-compile-form):
 	Move the calls to byte-compile-set-symbol-position,
 	to avoid having two for the same symbol occurrence.
@@ -135,24 +1125,17 @@
 	* calc/calc-sel.el (calc-edit-disp-trail): Declare it.
 	(calc-finish-selection-edit):  Replace variable disp-trail by
 	declared variable.
-
-	(calc-selection-cache-entry): Move declaration to earlier in
-	the file.
-
+	(calc-selection-cache-entry): Move declaration to earlier in the file.
 	(calc-selection-cache-num, calc-selection-cache-comp)
 	(calc-selection-cache-offset, calc-selection-true-num)
 	(calc-final-point-line, calc-final-point-column)
 	(calc-original-buffer): Declare them.
-
 	(calc-fnp-op, calc-fnp-num): New variables.
 	(calc-find-nth-part, calc-find-nth-part-rec)
-	(calc-select-previous): Replace op and num by declared
-	variables.
-
+	(calc-select-previous): Replace op and num by declared variables.
 	(calc-rsf-old, calc-rsf-new): New variables.
 	(calc-replace-sub-formula, calc-replace-sub-formula-rec):
 	Replace variables old and new by declared variables.
-
 	(calc-sel-reselect): New variable.
 	(calc-auto-selection, calc-enter-selection, calc-edit-selection)
 	(calc-sel-evaluate, calc-sel-expand-formula, calc-sel-expand-formula)
@@ -163,39 +1146,29 @@
 	(math-bound-vars, math-conds, math-copy-neg, math-rhs)
 	(math-pattern, math-remembering, math-aliased-vars, math-mt-many)
 	(math-import-list, math-rewrite-phase): Declare them.
-
 	(math-rewrite):  Use let* to declare variables.
-
 	(calc-rewrite-selection): Make rules a local variable.
-
 	(calc-rewr-sel): New variable.
 	(calc-rewrite-selection, calc-locate-selection-marker)
 	(calc-rewrite): Use the declared variable calc-rewr-sel instead
 	of sel.
-
 	(math-rewrite-whole-expr): New variable.
 	(math-rewrite, math-rewrite-phase): Replace variable expr by
 	declared variable.
-
 	(math-rewrite-heads-heads, math-rewrite-heads-skips)
 	(math-rewrite-heads-blanks ): New variables.
 	(math-rewrite-heads, math-rewrite-heads-rec): Replace variables
 	heads, skips and blanks by declared variables.
-
 	(math-rwcomp-subst-old, math-rwcomp-subst-new)
 	(math-rwcomp-subst-old-func, math-rwcomp-subst-new-func):
 	New variables.
 	(math-rwcomp-substitute, math-rwcomp-subst-rec): Replace variables
 	old, new, old-func and new-func by declared variables.
-
 	(math-rwcomp-assoc-args, math-rwcomp-addsub-args):
 	Remove unnecessary variable.
-
 	(math-apply-rw-regs): New variable.
 	(math-apply-rewrites, math-rwapply-replace-regs)
-	(math-rwapply-reg-looks-negp): Replace variable regs by declared
-	variable.
-
+	(math-rwapply-reg-looks-negp): Replace variable regs by declared var.
 	(math-apply-rw-ruleset): New variable.
 	(math-apply-rewrites, math-rwapply-remember): Replace variable
 	ruleset by declared variable.
@@ -218,8 +1191,7 @@
 
 2004-11-18  Jay Belanger  <belanger@truman.edu>
 
-	* calc/calc-alg.el (math-simplify-divisor): Remove unnecessary
-	variables.
+	* calc/calc-alg.el (math-simplify-divisor): Remove unnecessary vars.
 
 2004-11-17  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 
@@ -265,38 +1237,30 @@
 
 	* calc/calc-alg.el (calc-poly-div): Make calc-poly-div-remainder
 	a local variable.
-
 	(math-eval-rules-cache, math-eval-rules-cache-other): Declare them.
-
 	(math-top-only): New variable.
 	(math-simplify, math-simplify-step): Replace variable top-only by
 	declared variable math-top-only.
-
 	(math-simplify-expr): Declare it.
-	Replaced argument expr in all calls of math-defsimplify by
+	Replace argument expr in all calls of math-defsimplify by
 	math-simplify-expr.
 	(math-simplify-plus, math-simplify-times, math-simplify-divide)
 	(math-simplify-divisor, math-simplify-one-divisor)
 	(math-simplify-mod, math-simplify-ineq, math-simplify-sqrt)
 	(math-simplify-pow): Replace variable expr by declared variable
 	math-simplify-expr.
-
 	(math-simplify-divisor): Remove local variables temp and op.
 	(math-simplify-one-divisor): Make temp and op local variables.
-
 	(math-simplify-divisor-nover, math-simplify-divisor-dover):
 	New variables.
 	(math-simplify-divisor, math-simplify-one-divisor):
 	Replace variables nover and dover by declared variables.
-
 	(math-expr-subst-new, math-expr-subst-old): New variables.
 	(math-expr-subst, math-expr-subst-rec): Replace variables new
 	and old by declared variables.
-
 	(math-is-poly-degree, math-is-poly-loose): New variables.
 	(math-is-polynomial, math-is-poly-rec): Replace variables degree
 	and loose by declared variables.
-
 	(math-poly-base-const-ok, math-poly-base-pred): New variables.
 	(math-polynomial-base, math-polynomial-base-rec):
 	Replace variables const-ok and mpb-pred by declared variables.
@@ -326,7 +1290,7 @@
 
 	* progmodes/idlwave.el, progmodes/idlw-toolbar.el
 	* progmodes/idlw-shell.el, progmodes/idlw-rinfo.el:
-	Updated to IDLWAVE version 5.5.  Too many changes to list them here.
+	Update to IDLWAVE version 5.5.  Too many changes to list them here.
 	* progmodes/idlw-help.el: New file.
 
 2004-11-16  Richard M. Stallman  <rms@gnu.org>
@@ -417,7 +1381,6 @@
 
 	* calc/calcalg2.el (math-integrate-by-parts):  Remove unused
 	variable var-thing.
-
 	(math-integ-depth, math-integ-level, math-integral-limit)
 	(math-enable-subst, math-any-substs, math-integ-msg)
 	(math-prev-parts-v, math-good-parts, math-max-integral-limit)
@@ -425,10 +1388,8 @@
 	(math-solve-simplifying, var-IntegLimit, math-solve-sign)
 	(var-GenCount):  Declare these variables.
 	(calcFunc-integ):  Don't check if var-IntegLimit is bound.
-
 	(math-integral-cache, math-integral-cache-state):
 	Move declarations to earlier in the file.
-
 	(math-deriv-var, math-deriv-total, math-deriv-symb)
 	(math-cur-record, math-has-rules, math-t1, math-t2, math-t3)
 	(math-so-far, math-integ-expr, math-expr-parts, calc-low)
@@ -834,6 +1795,11 @@
 	current frame (in case of recursive calls).
 	(gdb-show-changed-values): Add :version keyword.
 
+2004-11-09  Kenichi Handa  <handa@m17n.org>
+
+	* international/mule-cmds.el: Change coding: tag back to
+	iso-2022-7bit.
+
 2004-11-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* international/mule-cmds.el: Change coding-system to utf-8.
@@ -1160,7 +2126,7 @@
 	Use `flymake-reformat-err-line-patterns-from-compile-el' to convert
 	`compilation-error-regexp-alist-alist' to internal Flymake format.
 
-	* progmodes/flymake.el: eliminated byte-compiler warnings.
+	* progmodes/flymake.el: Eliminate byte-compiler warnings.
 
 2004-11-01  Jay Belanger  <belanger@truman.edu>
 
@@ -2340,7 +3306,7 @@
 
 2004-09-21  Jay Belanger  <belanger@truman.edu>
 
-	* calc/calc-graph.el (calc-graph-add-curve): Moved the call to
+	* calc/calc-graph.el (calc-graph-add-curve): Move the call to
 	`calc-graph-set-styles' so the gnuplot buffer will appear in a
 	separate window.
 
@@ -2360,7 +3326,7 @@
 
 2004-09-21  Jay Belanger  <belanger@truman.edu>
 
-	* calc/calc.el (calc-mode-var-list): Removed unnecessary quotes.
+	* calc/calc.el (calc-mode-var-list): Remove unnecessary quotes.
 
 2004-09-20  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -2513,8 +3479,8 @@
 	(calc-invocation-macro, calc-show-banner): Give these values as
 	part of `calc-mode-var-list's initialization after the variables
 	are declared with defvar.
-	(calc-bug-address):  Changed email address to send bug
-	reports to. Also changed the maintainer address at the top.
+	(calc-bug-address):  Change email address to send bug reports to.
+	Change the maintainer address at the top.
 	(calc-mode): Compare `calc-settings-file' to `user-init-file' rather
 	than "\\.emacs" to determine if it is the user-init-file.
 
@@ -3072,9 +4038,9 @@
 	* progmodes/grep.el (grep-default-command): Use find-tag-default.
 	(grep-tag-default): Function deleted.
 
-	* subr.el (find-tag-default): Moved from etags.el.
-
-	* progmodes/etags.el (find-tag-default): Moved to subr.el.
+	* subr.el (find-tag-default): Move from etags.el.
+
+	* progmodes/etags.el (find-tag-default): Move to subr.el.
 
 	* emacs-lisp/lisp-mode.el (prin1-char): Put `shift' modifier
 	into the basic character if it has an uppercase form.
@@ -3130,7 +4096,7 @@
 	* whitespace.el (global-whitespace-mode): New alias
 	for whitespace-global-mode.
 
-	* speedbar.el (speedbar-file-regexp): Definition moved up.
+	* speedbar.el (speedbar-file-regexp): Move definition up.
 	(speedbar-mode, speedbar-set-mode-line-format):
 	Use with-no-warnings.
 	(speedbar-emacs-popup-kludge): Delete Emacs 19 alternative.
@@ -3368,7 +4334,7 @@
 
 	* progmodes/cc-engine.el (c-syntactic-re-search-forward):
 	Fix bug so that it doesn't go past the closing paren when PAREN-LEVEL
-	is used.  Reordered the syntax checks to get more efficient
+	is used.  Reorder the syntax checks to get more efficient
 	skipping in some situations.
 
 	* progmodes/cc-cmds.el (c-electric-brace): Don't trip up on a line
@@ -3379,7 +4345,7 @@
 
 	* progmodes/cc-fonts.el (c-font-lock-declarators): Handle array
 	size specs correctly.  Only fontify identifiers in front of '('
-	with as functions - don't accept any paren char.  Tightened up
+	with as functions - don't accept any paren char.  Tighten up
 	initializer skipping to stop before function and class blocks.
 
 	* progmodes/cc-engine.el (c-beginning-of-decl-1): Fix bug where
@@ -3713,7 +4679,7 @@
 	functions that are not erroneous if either 1-valued or
 	multi-valued.  Detect functions in this class.
 	(testcover-1value-functions, testcover-compose-functions)
-	(testcover-progn-functions) Added some additional functions to lists.
+	(testcover-progn-functions) Add some additional functions to lists.
 	(testcover-mark): Bugfix when marking up the definition for an
 	empty function.
 
@@ -4379,7 +5345,7 @@
 	* toolbar/lc-saveas.xpm, toolbar/lc-search.xpm
 	* toolbar/lc-spell.xpm, toolbar/lc-undo.xpm
 	* toolbar/lc-up_arrow.xpm:
-	Renamed from *-locol.xpm.
+	Rename from *-locol.xpm.
 
 2004-06-09  Rajesh Vaidheeswarran  <rv@gnu.org>
 
@@ -6878,115 +7844,7 @@
 	(compilation-forget-errors): Don't localize already local
 	compilation-locs and remove FIXME about refontifying.
 
-2004-04-14  Kim F. Storm  <storm@cua.dk>
-
-	* startup.el (emacs-quick-startup): New defvar (set by -Q).
-	(command-line): New option -Q.  Like -q --no-site-file, but
-	in addition it also disables menu-bar, tool-bar, scroll-bars,
-	tool-tips, and the blinking cursor.
-	(command-line-1): Skip startup screen if -Q.
-	(fancy-splash-head): Use ":align-to center" prop to center splash image.
-
-	* emulation/cua-base.el (cua-read-only-cursor-color)
-	(cua-overwrite-cursor-color, cua-global-mark-cursor-color): Doc fix.
-
-2004-04-13  Dave Love  <fx@gnu.org>
-
-	* progmodes/python.el: Doc fixes.  Changes for compiler warnings.
-	(syntax): Don't require.
-	(python) <defgroup>: Add :version.
-	(python-quote-syntax): Re-written.
-	(inferior-python-mode): Move stuff here from run-python and add
-	some more.
-	(python-preoutput-continuation, python-preoutput-result)
-	(python-dotty-syntax-table): New.
-	(python-describe-symbol): Use them.
-	(run-python): Move stuff to inferior-python-mode.  Modify code
-	loaded into Python.
-	(python-send-region): Use python-proc, python-send-string.
-	(python-send-string): Send newlines too.  Callers changed.
-	(python-load-file): Re-written.
-	(python-eldoc-function): New.
-	(info-look): Don't require.
-	(python-after-info-look): New.  A modified version of former
-	top-level code for use with eval-after-load.
-	(python-maybe-jython, python-guess-indent): Use widened buffer.
-	(python-fill-paragraph): Re-written.
-	(python-mode): Fix outline-regexp.  Set outline-heading-end-regexp,
-	eldoc-print-current-symbol-info-function.  Add to eldoc-mode-hook.
-
-2004-04-13  Stefan Monnier  <monnier@iro.umontreal.ca>
-
-	* progmodes/python.el (run-python): Use compilation-shell-minor-mode.
-	Set compilation-error-regexp-alist earlier.
-
-	* progmodes/compile.el (compilation-minor-mode-map)
-	(compilation-shell-minor-mode-map, compile-mouse-goto-error)
-	(compile-goto-error): Re-merge the mouse and non-mouse commands.
-
-2004-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
-
-	* progmodes/compile.el (compile-goto-error): Select the buffer/window
-	corresponding to the event.
-
-2004-04-12  Joe Buehler  <jbuehler@hekiman.com>
-
-	* loadup.el: Add cygwin to system-type list, for unexec() support.
-
-2004-04-12  John Paul Wallington  <jpw@gnu.org>
-
-	* ibuffer.el (ibuffer-delete-window-on-quit): Remove.
-	(ibuffer-restore-window-config-on-quit): New variable to replace
-	`ibuffer-delete-window-on-quit'.  Update all references.
-	(ibuffer-prev-window-config): New variable.
-	(ibuffer-quit): Restore previous window configuration instead of
-	deleting window.
-	(ibuffer): Save window configuration before showing Ibuffer buffer.
-
-	* help.el (describe-mode): Doc fix.
-
-2004-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
-
-	* progmodes/compile.el (compilation-mode-font-lock-keywords): Fix test
-	not to treat nil as a function.
-
-	* vc-arch.el (vc-arch-root): Be a bit more careful.
-	(vc-arch-register): Save the buffer if we modified it.
-	(vc-arch-delete-rej-if-obsolete): Save excursion.
-	(vc-arch-find-file-hook): Use the simpler after-save-hook.
-	(vc-arch-responsible-p, vc-arch-init-version): New functions.
-
-	* net/ldap.el (ldap-search): Use list*.
-
-2004-04-12  Juri Linkov  <juri@jurta.org>
-
-	* info.el (Info-follow-reference): Allow multiline reference name.
-
-2004-04-11  Dave Love  <fx@gnu.org>
-
-	* emacs-lisp/bytecomp.el (byte-compile-cond): Fix last change.
-
-	* progmodes/python.el: New file.
-
-2004-04-11  Andre Spiegel  <spiegel@gnu.org>
-
-	* vc-hooks.el (vc-arg-list): Function removed.
-	(vc-default-workfile-unchanged-p): Use condition-case to check for
-	backward compatibility.
-
-	* vc.el (vc-print-log): Use condition-case to check for backward
-	compatibility.
-
-2004-04-11  Juri Linkov  <juri@jurta.org>
-
-	* dired.el (dired-faces): New defgroup.
-	(dired-header, dired-mark, dired-marked, dired-flagged)
-	(dired-warning, dired-directory, dired-symlink, dired-ignored):
-	New faces.
-	(dired-header-face, dired-mark-face, dired-marked-face)
-	(dired-flagged-face, dired-warning-face, dired-directory-face)
-	(dired-symlink-face, dired-ignored-face): New face variables.
-	(dired-font-lock-keywords): Use them instead of font-lock faces.
+2004-04-14
 	Split the rule for dired marks into 3 separate rules: for marks,
 	marked file names and flagged file names.
 
--- a/lisp/add-log.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/add-log.el	Wed Dec 08 22:20:27 2004 +0000
@@ -779,9 +779,28 @@
 		   (forward-line 1))
 		 (or (eobp)
 		     (forward-char 1))
-		 (beginning-of-defun)
-		 (when (progn (end-of-defun)
-			      (< location (point)))
+		 (let (maybe-beg)
+		   ;; Try to find the containing defun.
+		   (beginning-of-defun)
+		   (end-of-defun)
+		   ;; If the defun we found ends before the desired position,
+		   ;; see if there's a DEFUN construct
+		   ;; between that end and the desired position.
+		   (when (save-excursion
+			   (and (> location (point))
+				(re-search-forward "^DEFUN" 
+						   (save-excursion
+						     (goto-char location)
+						     (line-end-position))
+						   t)
+				(re-search-forward "^{" nil t)
+				(setq maybe-beg (point))))
+		     ;; If so, go to the end of that instead.
+		     (goto-char maybe-beg)
+		     (end-of-defun)))
+		 ;; If the desired position is within the defun we found,
+		 ;; find the function name.
+		 (when (< location (point))
 		   (backward-sexp 1)
 		   (let (beg tem)
 
--- a/lisp/buff-menu.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/buff-menu.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,4 +1,4 @@
-;;; buff-menu.el --- buffer menu main function and support functions
+;;; buff-menu.el --- buffer menu main function and support functions -*- coding:utf-8 -*-
 
 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2000, 2001, 2002, 2003,
 ;;   2004  Free Software Foundation, Inc.
@@ -190,6 +190,8 @@
   (setq buffer-read-only t)
   (run-hooks 'buffer-menu-mode-hook))
 
+;; This function exists so we can make the doc string of Buffer-menu-mode
+;; look nice.
 (defun Buffer-menu-revert ()
   "Update the list of buffers."
   (interactive)
@@ -645,7 +647,7 @@
   (let* ((old-buffer (current-buffer))
 	 (standard-output standard-output)
 	 (mode-end (make-string (- Buffer-menu-mode-width 2) ? ))
-	 (header (concat (propertize "CRM " 'face 'fixed-pitch)
+	 (header (concat "CRM "
 			 (Buffer-menu-buffer+size
 			  (Buffer-menu-make-sort-button "Buffer" 2)
 			  (Buffer-menu-make-sort-button "Size" 3))
@@ -660,17 +662,28 @@
 	(while (string-match "[ \t]+" header pos)
 	  (setq pos (match-end 0))
 	  (put-text-property (match-beginning 0) pos 'display
-			     ;; Assume fixed-size chars
+			     ;; Assume fixed-size chars in the buffer.
 			     (list 'space :align-to pos)
-			     header))))
+			     header)))
+      ;; Try to better align the one-char headers.
+      (put-text-property 0 3 'face 'fixed-pitch header)
+      ;; Add a "dummy" leading space to align the beginning of the header
+      ;; line with the beginning of the text (rather than with the left
+      ;; scrollbar or the left fringe).  –-Stef
+      (setq header (concat (propertize " " 'display '(space :align-to 0))
+			   header))
+      )
     (with-current-buffer (get-buffer-create "*Buffer List*")
       (setq buffer-read-only nil)
       (erase-buffer)
       (setq standard-output (current-buffer))
       (unless Buffer-menu-use-header-line
-	(insert header (propertize "---" 'face 'fixed-pitch) " ")
-	(insert (Buffer-menu-buffer+size "------" "----"))
-	(insert "  ----" mode-end "----\n"))
+	(let ((underline (if (char-displayable-p ?—) ?— ?-)))
+	  (insert header
+		  (apply 'string
+			 (mapcar (lambda (c)
+				   (if (memq c '(?\n ?\ )) c underline))
+				 header)))))
       (if buffer-list
 	  (setq list buffer-list)
 	;; Collect info for every buffer we're interested in.
--- a/lisp/calc/README	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/README	Wed Dec 08 22:20:27 2004 +0000
@@ -12,7 +12,7 @@
 	daveg@synaptics.com, uunet!synaptx!daveg
 
 Currently maintained by:
-     D. Goel <deego@gnufans.org> and Colin Walters <walters@debian.org>
+     Jay Belanger <belanger@truman.edu>
 
 From the introduction to the manual:
 
--- a/lisp/calc/calc-aent.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-aent.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,9 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc.el.
+
 (require 'calc)
-
 (require 'calc-macs)
-(eval-when-compile '(require calc-macs))
-
-(defun calc-Need-calc-aent () nil)
-
 
 (defun calc-do-quick-calc ()
   (calc-check-defines)
@@ -52,20 +47,20 @@
 	       (entry (calc-do-alg-entry "" "Quick calc: " t))
 	       (alg-exp (mapcar (function
 				 (lambda (x)
-				   (if (and (not calc-extensions-loaded)
+				   (if (and (not (featurep 'calc-ext))
 					    calc-previous-alg-entry
 					    (string-match
 					     "\\`[-0-9._+*/^() ]+\\'"
 					     calc-previous-alg-entry))
 				       (calc-normalize x)
-				     (calc-extensions)
+				     (require 'calc-ext)
 				     (math-evaluate-expr x))))
 				entry)))
 	  (when (and (= (length alg-exp) 1)
 		     (eq (car-safe (car alg-exp)) 'calcFunc-assign)
 		     (= (length (car alg-exp)) 3)
 		     (eq (car-safe (nth 1 (car alg-exp))) 'var))
-	    (calc-extensions)
+	    (require 'calc-ext)
 	    (set (nth 2 (nth 1 (car alg-exp))) (nth 2 (car alg-exp)))
 	    (calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))
 	    (setq alg-exp (list (nth 2 (car alg-exp)))))
@@ -92,7 +87,7 @@
 				  "")
 				")")))
 	  (if (and (< (length buf) (frame-width)) (= (length entry) 1)
-		   calc-extensions-loaded)
+		   (featurep 'calc-ext))
 	      (let ((long (concat (math-format-value (car entry) 1000)
 				  " =>  " buf)))
 		(if (<= (length long) (- (frame-width) 8))
@@ -148,7 +143,7 @@
        ((eq separator 'eval)
 	(eval str))
        ((eq separator 'macro)
-	(calc-extensions)
+	(require 'calc-ext)
 	(let* ((calc-buffer (current-buffer))
 	       (calc-window (get-buffer-window calc-buffer))
 	       (save-window (selected-window)))
@@ -209,7 +204,7 @@
 	    (and (memq 'clear-message calc-command-flags)
 		 (message ""))
 	    (cond ((eq separator 'pred)
-		   (calc-extensions)
+		   (require 'calc-ext)
 		   (if (= (length res) 1)
 		       (math-is-true (car res))
 		     (calc-eval-error '(0 "Single value expected"))))
@@ -241,9 +236,14 @@
 			     res (cdr res)))
 		     buf)))))))))
 
+(defvar calc-eval-error nil
+  "Determines how calc handles errors.
+NIL means return a list containing the character position of error.
+STRING means return error message as string rather than list.
+T means abort and give an error message.")
+
 (defun calc-eval-error (msg)
-  (if (and (boundp 'calc-eval-error)
-	   calc-eval-error)
+  (if calc-eval-error
       (if (eq calc-eval-error 'string)
 	  (nth 1 msg)
 	(error "%s" (nth 1 msg)))
@@ -272,19 +272,19 @@
 	 (alg-exp (calc-do-alg-entry initial prompt t)))
     (if (stringp alg-exp)
 	(progn
-	  (calc-extensions)
+	  (require 'calc-ext)
 	  (calc-alg-edit alg-exp))
       (let* ((calc-simplify-mode (if (eq last-command-char ?\C-j)
 				     'none
 				   calc-simplify-mode))
 	     (nvals (mapcar 'calc-normalize alg-exp)))
 	(while alg-exp
-	  (calc-record (if calc-extensions-loaded (car alg-exp) (car nvals))
+	  (calc-record (if (featurep 'calc-ext) (car alg-exp) (car nvals))
 		       "alg'")
 	  (calc-pop-push-record-list calc-dollar-used
 				     (and (not (equal (car alg-exp)
 						      (car nvals)))
-					  calc-extensions-loaded
+					  (featurep 'calc-ext)
 					  "")
 				     (list (car nvals)))
 	  (setq alg-exp (cdr alg-exp)
@@ -386,6 +386,8 @@
     (and (> (length calc-alg-exp) 0) (setq calc-previous-alg-entry calc-alg-exp))
     (exit-minibuffer)))
 
+(defvar calc-buffer)
+
 (defun calcAlg-enter ()
   (interactive)
   (let* ((str (minibuffer-contents))
@@ -443,6 +445,10 @@
 	 ((eq last-command-char ?@) "0@ ")
 	 (t (char-to-string last-command-char)))))
 
+;; The variable calc-digit-value is initially declared in calc.el,
+;; but can be set by calcDigit-algebraic and calcDigit-edit.
+(defvar calc-digit-value)
+
 (defun calcDigit-algebraic ()
   (interactive)
   (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'")
@@ -459,20 +465,22 @@
 
 ;;; Algebraic expression parsing.   [Public]
 
-;;; The next few variables are local to math-read-exprs (and math-read-expr)
-;;; but are set in functions they call.
+;; The next few variables are local to math-read-exprs (and math-read-expr
+;; in calc-ext.el), but are set in functions they call.
 
 (defvar math-exp-pos)
 (defvar math-exp-str)
 (defvar math-exp-old-pos)
 (defvar math-exp-token)
 (defvar math-exp-keep-spaces)
+(defvar math-expr-data)
 
 (defun math-read-exprs (math-exp-str)
   (let ((math-exp-pos 0)
 	(math-exp-old-pos 0)
 	(math-exp-keep-spaces nil)
 	math-exp-token math-expr-data)
+    (setq math-exp-str (math-read-preprocess-string math-exp-str))
     (if calc-language-input-filter
 	(setq math-exp-str (funcall calc-language-input-filter math-exp-str)))
     (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
@@ -727,6 +735,9 @@
 		   math-expr-data (char-to-string ch)
 		   math-exp-pos (1+ math-exp-pos)))))))
 
+(defconst math-alg-inequalities
+  '(calcFunc-lt calcFunc-gt calcFunc-leq calcFunc-geq
+		calcFunc-eq calcFunc-neq))
 
 (defun math-read-expr-level (exp-prec &optional exp-term)
   (let* ((x (math-read-factor)) (first t) op op2)
@@ -771,7 +782,7 @@
       (if (not (equal (car op) "2x"))
 	  (math-read-token))
       (and (memq (nth 1 op) '(sdev mod))
-	   (calc-extensions))
+	   (require 'calc-ext))
       (setq x (cond ((consp (nth 1 op))
 		     (funcall (car (nth 1 op)) x op))
 		    ((eq (nth 3 op) -1)
@@ -787,7 +798,7 @@
 		    ((and (not first)
 			  (memq (nth 1 op) math-alg-inequalities)
 			  (memq (car-safe x) math-alg-inequalities))
-		     (calc-extensions)
+		     (require 'calc-ext)
 		     (math-composite-inequalities x op))
 		    (t (list (nth 1 op)
 			     x
@@ -815,7 +826,7 @@
 		      (or (not (listp
 				(setq matches (calc-match-user-syntax rule))))
 			  (let ((args (progn
-					(calc-extensions)
+					(require 'calc-ext)
 					calc-arg-values))
 				(conds nil)
 				temp)
@@ -830,7 +841,7 @@
 						  conds)
 				    match (nth 1 match)))
 			    (while (and conds match)
-			      (calc-extensions)
+			      (require 'calc-ext)
 			      (cond ((eq (car-safe (car conds))
 					 'calcFunc-let)
 				     (setq temp (car conds))
@@ -941,10 +952,6 @@
 	      matches "Failed"))
     matches))
 
-(defconst math-alg-inequalities
-  '(calcFunc-lt calcFunc-gt calcFunc-leq calcFunc-geq
-		calcFunc-eq calcFunc-neq))
-
 (defun math-remove-dashes (x)
   (if (string-match "\\`\\(.*\\)-\\(.*\\)\\'" x)
       (math-remove-dashes
@@ -1026,7 +1033,7 @@
 			   (throw 'syntax "Expected `)'"))
 		       (math-read-token)
 		       (if (and (eq calc-language 'fortran) args
-				(calc-extensions)
+				(require 'calc-ext)
 				(let ((calc-matrix-mode 'scalar))
 				  (math-known-matrixp
 				   (list 'var sym
@@ -1085,7 +1092,7 @@
 	  ((eq math-exp-token 'hash)
 	   (or calc-hashes-used
 	       (throw 'syntax "#'s not allowed in this context"))
-	   (calc-extensions)
+	   (require 'calc-ext)
 	   (if (<= math-expr-data (length calc-arg-values))
 	       (let ((num math-expr-data))
 		 (math-read-token)
@@ -1116,7 +1123,7 @@
 		     (setq exp (if (and exp2 (Math-realp exp)
 					(Math-anglep exp2))
 				   (math-normalize (list 'polar exp exp2))
-				 (calc-extensions)
+				 (require 'calc-ext)
 				 (list '* exp
 				       (list 'calcFunc-exp
 					     (list '*
@@ -1143,18 +1150,20 @@
 	     (math-read-token)
 	     exp))
 	  ((eq math-exp-token 'string)
-	   (calc-extensions)
+	   (require 'calc-ext)
 	   (math-read-string))
 	  ((equal math-expr-data "[")
-	   (calc-extensions)
+	   (require 'calc-ext)
 	   (math-read-brackets t "]"))
 	  ((equal math-expr-data "{")
-	   (calc-extensions)
+	   (require 'calc-ext)
 	   (math-read-brackets nil "}"))
 	  ((equal math-expr-data "<")
-	   (calc-extensions)
+	   (require 'calc-ext)
 	   (math-read-angle-brackets))
 	  (t (throw 'syntax "Expected a number")))))
 
+(provide 'calc-aent)
+
 ;;; arch-tag: 5599e45d-e51e-44bb-9a20-9f4ed8c96c32
 ;;; calc-aent.el ends here
--- a/lisp/calc/calc-alg.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-alg.el	Wed Dec 08 22:20:27 2004 +0000
@@ -27,12 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-alg () nil)
-
 ;;; Algebra commands.
 
 (defun calc-alg-evaluate (arg)
@@ -333,9 +331,19 @@
       aa)))
 
 
-;; Placeholder, to synchronize autoloading.
-(defun math-need-std-simps ()
-  nil)
+(defmacro math-defsimplify (funcs &rest code)
+  (append '(progn)
+          (mapcar (function
+                   (lambda (func)
+                     (list 'put (list 'quote func) ''math-simplify
+                           (list 'nconc
+                                 (list 'get (list 'quote func) ''math-simplify)
+                                 (list 'list
+                                       (list 'function
+                                             (append '(lambda (math-simplify-expr))
+                                                     code)))))))
+                  (if (symbolp funcs) (list funcs) funcs))))
+(put 'math-defsimplify 'lisp-indent-hook 1)
 
 ;; The function created by math-defsimplify uses the variable
 ;; math-simplify-expr, and so is used by functions in math-defsimplify
@@ -1587,14 +1595,18 @@
 (defvar math-poly-base-const-ok)
 (defvar math-poly-base-pred)
 
-(defun math-polynomial-base (mpb-top-expr &optional math-poly-base-pred)
+;; The variable math-poly-base-top-expr is local to math-polynomial-base,
+;; but is used by math-polynomial-p1 in calc-poly.el, which is called
+;; by math-polynomial-base.
+
+(defun math-polynomial-base (math-poly-base-top-expr &optional math-poly-base-pred)
   (or math-poly-base-pred
       (setq math-poly-base-pred (function (lambda (base) (math-polynomial-p
-					       mpb-top-expr base)))))
+					       math-poly-base-top-expr base)))))
   (or (let ((math-poly-base-const-ok nil))
-	(math-polynomial-base-rec mpb-top-expr))
+	(math-polynomial-base-rec math-poly-base-top-expr))
       (let ((math-poly-base-const-ok t))
-	(math-polynomial-base-rec mpb-top-expr))))
+	(math-polynomial-base-rec math-poly-base-top-expr))))
 
 (defun math-polynomial-base-rec (mpb-expr)
   (and (not (Math-objvecp mpb-expr))
@@ -1688,5 +1700,7 @@
 				    (math-scale-int 1 (- (nth 2 f)))))))
       f))
 
+(provide 'calc-alg)
+
 ;;; arch-tag: 52e7dcdf-9688-464d-a02b-4bbe789348d0
 ;;; calc-alg.el ends here
--- a/lisp/calc/calc-arith.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-arith.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,11 +27,73 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-arith () nil)
+;;; The following lists are not exhaustive.
+(defvar math-scalar-functions '(calcFunc-det
+				calcFunc-cnorm calcFunc-rnorm
+				calcFunc-vlen calcFunc-vcount
+				calcFunc-vsum calcFunc-vprod
+				calcFunc-vmin calcFunc-vmax))
+
+(defvar math-nonscalar-functions '(vec calcFunc-idn calcFunc-diag
+				       calcFunc-cvec calcFunc-index
+				       calcFunc-trn
+				       | calcFunc-append
+				       calcFunc-cons calcFunc-rcons
+				       calcFunc-tail calcFunc-rhead))
+
+(defvar math-scalar-if-args-functions '(+ - * / neg))
+
+(defvar math-real-functions '(calcFunc-arg
+			      calcFunc-re calcFunc-im
+			      calcFunc-floor calcFunc-ceil
+			      calcFunc-trunc calcFunc-round
+			      calcFunc-rounde calcFunc-roundu
+			      calcFunc-ffloor calcFunc-fceil
+			      calcFunc-ftrunc calcFunc-fround
+			      calcFunc-frounde calcFunc-froundu))
+
+(defvar math-positive-functions '())
+
+(defvar math-nonnegative-functions '(calcFunc-cnorm calcFunc-rnorm
+				     calcFunc-vlen calcFunc-vcount))
+
+(defvar math-real-scalar-functions '(% calcFunc-idiv calcFunc-abs
+				       calcFunc-choose calcFunc-perm
+				       calcFunc-eq calcFunc-neq
+				       calcFunc-lt calcFunc-gt
+				       calcFunc-leq calcFunc-geq
+				       calcFunc-lnot
+				       calcFunc-max calcFunc-min))
+
+(defvar math-real-if-arg-functions '(calcFunc-sin calcFunc-cos
+				     calcFunc-tan calcFunc-arctan
+				     calcFunc-sinh calcFunc-cosh
+				     calcFunc-tanh calcFunc-exp
+				     calcFunc-gamma calcFunc-fact))
+
+(defvar math-integer-functions '(calcFunc-idiv
+				 calcFunc-isqrt calcFunc-ilog
+				 calcFunc-vlen calcFunc-vcount))
+
+(defvar math-num-integer-functions '())
+
+(defvar math-rounding-functions '(calcFunc-floor
+				  calcFunc-ceil
+				  calcFunc-round calcFunc-trunc
+				  calcFunc-rounde calcFunc-roundu))
+
+(defvar math-float-rounding-functions '(calcFunc-ffloor
+					calcFunc-fceil
+					calcFunc-fround calcFunc-ftrunc
+					calcFunc-frounde calcFunc-froundu))
+
+(defvar math-integer-if-args-functions '(+ - * % neg calcFunc-abs
+					   calcFunc-min calcFunc-max
+					   calcFunc-choose calcFunc-perm))
 
 
 ;;; Arithmetic.
@@ -164,6 +225,19 @@
 ;;;       TYPES is a list of type symbols (any, int, frac, ...)
 ;;;	  RANGE is a sorted vector of intervals describing the range.
 
+(defvar math-super-types
+  '((int numint rat real number)
+    (numint real number)
+    (frac rat real number)
+    (rat real number)
+    (float real number)
+    (real number)
+    (number)
+    (scalar)
+    (matrix vector)
+    (vector)
+    (const)))
+
 (defun math-setup-declarations ()
   (or (eq math-decls-cache-tag (calc-var-value 'var-Decls))
       (let ((p (calc-var-value 'var-Decls))
@@ -214,19 +288,6 @@
 		      (error nil)))))
 	(setq math-decls-all (assq 'var-All math-decls-cache)))))
 
-(defvar math-super-types
-  '((int numint rat real number)
-    (numint real number)
-    (frac rat real number)
-    (rat real number)
-    (float real number)
-    (real number)
-    (number)
-    (scalar)
-    (matrix vector)
-    (vector)
-    (const)))
-
 (defun math-known-scalarp (a &optional assume-scalar)
   (math-setup-declarations)
   (if (if calc-matrix-mode
@@ -326,9 +387,12 @@
 	       ((Math-negp a) 1)
 	       ((Math-zerop a) 2)
 	       ((eq (car a) 'intv)
-		(cond ((Math-zerop (nth 2 a)) 6)
-		      ((Math-zerop (nth 3 a)) 3)
-		      (t 7)))
+		(cond 
+                 ((math-known-posp (nth 2 a)) 4)
+                 ((math-known-negp (nth 3 a)) 1)
+                 ((Math-zerop (nth 2 a)) 6)
+                 ((Math-zerop (nth 3 a)) 3)
+                 (t 7)))
 	       ((eq (car a) 'sdev)
 		(if (math-known-realp (nth 1 a)) 7 15))
 	       (t 8)))
@@ -819,71 +883,6 @@
       (math-reject-arg a 'objectp 'quiet))))
 
 
-;;; The following lists are not exhaustive.
-(defvar math-scalar-functions '(calcFunc-det
-				calcFunc-cnorm calcFunc-rnorm
-				calcFunc-vlen calcFunc-vcount
-				calcFunc-vsum calcFunc-vprod
-				calcFunc-vmin calcFunc-vmax))
-
-(defvar math-nonscalar-functions '(vec calcFunc-idn calcFunc-diag
-				       calcFunc-cvec calcFunc-index
-				       calcFunc-trn
-				       | calcFunc-append
-				       calcFunc-cons calcFunc-rcons
-				       calcFunc-tail calcFunc-rhead))
-
-(defvar math-scalar-if-args-functions '(+ - * / neg))
-
-(defvar math-real-functions '(calcFunc-arg
-			      calcFunc-re calcFunc-im
-			      calcFunc-floor calcFunc-ceil
-			      calcFunc-trunc calcFunc-round
-			      calcFunc-rounde calcFunc-roundu
-			      calcFunc-ffloor calcFunc-fceil
-			      calcFunc-ftrunc calcFunc-fround
-			      calcFunc-frounde calcFunc-froundu))
-
-(defvar math-positive-functions '())
-
-(defvar math-nonnegative-functions '(calcFunc-cnorm calcFunc-rnorm
-				     calcFunc-vlen calcFunc-vcount))
-
-(defvar math-real-scalar-functions '(% calcFunc-idiv calcFunc-abs
-				       calcFunc-choose calcFunc-perm
-				       calcFunc-eq calcFunc-neq
-				       calcFunc-lt calcFunc-gt
-				       calcFunc-leq calcFunc-geq
-				       calcFunc-lnot
-				       calcFunc-max calcFunc-min))
-
-(defvar math-real-if-arg-functions '(calcFunc-sin calcFunc-cos
-				     calcFunc-tan calcFunc-arctan
-				     calcFunc-sinh calcFunc-cosh
-				     calcFunc-tanh calcFunc-exp
-				     calcFunc-gamma calcFunc-fact))
-
-(defvar math-integer-functions '(calcFunc-idiv
-				 calcFunc-isqrt calcFunc-ilog
-				 calcFunc-vlen calcFunc-vcount))
-
-(defvar math-num-integer-functions '())
-
-(defvar math-rounding-functions '(calcFunc-floor
-				  calcFunc-ceil
-				  calcFunc-round calcFunc-trunc
-				  calcFunc-rounde calcFunc-roundu))
-
-(defvar math-float-rounding-functions '(calcFunc-ffloor
-					calcFunc-fceil
-					calcFunc-fround calcFunc-ftrunc
-					calcFunc-frounde calcFunc-froundu))
-
-(defvar math-integer-if-args-functions '(+ - * % neg calcFunc-abs
-					   calcFunc-min calcFunc-max
-					   calcFunc-choose calcFunc-perm))
-
-
 ;;;; Arithmetic.
 
 (defsubst calcFunc-neg (a)
@@ -1742,23 +1741,35 @@
   (math-normalize (list '^ a b)))
 
 (defun math-pow-of-zero (a b)
-  (if (Math-zerop b)
-      (if calc-infinite-mode
-	  '(var nan var-nan)
-	(math-reject-arg (list '^ a b) "*Indeterminate form"))
-    (if (math-floatp b) (setq a (math-float a)))
-    (if (math-posp b)
-	a
-      (if (math-negp b)
-	  (math-div 1 a)
-	(if (math-infinitep b)
-	    '(var nan var-nan)
-	  (if (and (eq (car b) 'intv) (math-intv-constp b)
-		   calc-infinite-mode)
-	      '(intv 3 (neg (var inf var-inf)) (var inf var-inf))
-	    (if (math-objectp b)
-		(list '^ a b)
-	      a)))))))
+  "Raise A to the power of B, where A is a form of zero."
+  (if (math-floatp b) (setq a (math-float a)))
+  (cond
+   ;; 0^0 = 1
+   ((eq b 0)
+    1)
+   ;; 0^0.0, etc., are undetermined
+   ((Math-zerop b)
+    (if calc-infinite-mode
+        '(var nan var-nan)
+      (math-reject-arg (list '^ a b) "*Indeterminate form")))
+   ;; 0^positive = 0
+   ((math-known-posp b)
+    a)
+   ;; 0^negative is undefined (let math-div handle it)
+   ((math-known-negp b)
+    (math-div 1 a))
+   ;; 0^infinity is undefined
+   ((math-infinitep b)
+    '(var nan var-nan))
+   ;; Some intervals
+   ((and (eq (car b) 'intv)
+         calc-infinite-mode
+         (math-negp (nth 2 b))
+         (math-posp (nth 3 b)))
+    '(intv 3 (neg (var inf var-inf)) (var inf var-inf)))
+   ;; If none of the above, leave it alone.
+   (t
+    (list '^ a b))))
 
 (defun math-pow-zero (a b)
   (if (eq (car-safe a) 'mod)
@@ -2185,6 +2196,10 @@
 
 (defalias 'calcFunc-float 'math-float)
 
+;; The variable math-trunc-prec is local to math-trunc in calc-misc.el, 
+;; but used by math-trunc-fancy which is called by math-trunc.
+(defvar math-trunc-prec)
+
 (defun math-trunc-fancy (a)
   (cond ((eq (car a) 'frac) (math-quotient (nth 1 a) (nth 2 a)))
 	((eq (car a) 'cplx) (math-trunc (nth 1 a)))
@@ -2214,7 +2229,7 @@
 			   (math-trunc (nth 3 a)))))
 	((math-provably-integerp a) a)
 	((Math-vectorp a)
-	 (math-map-vec (function (lambda (x) (math-trunc x prec))) a))
+	 (math-map-vec (function (lambda (x) (math-trunc x math-trunc-prec))) a))
 	((math-infinitep a)
 	 (if (or (math-posp a) (math-negp a))
 	     a
@@ -2251,6 +2266,10 @@
       a
     (math-float (math-trunc a prec))))
 
+;; The variable math-floor-prec is local to math-floor in calc-misc.el,
+;; but used by math-floor-fancy which is called by math-floor.
+(defvar math-floor-prec)
+
 (defun math-floor-fancy (a)
   (cond ((math-provably-integerp a) a)
 	((eq (car a) 'hms)
@@ -2273,7 +2292,7 @@
 			     (math-add (math-floor (nth 3 a)) -1)
 			   (math-floor (nth 3 a)))))
 	((Math-vectorp a)
-	 (math-map-vec (function (lambda (x) (math-floor x prec))) a))
+	 (math-map-vec (function (lambda (x) (math-floor x math-floor-prec))) a))
 	((math-infinitep a)
 	 (if (or (math-posp a) (math-negp a))
 	     a
@@ -2629,6 +2648,11 @@
 (defvar math-combine-prod-e '(var e var-e))
 
 ;;; The following is expanded out four ways for speed.
+
+;; math-unit-prefixes is defined in calc-units.el,
+;; but used here.
+(defvar math-unit-prefixes)
+
 (defun math-combine-prod (a b inva invb scalar-okay)
   (cond
    ((or (and inva (Math-zerop a))
@@ -2761,23 +2785,28 @@
 	  (math-div a b)
 	(math-mul a b)))))
 
+;; The variable math-com-bterms is local to math-commutative-equal,
+;; but is used by math-commutative collect, which is called by
+;; math-commutative-equal.
+(defvar math-com-bterms)
+
 (defun math-commutative-equal (a b)
   (if (memq (car-safe a) '(+ -))
       (and (memq (car-safe b) '(+ -))
-	   (let ((bterms nil) aterms p)
+	   (let ((math-com-bterms nil) aterms p)
 	     (math-commutative-collect b nil)
-	     (setq aterms bterms bterms nil)
+	     (setq aterms math-com-bterms math-com-bterms nil)
 	     (math-commutative-collect a nil)
-	     (and (= (length aterms) (length bterms))
+	     (and (= (length aterms) (length math-com-bterms))
 		  (progn
 		    (while (and aterms
 				(progn
-				  (setq p bterms)
+				  (setq p math-com-bterms)
 				  (while (and p (not (equal (car aterms)
 							    (car p))))
 				    (setq p (cdr p)))
 				  p))
-		      (setq bterms (delq (car p) bterms)
+		      (setq math-com-bterms (delq (car p) math-com-bterms)
 			    aterms (cdr aterms)))
 		    (not aterms)))))
     (equal a b)))
@@ -2791,7 +2820,9 @@
 	(progn
 	  (math-commutative-collect (nth 1 b) neg)
 	  (math-commutative-collect (nth 2 b) (not neg)))
-      (setq bterms (cons (if neg (math-neg b) b) bterms)))))
+      (setq math-com-bterms (cons (if neg (math-neg b) b) math-com-bterms)))))
+
+(provide 'calc-arith)
 
 ;;; arch-tag: 6c396b5b-14c6-40ed-bb2a-7cc2e8111465
 ;;; calc-arith.el ends here
--- a/lisp/calc/calc-bin.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-bin.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-bin () nil)
-
-
 ;;; b-prefix binary commands.
 
 (defun calc-and (n)
@@ -656,7 +652,8 @@
   (let ((fmt (car calc-float-format))
 	(figs (nth 1 calc-float-format))
 	(point calc-point-char)
-	(str nil))
+	(str nil)
+        pos)
     (if (eq fmt 'fix)
 	(let* ((afigs (math-abs figs))
 	       (fp (math-float-parts a (> afigs 0)))
@@ -751,8 +748,8 @@
 	  (if explo
 	      (let ((estr (let ((calc-number-radix 10)
 				(calc-group-digits nil))
-			    (setq estr (math-format-number
-					(math-sub explo eadj))))))
+                            (math-format-number
+                             (math-sub explo eadj)))))
 		(setq str (if (or (memq calc-language '(math maple))
 				  (> calc-number-radix 14))
 			      (format "%s*%d.^%s" str calc-number-radix estr)
@@ -774,6 +771,7 @@
 				math-radix-digits-cache))))))))
 
 (defvar math-radix-float-cache-tag nil)
+(defvar math-radix-float-cache)
 
 (defun math-radix-float-power (n)
   (if (eq n 0)
@@ -803,6 +801,7 @@
 						       calc-number-radix))))))
 			       math-radix-float-cache))))))))
 
+(provide 'calc-bin)
 
 ;;; arch-tag: f6dba7bc-53b2-41ae-919c-c266ab0ca8b3
 ;;; calc-bin.el ends here
--- a/lisp/calc/calc-comb.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-comb.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,12 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-comb () nil)
-
 (defconst math-primes-table
   [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89
      97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181
@@ -1020,8 +1017,7 @@
 	(aref math-primes-table hi))
     2))
 
-
-
+(provide 'calc-comb)
 
 ;;; arch-tag: 1d75ee9b-0815-42bd-a321-bb3dc001cc02
 ;;; calc-comb.el ends here
--- a/lisp/calc/calc-cplx.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-cplx.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-cplx () nil)
-
-
 (defun calc-argument (arg)
   (interactive "P")
   (calc-slow-wrapper
@@ -358,5 +354,7 @@
 	  (t (calc-record-why 'numberp a)
 	     (list 'calcFunc-im a)))))
 
+(provide 'calc-cplx)
+
 ;;; arch-tag: de73a331-941c-4507-ae76-46c76adc70dd
 ;;; calc-cplx.el ends here
--- a/lisp/calc/calc-embed.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-embed.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,12 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-embed () nil)
-
 (defun calc-show-plain (n)
   (interactive "P")
   (calc-wrapper
@@ -152,6 +149,16 @@
 ;;; rather than using buffer-local variables because the latter are
 ;;; thrown away when a buffer changes major modes.
 
+;; The variables calc-embed-outer-top, calc-embed-outer-bot, 
+;; calc-embed-top and calc-embed-bot are
+;; local to calc-do-embedded, calc-embedded-mark-formula,
+;; calc-embedded-duplicate, calc-embedded-new-formula and
+;; calc-embedded-make-info, but are used by calc-embedded-find-bounds,
+;; which is called (directly or indirectly) by the above functions.
+(defvar calc-embed-outer-top)
+(defvar calc-embed-outer-bot)
+(defvar calc-embed-top)
+(defvar calc-embed-bot)
 
 (defvar calc-embedded-quiet nil)
 (defun calc-do-embedded (arg end obeg oend)
@@ -204,7 +211,7 @@
     (let ((modes (list mode-line-buffer-identification
 		       (current-local-map)
 		       truncate-lines))
-	  top bot outer-top outer-bot
+	  calc-embed-top calc-embed-bot calc-embed-outer-top calc-embed-outer-bot
 	  info chg ident)
       (barf-if-buffer-read-only)
       (or calc-embedded-globals
@@ -300,6 +307,8 @@
      (insert str "\n")))
   (calc-show-edit-buffer))
 
+(defvar calc-original-buffer)
+
 (defun calc-embedded-finish-edit (info)
   (let ((buf (current-buffer))
 	(str (buffer-substring (point) (point-max)))
@@ -320,7 +329,6 @@
       (aset info 8 val)
       (calc-embedded-update info 14 t t))))
 
-;;;###autoload
 (defun calc-do-embedded-activate (arg cbuf)
   (calc-plain-buffer-only)
   (if arg
@@ -388,11 +396,11 @@
   (interactive "P")
   (and (eq major-mode 'calc-mode)
        (error "This command should be used in a normal editing buffer"))
-  (let (top bot outer-top outer-bot)
+  (let (calc-embed-top calc-embed-bot calc-embed-outer-top calc-embed-outer-bot)
     (save-excursion
       (calc-embedded-find-bounds body-only))
-    (push-mark (if body-only bot outer-bot) t)
-    (goto-char (if body-only top outer-top))))
+    (push-mark (if body-only calc-embed-bot calc-embed-outer-bot) t)
+    (goto-char (if body-only calc-embed-top calc-embed-outer-top))))
 
 (defun calc-embedded-find-bounds (&optional plain)
   ;; (while (and (bolp) (eq (following-char) ?\n))
@@ -407,7 +415,7 @@
     (and (eq (preceding-char) ?\$)  ; backward search for \$\$? won't back
 	 (eq (following-char) ?\$)  ; up over a second $, so do it by hand.
 	 (forward-char -1))
-    (setq outer-top (point))
+    (setq calc-embed-outer-top (point))
     (goto-char (match-end 0))
     (if (eq (following-char) ?\n)
 	(forward-char 1))
@@ -419,21 +427,21 @@
 	    (progn
 	      (goto-char (match-end 0))
 	      (search-forward calc-embedded-close-plain))))
-    (setq top (point))
+    (setq calc-embed-top (point))
     (or (re-search-forward calc-embedded-close-formula nil t)
 	(error "Can't find end of formula"))
     (if (< (point) home)
 	(error "Not inside a formula"))
     (and (eq (following-char) ?\n) (not (bolp))
 	 (forward-char 1))
-    (setq outer-bot (point))
+    (setq calc-embed-outer-bot (point))
     (goto-char (match-beginning 0))
     (if (eq (preceding-char) ?\n)
 	(backward-char 1))
     (or (eolp)
 	(while (eq (preceding-char) ?\ )
 	  (backward-char 1)))
-    (setq bot (point))))
+    (setq calc-embed-bot (point))))
 
 (defun calc-embedded-kill-formula ()
   "Kill the formula surrounding point.
@@ -458,25 +466,26 @@
 (defun calc-embedded-duplicate ()
   (interactive)
   (let ((already calc-embedded-info)
-	top bot outer-top outer-bot new-top)
+	calc-embed-top calc-embed-bot calc-embed-outer-top calc-embed-outer-bot new-top)
     (if calc-embedded-info
 	(progn
-	  (setq top (+ (aref calc-embedded-info 2))
-		bot (+ (aref calc-embedded-info 3))
-		outer-top (+ (aref calc-embedded-info 4))
-		outer-bot (+ (aref calc-embedded-info 5)))
+	  (setq calc-embed-top (+ (aref calc-embedded-info 2))
+		calc-embed-bot (+ (aref calc-embedded-info 3))
+		calc-embed-outer-top (+ (aref calc-embedded-info 4))
+		calc-embed-outer-bot (+ (aref calc-embedded-info 5)))
 	  (calc-embedded nil))
       (calc-embedded-find-bounds))
-    (goto-char outer-bot)
+    (goto-char calc-embed-outer-bot)
     (insert "\n")
     (setq new-top (point))
-    (insert-buffer-substring (current-buffer) outer-top outer-bot)
-    (goto-char (+ new-top (- top outer-top)))
+    (insert-buffer-substring (current-buffer) 
+                             calc-embed-outer-top calc-embed-outer-bot)
+    (goto-char (+ new-top (- calc-embed-top calc-embed-outer-top)))
     (let ((calc-embedded-quiet (if already t 'x)))
-      (calc-embedded (+ new-top (- top outer-top))
-		     (+ new-top (- bot outer-top))
+      (calc-embedded (+ new-top (- calc-embed-top calc-embed-outer-top))
+		     (+ new-top (- calc-embed-bot calc-embed-outer-top))
 		     new-top
-		     (+ new-top (- outer-bot outer-top))))))
+		     (+ new-top (- calc-embed-outer-bot calc-embed-outer-top))))))
 
 (defun calc-embedded-next (arg)
   (interactive "P")
@@ -515,26 +524,26 @@
        (error "This command should be used in a normal editing buffer"))
   (if calc-embedded-info
       (calc-embedded nil))
-  (let (top bot outer-top outer-bot)
+  (let (calc-embed-top calc-embed-bot calc-embed-outer-top calc-embed-outer-bot)
     (if (and (eq (preceding-char) ?\n)
 	     (string-match "\\`\n" calc-embedded-open-new-formula))
 	(progn
-	  (setq outer-top (1- (point)))
+	  (setq calc-embed-outer-top (1- (point)))
 	  (forward-char -1)
 	  (insert (substring calc-embedded-open-new-formula 1)))
-      (setq outer-top (point))
+      (setq calc-embed-outer-top (point))
       (insert calc-embedded-open-new-formula))
-    (setq top (point))
+    (setq calc-embed-top (point))
     (insert " ")
-    (setq bot (point))
+    (setq calc-embed-bot (point))
     (insert calc-embedded-close-new-formula)
     (if (and (eq (following-char) ?\n)
 	     (string-match "\n\\'" calc-embedded-close-new-formula))
 	(delete-char 1))
-    (setq outer-bot (point))
-    (goto-char top)
+    (setq calc-embed-outer-bot (point))
+    (goto-char calc-embed-top)
     (let ((calc-embedded-quiet 'x))
-      (calc-embedded top bot outer-top outer-bot))))
+      (calc-embedded calc-embed-top calc-embed-bot calc-embed-outer-top calc-embed-outer-bot))))
 
 (defun calc-embedded-forget ()
   (interactive)
@@ -542,6 +551,9 @@
 				   calc-embedded-active))
   (calc-embedded-active-state nil))
 
+;; The variables calc-embed-prev-modes is local to calc-embedded-update,
+;; but is used by calc-embedded-set-modes.
+(defvar calc-embed-prev-modes)
 
 (defun calc-embedded-set-modes (gmodes modes local-modes &optional temp)
   (let ((the-language (calc-embedded-language))
@@ -561,9 +573,10 @@
 	    (equal (symbol-value (car (car v))) value))
 	  (progn
 	    (setq changed t)
-	    (if temp (setq prev-modes (cons (cons (car (car v))
-						  (symbol-value (car (car v))))
-					    prev-modes)))
+	    (if temp (setq calc-embed-prev-modes 
+                           (cons (cons (car (car v))
+                                       (symbol-value (car (car v))))
+                                 calc-embed-prev-modes)))
 	    (set (car (car v)) value)))
       (setq v (cdr v)))
     (setq v modes)
@@ -574,9 +587,9 @@
 	  (equal (symbol-value (car (car v))) value)
 	  (progn
 	    (setq changed t)
-	    (if temp (setq prev-modes (cons (cons (car (car v))
+	    (if temp (setq calc-embed-prev-modes (cons (cons (car (car v))
 						  (symbol-value (car (car v))))
-					    prev-modes)))
+					    calc-embed-prev-modes)))
 	    (set (car (car v)) value)))
       (setq v (cdr v)))
     (setq v local-modes)
@@ -585,9 +598,9 @@
 	  (equal (symbol-value (car (car v))) value)
 	  (progn
 	    (setq changed t)
-	    (if temp (setq prev-modes (cons (cons (car (car v))
+	    (if temp (setq calc-embed-prev-modes (cons (cons (car (car v))
 						  (symbol-value (car (car v))))
-					    prev-modes)))
+					    calc-embed-prev-modes)))
 	    (set (car (car v)) value)))
       (setq v (cdr v)))
     (and changed (not (eq temp t))
@@ -704,13 +717,18 @@
     (goto-char save-pt)
     (list modes emodes pmodes)))
 
+;; The variable calc-embed-vars-used is local to calc-embedded-make-info,
+;; calc-embedded-evaluate-expr and calc-embedded-update, but is 
+;; used by calc-embedded-find-vars, which is called by the above functions.
+(defvar calc-embed-vars-used)
 
 (defun calc-embedded-make-info (point cbuf fresh &optional
-				      top bot outer-top outer-bot)
+				      calc-embed-top calc-embed-bot 
+                                      calc-embed-outer-top calc-embed-outer-bot)
   (let* ((bufentry (assq (current-buffer) calc-embedded-active))
 	 (found bufentry)
-	 (force (and fresh top))
-	 (fixed top)
+	 (force (and fresh calc-embed-top))
+	 (fixed calc-embed-top)
 	 (new-info nil)
 	 info str)
     (or found
@@ -729,7 +747,8 @@
       (aset info 1 (or cbuf (save-excursion
 			      (calc-create-buffer)
 			      (current-buffer)))))
-    (if (and (integerp top) (not bot))  ; started with a user-supplied argument
+    (if (and (integerp calc-embed-top) (not calc-embed-bot))  
+                                        ; started with a user-supplied argument
 	(progn
 	  (if (= (setq arg (prefix-numeric-value arg)) 0)
 	      (progn
@@ -741,18 +760,18 @@
 	  (aset info 4 (copy-marker (aref info 2)))
 	  (aset info 5 (copy-marker (aref info 3))))
       (if (aref info 4)
-	  (setq top (aref info 2)
-		fixed top)
-	(if (consp top)
+	  (setq calc-embed-top (aref info 2)
+		fixed calc-embed-top)
+	(if (consp calc-embed-top)
 	    (let ((calc-embedded-open-formula calc-embedded-open-word)
 		  (calc-embedded-close-formula calc-embedded-close-word))
 	      (calc-embedded-find-bounds 'plain))
-	  (or top
+	  (or calc-embed-top
 	      (calc-embedded-find-bounds 'plain)))
-	(aset info 2 (copy-marker (min top bot)))
-	(aset info 3 (copy-marker (max top bot)))
-	(aset info 4 (copy-marker (or outer-top (aref info 2))))
-	(aset info 5 (copy-marker (or outer-bot (aref info 3))))))
+	(aset info 2 (copy-marker (min calc-embed-top calc-embed-bot)))
+	(aset info 3 (copy-marker (max calc-embed-top calc-embed-bot)))
+	(aset info 4 (copy-marker (or calc-embed-outer-top (aref info 2))))
+	(aset info 5 (copy-marker (or calc-embed-outer-bot (aref info 3))))))
     (goto-char (aref info 2))
     (if new-info
 	(progn
@@ -776,7 +795,7 @@
 	  (let* ((open-plain calc-embedded-open-plain)
 		 (close-plain calc-embedded-close-plain)
 		 (pref-len (length open-plain))
-		 (vars-used nil)
+		 (calc-embed-vars-used nil)
 		 suff-pos val temp)
 	    (save-excursion
 	      (set-buffer (aref info 1))
@@ -810,7 +829,7 @@
 			      (nth 1 temp)))
 	    (if (memq (car-safe val) '(calcFunc-evalto calcFunc-assign))
 		(calc-embedded-find-vars val))
-	    (aset info 10 vars-used)
+	    (aset info 10 calc-embed-vars-used)
 	    (aset info 11 nil))))
     (if new-info
 	(progn
@@ -821,8 +840,8 @@
 (defun calc-embedded-find-vars (x)
   (cond ((Math-primp x)
 	 (and (eq (car-safe x) 'var)
-	      (not (assoc x vars-used))
-	      (setq vars-used (cons (list x) vars-used))))
+	      (not (assoc x calc-embed-vars-used))
+	      (setq calc-embed-vars-used (cons (list x) calc-embed-vars-used))))
 	((eq (car x) 'calcFunc-evalto)
 	 (calc-embedded-find-vars (nth 1 x)))
 	((eq (car x) 'calcFunc-assign)
@@ -831,16 +850,16 @@
 	 (and (eq (car x) 'calcFunc-subscr)
 	      (eq (car-safe (nth 1 x)) 'var)
 	      (Math-primp (nth 2 x))
-	      (not (assoc x vars-used))
-	      (setq vars-used (cons (list x) vars-used)))
+	      (not (assoc x calc-embed-vars-used))
+	      (setq calc-embed-vars-used (cons (list x) calc-embed-vars-used)))
 	 (while (setq x (cdr x))
 	   (calc-embedded-find-vars (car x))))))
 
 
 (defun calc-embedded-evaluate-expr (x)
-  (let ((vars-used (aref calc-embedded-info 10)))
-    (or vars-used (calc-embedded-find-vars x))
-    (if vars-used
+  (let ((calc-embed-vars-used (aref calc-embedded-info 10)))
+    (or calc-embed-vars-used (calc-embedded-find-vars x))
+    (if calc-embed-vars-used
 	(let ((active (assq (aref calc-embedded-info 0) calc-embedded-active))
 	      (args nil))
 	  (save-excursion
@@ -850,9 +869,9 @@
 		  (calc-embedded-activate)
 		  (setq active (assq (aref calc-embedded-info 0)
 				     calc-embedded-active))))
-	    (while vars-used
-	      (calc-embedded-eval-get-var (car (car vars-used)) active)
-	      (setq vars-used (cdr vars-used))))
+	    (while calc-embed-vars-used
+	      (calc-embedded-eval-get-var (car (car calc-embed-vars-used)) active)
+	      (setq calc-embed-vars-used (cdr calc-embed-vars-used))))
 	  (calc-embedded-subst x))
       (calc-normalize (math-evaluate-expr-rec x)))))
 
@@ -900,10 +919,10 @@
 
 (defun calc-embedded-update (info which need-eval need-display
 				  &optional str entry old-val)
-  (let* ((prev-modes nil)
+  (let* ((calc-embed-prev-modes nil)
 	 (open-plain calc-embedded-open-plain)
 	 (close-plain calc-embedded-close-plain)
-	 (vars-used nil)
+	 (calc-embed-vars-used nil)
 	 (evalled nil)
 	 (val (aref info 8))
 	 (old-eval (aref info 11)))
@@ -926,7 +945,7 @@
 	  (if (or (eq need-eval 'eval) (eq (car-safe val) 'calcFunc-evalto))
 	      (aset info 8 val))
 	  (aset info 9 nil)
-	  (aset info 10 vars-used)
+	  (aset info 10 calc-embed-vars-used)
 	  (aset info 11 nil)
 	  (if (or need-display (eq (car-safe val) 'calcFunc-evalto))
 	      (let ((extra (if (eq calc-language 'big) 1 0)))
@@ -978,16 +997,17 @@
 	    (if (eq (car-safe old-val) 'calcFunc-assign)
 		(calc-embedded-var-change (nth 1 old-val) (aref info 0)))))
       (set-buffer (aref info 1))
-      (while prev-modes
-	(cond ((eq (car (car prev-modes)) 'the-language)
+      (while calc-embed-prev-modes
+	(cond ((eq (car (car calc-embed-prev-modes)) 'the-language)
+	       (if need-display
+		   (calc-embedded-set-language (cdr (car calc-embed-prev-modes)))))
+	      ((eq (car (car calc-embed-prev-modes)) 'the-display-just)
 	       (if need-display
-		   (calc-embedded-set-language (cdr (car prev-modes)))))
-	      ((eq (car (car prev-modes)) 'the-display-just)
-	       (if need-display
-		   (calc-embedded-set-justify (cdr (car prev-modes)))))
+		   (calc-embedded-set-justify (cdr (car calc-embed-prev-modes)))))
 	      (t
-	       (set (car (car prev-modes)) (cdr (car prev-modes)))))
-	(setq prev-modes (cdr prev-modes))))))
+	       (set (car (car calc-embed-prev-modes)) 
+                    (cdr (car calc-embed-prev-modes)))))
+	(setq calc-embed-prev-modes (cdr calc-embed-prev-modes))))))
 
 
 
@@ -1203,5 +1223,7 @@
 	(setq bp (if buf nil (cdr bp))))
       (or first calc-embedded-quiet (message "")))))
 
+(provide 'calc-embed)
+
 ;;; arch-tag: 1b8f311e-fba1-40d3-b8c3-1d6f68fd26fc
 ;;; calc-embed.el ends here
--- a/lisp/calc/calc-ext.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-ext.el	Wed Dec 08 22:20:27 2004 +0000
@@ -26,26 +26,7 @@
 
 ;;; Code:
 
-(provide 'calc-ext)
 (require 'calc)
-
-(setq calc-extensions-loaded t)
-
-;;; This function is the autoload "hook" to cause this file to be loaded.
-;;;###autoload
-(defun calc-extensions ()
-  "This function is part of the autoload linkage for parts of Calc."
-  t)
-
-;;; Auto-load calc.el part, in case this part was loaded first.
-(if (fboundp 'calc-dispatch)
-    (and (eq (car-safe (symbol-function 'calc-dispatch)) 'autoload)
-	 (load (nth 1 (symbol-function 'calc-dispatch))))
-  (if (fboundp 'calc)
-      (and (eq (car-safe (symbol-function 'calc)) 'autoload)
-	   (load (nth 1 (symbol-function 'calc))))
-    (error "Main part of Calc must be present in order to load this file")))
-
 (require 'calc-macs)
 
 (defvar math-simplifying nil)
@@ -668,7 +649,7 @@
       (autoload func (car x)))) (cdr x))))
     '(
 
- ("calc-alg" calc-Need-calc-alg calc-has-rules
+ ("calc-alg" calc-has-rules math-defsimplify
 calc-modify-simplify-mode calcFunc-collect calcFunc-esimplify
 calcFunc-islin calcFunc-islinnt calcFunc-lin calcFunc-linnt
 calcFunc-simplify calcFunc-subst math-beforep
@@ -676,13 +657,13 @@
 math-expr-contains-count math-expr-depends math-expr-height
 math-expr-subst math-expr-weight math-integer-plus math-is-linear
 math-is-multiple math-is-polynomial math-linear-in math-multiple-of
-math-need-std-simps math-poly-depends math-poly-mix math-poly-mul
+math-poly-depends math-poly-mix math-poly-mul
 math-poly-simplify math-poly-zerop math-polynomial-base
 math-polynomial-p math-recompile-eval-rules math-simplify
 math-simplify-exp math-simplify-extended math-simplify-sqrt
 math-to-simple-fraction)
 
- ("calcalg2" calc-Need-calc-alg-2 calcFunc-asum calcFunc-deriv
+ ("calcalg2" calcFunc-asum calcFunc-deriv
 calcFunc-ffinv calcFunc-finv calcFunc-fsolve calcFunc-gpoly
 calcFunc-integ calcFunc-poly calcFunc-prod calcFunc-roots
 calcFunc-solve calcFunc-sum calcFunc-table calcFunc-taylor
@@ -691,7 +672,7 @@
 math-poly-all-roots math-prod-rec math-reject-solution math-solve-eqn
 math-solve-for math-sum-rec math-try-integral)
 
- ("calcalg3" calc-Need-calc-alg-3 calcFunc-efit calcFunc-fit
+ ("calcalg3" calcFunc-efit calcFunc-fit
 calcFunc-fitdummy calcFunc-fitparam calcFunc-fitvar
 calcFunc-hasfitparams calcFunc-hasfitvars calcFunc-maximize
 calcFunc-minimize calcFunc-ninteg calcFunc-polint calcFunc-ratint
@@ -699,7 +680,7 @@
 calcFunc-xfit math-find-minimum math-find-root math-ninteg-evaluate
 math-ninteg-midpoint math-ninteg-romberg math-poly-interp)
 
- ("calc-arith" calc-Need-calc-arith calcFunc-abs calcFunc-abssqr
+ ("calc-arith" calcFunc-abs calcFunc-abssqr
 calcFunc-add calcFunc-ceil calcFunc-decr calcFunc-deven calcFunc-dimag
 calcFunc-dint calcFunc-div calcFunc-dnatnum calcFunc-dneg
 calcFunc-dnonneg calcFunc-dnonzero calcFunc-dnumint calcFunc-dodd
@@ -725,7 +706,7 @@
 math-quarter-integer math-round math-setup-declarations math-sqr
 math-sqr-float math-trunc-fancy math-trunc-special)
 
- ("calc-bin" calc-Need-calc-bin calcFunc-and calcFunc-ash
+ ("calc-bin" calcFunc-and calcFunc-ash
 calcFunc-clip calcFunc-diff calcFunc-lsh calcFunc-not calcFunc-or
 calcFunc-rash calcFunc-rot calcFunc-rsh calcFunc-xor math-clip
 math-compute-max-digits math-convert-radix-digits math-float-parts
@@ -734,7 +715,7 @@
 math-format-radix math-format-radix-float math-integer-log2
 math-power-of-2 math-radix-float-power)
 
- ("calc-comb" calc-Need-calc-comb calc-report-prime-test
+ ("calc-comb"  calc-report-prime-test
 calcFunc-choose calcFunc-dfact calcFunc-egcd calcFunc-fact
 calcFunc-gcd calcFunc-lcm calcFunc-moebius calcFunc-nextprime
 calcFunc-perm calcFunc-prevprime calcFunc-prfac calcFunc-prime
@@ -742,28 +723,28 @@
 calcFunc-totient math-init-random-base math-member math-prime-test
 math-random-base)
 
- ("calccomp" calc-Need-calc-comp calcFunc-cascent calcFunc-cdescent
+ ("calccomp" calcFunc-cascent calcFunc-cdescent
 calcFunc-cheight calcFunc-cwidth math-comp-ascent math-comp-descent
 math-comp-height math-comp-width math-compose-expr
 math-composition-to-string math-stack-value-offset-fancy
 math-vector-is-string math-vector-to-string)
 
- ("calc-cplx" calc-Need-calc-cplx calcFunc-arg calcFunc-conj
+ ("calc-cplx" calcFunc-arg calcFunc-conj
 calcFunc-im calcFunc-polar calcFunc-re calcFunc-rect math-complex
 math-fix-circular math-imaginary math-imaginary-i math-normalize-polar
 math-polar math-want-polar)
 
- ("calc-embed" calc-Need-calc-embed calc-do-embedded
+ ("calc-embed" calc-do-embedded
 calc-do-embedded-activate calc-embedded-evaluate-expr
 calc-embedded-modes-change calc-embedded-var-change)
 
- ("calc-fin" calc-Need-calc-fin calc-to-percentage calcFunc-ddb
+ ("calc-fin" calc-to-percentage calcFunc-ddb
 calcFunc-fv calcFunc-fvb calcFunc-fvl calcFunc-irr calcFunc-irrb
 calcFunc-nper calcFunc-nperb calcFunc-nperl calcFunc-npv calcFunc-npvb
 calcFunc-pmt calcFunc-pmtb calcFunc-pv calcFunc-pvb calcFunc-pvl
 calcFunc-rate calcFunc-rateb calcFunc-ratel calcFunc-sln calcFunc-syd)
 
- ("calc-forms" calc-Need-calc-forms calcFunc-badd calcFunc-bsub
+ ("calc-forms" calcFunc-badd calcFunc-bsub
 calcFunc-date calcFunc-day calcFunc-dsadj calcFunc-hms
 calcFunc-holiday calcFunc-hour calcFunc-incmonth calcFunc-incyear
 calcFunc-intv calcFunc-julian calcFunc-makemod calcFunc-minute
@@ -778,11 +759,11 @@
 math-setup-add-holidays math-setup-holidays math-setup-year-holidays
 math-sort-intv math-to-business-day math-to-hms)
 
- ("calc-frac" calc-Need-calc-frac calc-add-fractions
+ ("calc-frac" calc-add-fractions
 calc-div-fractions calc-mul-fractions calcFunc-fdiv calcFunc-frac
 math-make-frac)
 
- ("calc-funcs" calc-Need-calc-funcs calc-prob-dist calcFunc-bern
+ ("calc-funcs" calc-prob-dist calcFunc-bern
 calcFunc-besJ calcFunc-besY calcFunc-beta calcFunc-betaB
 calcFunc-betaI calcFunc-erf calcFunc-erfc calcFunc-euler
 calcFunc-gamma calcFunc-gammaG calcFunc-gammaP calcFunc-gammaQ
@@ -791,20 +772,18 @@
 calcFunc-utpf calcFunc-utpn calcFunc-utpp calcFunc-utpt
 math-bernoulli-number math-gammap1-raw)
 
- ("calc-graph" calc-Need-calc-graph calc-graph-show-tty)
-
- ("calc-help" calc-Need-calc-help)
-
- ("calc-incom" calc-Need-calc-incom calc-digit-dots)
-
- ("calc-keypd" calc-Need-calc-keypd calc-do-keypad
+ ("calc-graph" calc-graph-show-tty)
+
+ ("calc-incom" calc-digit-dots)
+
+ ("calc-keypd" calc-do-keypad
 calc-keypad-x-left-click calc-keypad-x-middle-click
 calc-keypad-x-right-click)
 
- ("calc-lang" calc-Need-calc-lang calc-set-language
+ ("calc-lang" calc-set-language
 math-read-big-balance math-read-big-rec)
 
- ("calc-map" calc-Need-calc-map calc-get-operator calcFunc-accum
+ ("calc-map" calc-get-operator calcFunc-accum
 calcFunc-afixp calcFunc-anest calcFunc-apply calcFunc-call
 calcFunc-fixp calcFunc-inner calcFunc-map calcFunc-mapa calcFunc-mapc
 calcFunc-mapd calcFunc-mapeq calcFunc-mapeqp calcFunc-mapeqr
@@ -815,11 +794,11 @@
 math-calcFunc-to-var math-multi-subst math-multi-subst-rec
 math-var-to-calcFunc)
 
- ("calc-mtx" calc-Need-calc-mat calcFunc-det calcFunc-lud calcFunc-tr
+ ("calc-mtx" calcFunc-det calcFunc-lud calcFunc-tr
 math-col-matrix math-lud-solve math-matrix-inv-raw math-matrix-lud
 math-mul-mat-vec math-mul-mats math-row-matrix)
 
- ("calc-math" calc-Need-calc-math calcFunc-alog calcFunc-arccos
+ ("calc-math" calcFunc-alog calcFunc-arccos
 calcFunc-arccosh calcFunc-arcsin calcFunc-arcsincos calcFunc-arcsinh
 calcFunc-arctan calcFunc-arctan2 calcFunc-arctanh calcFunc-cos
 calcFunc-cosh calcFunc-deg calcFunc-exp calcFunc-exp10 calcFunc-expm1
@@ -834,9 +813,9 @@
 math-sin-cos-raw math-sin-raw math-sqrt math-sqrt-float math-sqrt-raw
 math-tan-raw math-to-radians math-to-radians-2)
 
- ("calc-mode" calc-Need-calc-mode math-get-modes-vec)
-
- ("calc-poly" calc-Need-calc-poly calcFunc-apart calcFunc-expand
+ ("calc-mode" math-get-modes-vec)
+
+ ("calc-poly" calcFunc-apart calcFunc-expand
 calcFunc-expandpow calcFunc-factor calcFunc-factors calcFunc-nrat
 calcFunc-pcont calcFunc-pdeg calcFunc-pdiv calcFunc-pdivide
 calcFunc-pdivrem calcFunc-pgcd calcFunc-plead calcFunc-pprim
@@ -849,7 +828,7 @@
 math-poly-gcd-frac-list math-poly-modulus-rec math-ratpoly-p
 math-to-ratpoly math-to-ratpoly-rec)
 
- ("calc-prog" calc-Need-calc-prog calc-default-formula-arglist
+ ("calc-prog" calc-default-formula-arglist
 calc-execute-kbd-macro calc-finish-user-syntax-edit
 calc-fix-token-name calc-fix-user-formula calc-read-parse-table
 calc-read-parse-table-part calc-subsetp calc-write-parse-table
@@ -862,7 +841,7 @@
 math-do-defmath math-handle-for math-handle-foreach
 math-normalize-logical-op math-return)
 
- ("calc-rewr" calc-Need-calc-rewr calcFunc-match calcFunc-matches
+ ("calc-rewr" calcFunc-match calcFunc-matches
 calcFunc-matchnot calcFunc-rewrite calcFunc-vmatches
 math-apply-rewrites math-compile-patterns math-compile-rewrites
 math-flatten-lands math-match-patterns math-rewrite
@@ -870,43 +849,37 @@
 
  ("calc-rules" calc-CommuteRules calc-DistribRules calc-FactorRules
 calc-FitRules calc-IntegAfterRules calc-InvertRules calc-JumpRules
-calc-MergeRules calc-Need-calc-rules calc-NegateRules
+calc-MergeRules calc-NegateRules
 calc-compile-rule-set)
 
- ("calc-sel" calc-Need-calc-sel calc-auto-selection
+ ("calc-sel" calc-auto-selection
 calc-delete-selection calc-encase-atoms calc-find-assoc-parent-formula
 calc-find-parent-formula calc-find-sub-formula calc-prepare-selection
 calc-preserve-point calc-replace-selections calc-replace-sub-formula
 calc-roll-down-with-selections calc-roll-up-with-selections
 calc-sel-error)
 
- ("calcsel2" calc-Need-calc-sel-2)
-
- ("calc-stat" calc-Need-calc-stat calc-vector-op calcFunc-agmean
+ ("calc-stat" calc-vector-op calcFunc-agmean
 calcFunc-vcorr calcFunc-vcount calcFunc-vcov calcFunc-vflat
 calcFunc-vgmean calcFunc-vhmean calcFunc-vmax calcFunc-vmean
 calcFunc-vmeane calcFunc-vmedian calcFunc-vmin calcFunc-vpcov
 calcFunc-vprod calcFunc-vpsdev calcFunc-vpvar calcFunc-vsdev
 calcFunc-vsum calcFunc-vvar math-flatten-many-vecs)
 
- ("calc-store" calc-Need-calc-store calc-read-var-name
+ ("calc-store" calc-read-var-name
 calc-store-value calc-var-name)
 
- ("calc-stuff" calc-Need-calc-stuff calc-explain-why calcFunc-clean
+ ("calc-stuff" calc-explain-why calcFunc-clean
 calcFunc-pclean calcFunc-pfloat calcFunc-pfrac)
 
- ("calc-trail" calc-Need-calc-trail)
-
- ("calc-undo" calc-Need-calc-undo)
-
- ("calc-units" calc-Need-calc-units calcFunc-usimplify
+ ("calc-units" calcFunc-usimplify
 math-build-units-table math-build-units-table-buffer
 math-check-unit-name math-convert-temperature math-convert-units
 math-extract-units math-remove-units math-simplify-units
 math-single-units-in-expr-p math-to-standard-units
 math-units-in-expr-p)
 
- ("calc-vec" calc-Need-calc-vec calcFunc-append calcFunc-appendrev
+ ("calc-vec" calcFunc-append calcFunc-appendrev
 calcFunc-arrange calcFunc-cnorm calcFunc-cons calcFunc-cross
 calcFunc-ctrn calcFunc-cvec calcFunc-diag calcFunc-find
 calcFunc-getdiag calcFunc-grade calcFunc-head calcFunc-histogram
@@ -925,7 +898,7 @@
 math-map-vec-2 math-mat-col math-mimic-ident math-prepare-set
 math-read-brackets math-reduce-cols math-reduce-vec math-transpose)
 
- ("calc-yank" calc-Need-calc-yank calc-alg-edit calc-clean-newlines
+ ("calc-yank" calc-alg-edit calc-clean-newlines
 calc-do-grab-rectangle calc-do-grab-region calc-finish-stack-edit
 calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer)
 
@@ -1176,6 +1149,9 @@
 
 ;;;; Miscellaneous.
 
+;; calc-command-flags is declared in calc.el
+(defvar calc-command-flags)
+
 (defun calc-clear-command-flag (f)
   (setq calc-command-flags (delq f calc-command-flags)))
 
@@ -1342,7 +1318,16 @@
 
 (defun calc-inverse (&optional n)
   (interactive "P")
-  (calc-fancy-prefix 'calc-inverse-flag "Inverse..." n))
+  (let* ((hyp-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-hyperbolic-flag)
+                     calc-hyperbolic-flag))
+         (msg (if hyp-flag 
+                 "Inverse Hyperbolic..."
+               "Inverse...")))
+    (calc-fancy-prefix 'calc-inverse-flag msg n)))
 
 (defconst calc-fancy-prefix-map
   (let ((map (make-sparse-keymap)))
@@ -1410,7 +1395,16 @@
 
 (defun calc-hyperbolic (&optional n)
   (interactive "P")
-  (calc-fancy-prefix 'calc-hyperbolic-flag "Hyperbolic..." n))
+  (let* ((inv-flag (if (or
+                        (eq major-mode 'calc-keypad-mode)
+                        (eq major-mode 'calc-trail-mode))
+                       (with-current-buffer calc-main-buffer
+                         calc-inverse-flag)
+                     calc-inverse-flag))
+         (msg (if inv-flag 
+                  "Inverse Hyperbolic..."
+                "Hyperbolic...")))
+    (calc-fancy-prefix 'calc-hyperbolic-flag msg n)))
 
 (defun calc-hyperbolic-func ()
   (save-excursion
@@ -1654,7 +1648,8 @@
 
 
 (defvar calc-gnuplot-process nil)
-
+(defvar calc-gnuplot-input)
+(defvar calc-gnuplot-buffer)
 
 (defun calc-gnuplot-alive ()
   (and calc-gnuplot-process
@@ -1670,47 +1665,45 @@
 
 (defun calc-load-everything ()
   (interactive)
-  (calc-need-macros)       ; calc-macs.el
-  (calc-record-list nil)   ; calc-misc.el
-  (math-read-exprs "0")    ; calc-aent.el
-
-;;;; (Loads here)
-  (calc-Need-calc-alg-2)
-  (calc-Need-calc-alg-3)
-  (calc-Need-calc-alg)
-  (calc-Need-calc-arith)
-  (calc-Need-calc-bin)
-  (calc-Need-calc-comb)
-  (calc-Need-calc-comp)
-  (calc-Need-calc-cplx)
-  (calc-Need-calc-embed)
-  (calc-Need-calc-fin)
-  (calc-Need-calc-forms)
-  (calc-Need-calc-frac)
-  (calc-Need-calc-funcs)
-  (calc-Need-calc-graph)
-  (calc-Need-calc-help)
-  (calc-Need-calc-incom)
-  (calc-Need-calc-keypd)
-  (calc-Need-calc-lang)
-  (calc-Need-calc-map)
-  (calc-Need-calc-mat)
-  (calc-Need-calc-math)
-  (calc-Need-calc-mode)
-  (calc-Need-calc-poly)
-  (calc-Need-calc-prog)
-  (calc-Need-calc-rewr)
-  (calc-Need-calc-rules)
-  (calc-Need-calc-sel-2)
-  (calc-Need-calc-sel)
-  (calc-Need-calc-stat)
-  (calc-Need-calc-store)
-  (calc-Need-calc-stuff)
-  (calc-Need-calc-trail)
-  (calc-Need-calc-undo)
-  (calc-Need-calc-units)
-  (calc-Need-calc-vec)
-  (calc-Need-calc-yank)
+  (require 'calc-aent)
+  (require 'calc-alg)
+  (require 'calc-arith)
+  (require 'calc-bin)
+  (require 'calc-comb)
+  (require 'calc-cplx)
+  (require 'calc-embed)
+  (require 'calc-fin)
+  (require 'calc-forms)
+  (require 'calc-frac)
+  (require 'calc-funcs)
+  (require 'calc-graph)
+  (require 'calc-help)
+  (require 'calc-incom)
+  (require 'calc-keypd)
+  (require 'calc-lang)
+  (require 'calc-macs)
+  (require 'calc-map)
+  (require 'calc-math)
+  (require 'calc-misc)
+  (require 'calc-mode)
+  (require 'calc-mtx)
+  (require 'calc-poly)
+  (require 'calc-prog)
+  (require 'calc-rewr)
+  (require 'calc-rules)
+  (require 'calc-sel)
+  (require 'calc-stat)
+  (require 'calc-store)
+  (require 'calc-stuff)
+  (require 'calc-trail)
+  (require 'calc-undo)
+  (require 'calc-units)
+  (require 'calc-vec)
+  (require 'calc-yank)
+  (require 'calcalg2)
+  (require 'calcalg3)
+  (require 'calccomp)
+  (require 'calcsel2)
 
   (message "All parts of Calc are now loaded"))
 
@@ -2217,6 +2210,11 @@
 	     (math-normalize (car a))
 	   (error "Can't use multi-valued function in an expression")))))
 
+;; The variable math-normalize-a is local to math-normalize in calc.el,
+;; but is used by math-normalize-nonstandard, which is called by
+;; math-normalize.
+(defvar math-normalize-a)
+
 (defun math-normalize-nonstandard ()
   (if (consp calc-simplify-mode)
       (progn
@@ -2591,20 +2589,6 @@
 	    (cons (car x) (mapcar 'math-evaluate-expr-rec (cdr x))))))
     x))
 
-(defmacro math-defsimplify (funcs &rest code)
-  (append '(progn (math-need-std-simps))
-	  (mapcar (function
-		   (lambda (func)
-		     (list 'put (list 'quote func) ''math-simplify
-			   (list 'nconc
-				 (list 'get (list 'quote func) ''math-simplify)
-				 (list 'list
-				       (list 'function
-					     (append '(lambda (math-simplify-expr))
-						     code)))))))
-		  (if (symbolp funcs) (list funcs) funcs))))
-(put 'math-defsimplify 'lisp-indent-hook 1)
-
 (defun math-any-floats (expr)
   (if (Math-primp expr)
       (math-floatp expr)
@@ -2656,6 +2640,10 @@
 		(eq (car-safe (symbol-value (nth 2 expr))) 'special-const))
 	   (memq (nth 2 expr) '(var-inf var-uinf var-nan)))))
 
+;; The variable math-integral-cache is originally declared in calcalg2.el,
+;; but is set by math-defintegral and math-definitegral2.
+(defvar math-integral-cache)
+
 (defmacro math-defintegral (funcs &rest code)
   (setq math-integral-cache nil)
   (append '(progn)
@@ -2886,11 +2874,79 @@
 
 (defvar math-expr-data)
 
+(defvar math-read-replacement-list
+  '(;; Misc symbols
+    ("±" "+/-")  ; plus or minus
+    ("×" "*")    ; multiplication sign
+    ("÷" ":")    ; division sign
+    ("−" "-")    ; subtraction sign
+    ("∕" "/")    ; division sign
+    ("∗" "*")    ; asterisk multiplication
+    ("∞" "inf")  ; infinity symbol
+    ("≤" "<=")
+    ("≥" ">=")
+    ("≦" "<=")
+    ("≧" ">=")
+    ;; fractions
+    ("¼" "(1:4)") ; 1/4
+    ("½" "(1:2)") ; 1/2
+    ("¾" "(3:4)") ; 3/4
+    ("⅓" "(1:3)") ; 1/3
+    ("⅔" "(2:3)") ; 2/3
+    ("⅕" "(1:5)") ; 1/5
+    ("⅖" "(2:5)") ; 2/5
+    ("⅗" "(3:5)") ; 3/5
+    ("⅘" "(4:5)") ; 4/5
+    ("⅙" "(1:6)") ; 1/6
+    ("⅚" "(5:6)") ; 5/6
+    ("⅛" "(1:8)") ; 1/8
+    ("⅜" "(3:8)") ; 3/8
+    ("⅝" "(5:8)") ; 5/8
+    ("⅞" "(7:8)") ; 7/8
+    ("⅟" "1:")    ; 1/...
+    ;; superscripts
+    ("⁰" "0")  ; 0
+    ("¹" "1")  ; 1
+    ("²" "2")  ; 2
+    ("³" "3")  ; 3
+    ("⁴" "4")  ; 4
+    ("⁵" "5")  ; 5
+    ("⁶" "6")  ; 6
+    ("⁷" "7")  ; 7
+    ("⁸" "8")  ; 8
+    ("⁹" "9")  ; 9
+    ("⁺" "+")  ; +
+    ("⁻" "-")  ; -
+    ("⁽" "(")  ; (
+    ("⁾" ")")  ; )
+    ("ⁿ" "n")  ; n
+    ("ⁱ" "i")) ; i
+  "A list whose elements (old new) indicate replacements to make
+in Calc algebraic input.")
+
+(defvar math-read-superscripts
+  "⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ" ; 0123456789+-()ni
+  "A string consisting of the superscripts allowed by Calc.")
+
+(defun math-read-preprocess-string (str)
+  "Replace some substrings of STR by Calc equivalents."
+  (setq str
+        (replace-regexp-in-string (concat "[" math-read-superscripts "]+")
+                                  "^(\\&)" str))
+  (let ((rep-list math-read-replacement-list))
+    (while rep-list
+      (setq str
+            (replace-regexp-in-string (nth 0 (car rep-list))
+                                      (nth 1 (car rep-list)) str))
+      (setq rep-list (cdr rep-list))))
+  str)
+
 (defun math-read-expr (math-exp-str)
   (let ((math-exp-pos 0)
 	(math-exp-old-pos 0)
 	(math-exp-keep-spaces nil)
 	math-exp-token math-expr-data)
+    (setq math-exp-str (math-read-preprocess-string math-exp-str))
     (while (setq math-exp-token (string-match "\\.\\.\\([^.]\\|.[^.]\\)" math-exp-str))
       (setq math-exp-str (concat (substring math-exp-str 0 math-exp-token) "\\dots"
 			    (substring math-exp-str (+ math-exp-token 2)))))
@@ -2943,37 +2999,39 @@
 	      (math-expr-function-mapping (get 'tex 'math-function-table))
 	      (math-expr-variable-mapping (get 'tex 'math-variable-table)))
 	  (math-read-expr str)))
-    (let ((lines nil)
+    (let ((math-read-big-lines nil)
 	  (pos 0)
 	  (width 0)
-	  (err-msg nil)
-	  the-baseline the-h2
+	  (math-read-big-err-msg nil)
+	  math-read-big-baseline math-read-big-h2
 	  new-pos p)
       (while (setq new-pos (string-match "\n" str pos))
-	(setq lines (cons (substring str pos new-pos) lines)
+	(setq math-read-big-lines 
+              (cons (substring str pos new-pos) math-read-big-lines)
 	      pos (1+ new-pos)))
-      (setq lines (nreverse (cons (substring str pos) lines))
-	    p lines)
+      (setq math-read-big-lines 
+            (nreverse (cons (substring str pos) math-read-big-lines))
+	    p math-read-big-lines)
       (while p
 	(setq width (max width (length (car p)))
 	      p (cdr p)))
-      (if (math-read-big-bigp lines)
+      (if (math-read-big-bigp math-read-big-lines)
 	  (or (catch 'syntax
-		(math-read-big-rec 0 0 width (length lines)))
-	      err-msg
+		(math-read-big-rec 0 0 width (length math-read-big-lines)))
+	      math-read-big-err-msg
 	      '(error 0 "Syntax error"))
 	(math-read-expr str)))))
 
-(defun math-read-big-bigp (lines)
-  (and (cdr lines)
+(defun math-read-big-bigp (math-read-big-lines)
+  (and (cdr math-read-big-lines)
        (let ((matrix nil)
 	     (v 0)
-	     (height (if (> (length (car lines)) 0) 1 0)))
-	 (while (and (cdr lines)
+	     (height (if (> (length (car math-read-big-lines)) 0) 1 0)))
+	 (while (and (cdr math-read-big-lines)
 		     (let* ((i 0)
 			    j
-			    (l1 (car lines))
-			    (l2 (nth 1 lines))
+			    (l1 (car math-read-big-lines))
+			    (l2 (nth 1 math-read-big-lines))
 			    (len (min (length l1) (length l2))))
 		       (if (> (length l2) 0)
 			   (setq height (1+ height)))
@@ -2984,7 +3042,7 @@
 					    (= (aref l2 i) (aref l1 i)))
 				       (and (eq (aref l1 i) ?\[)
 					    (eq (aref l2 i) ?\[)
-					    (let ((h2 (length l1)))
+					    (let ((math-rb-h2 (length l1)))
 					      (setq j (math-read-big-balance
 						       (1+ i) v "[")))
 					    (setq i (1- j)))))
@@ -2994,10 +3052,10 @@
 				(eq (aref l2 i) ?\[)
 				(setq matrix t)
 				nil))))
-	   (setq lines (cdr lines)
+	   (setq math-read-big-lines (cdr math-read-big-lines)
 		 v (1+ v)))
 	 (or (and (> height 1)
-		  (not (cdr lines)))
+		  (not (cdr math-read-big-lines)))
 	     matrix))))
 
 ;;; Nontrivial "flat" formatting.
@@ -3288,5 +3346,7 @@
 
 (run-hooks 'calc-ext-load-hook)
 
+(provide 'calc-ext)
+
 ;;; arch-tag: 1814ba7f-a390-49dc-9e25-a5adc205e97e
 ;;; calc-ext.el ends here
--- a/lisp/calc/calc-fin.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-fin.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-fin () nil)
-
-
 ;;; Financial functions.
 
 (defun calc-fin-pv ()
@@ -413,5 +409,7 @@
 		  book salvage)))
       res)))
 
+(provide 'calc-fin)
+
 ;;; arch-tag: 82f30ca8-d02f-4b33-84b4-bb6ecd84597b
 ;;; calc-fin.el ends here
--- a/lisp/calc/calc-forms.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-forms.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2004 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-forms () nil)
-
-
 (defun calc-time ()
   (interactive)
   (calc-wrapper
@@ -510,181 +506,200 @@
 
 
 (defvar math-format-date-cache nil)
-(defun math-format-date (date)
-  (if (eq (car-safe date) 'date)
-      (setq date (nth 1 date)))
-  (let ((entry (list date calc-internal-prec calc-date-format)))
+
+;; The variables math-fd-date, math-fd-dt, math-fd-year, 
+;; math-fd-month, math-fd-day, math-fd-weekday, math-fd-hour,
+;; math-fd-minute, math-fd-second, math-fd-bc-flag are local
+;; to math-format-date, but are used by math-format-date-part,
+;; which is called by math-format-date.
+(defvar math-fd-date)
+(defvar math-fd-dt)
+(defvar math-fd-year)
+(defvar math-fd-month)
+(defvar math-fd-day)
+(defvar math-fd-weekday)
+(defvar math-fd-hour)
+(defvar math-fd-minute)
+(defvar math-fd-second)
+(defvar math-fd-bc-flag)
+
+(defun math-format-date (math-fd-date)
+  (if (eq (car-safe math-fd-date) 'date)
+      (setq math-fd-date (nth 1 math-fd-date)))
+  (let ((entry (list math-fd-date calc-internal-prec calc-date-format)))
     (or (cdr (assoc entry math-format-date-cache))
-	(let* ((dt nil)
+	(let* ((math-fd-dt nil)
 	       (calc-group-digits nil)
 	       (calc-leading-zeros nil)
 	       (calc-number-radix 10)
-	       year month day weekday hour minute second
-	       (bc-flag nil)
+	       math-fd-year math-fd-month math-fd-day math-fd-weekday 
+               math-fd-hour math-fd-minute math-fd-second
+	       (math-fd-bc-flag nil)
 	       (fmt (apply 'concat (mapcar 'math-format-date-part
 					   calc-date-format))))
 	  (setq math-format-date-cache (cons (cons entry fmt)
 					     math-format-date-cache))
-	  (and (setq dt (nthcdr 10 math-format-date-cache))
-	       (setcdr dt nil))
+	  (and (setq math-fd-dt (nthcdr 10 math-format-date-cache))
+	       (setcdr math-fd-dt nil))
 	  fmt))))
 
 (defun math-format-date-part (x)
   (cond ((stringp x)
 	 x)
 	((listp x)
-	 (if (math-integerp date)
+	 (if (math-integerp math-fd-date)
 	     ""
 	   (apply 'concat (mapcar 'math-format-date-part x))))
 	((eq x 'X)
 	 "")
 	((eq x 'N)
-	 (math-format-number date))
+	 (math-format-number math-fd-date))
 	((eq x 'n)
-	 (math-format-number (math-floor date)))
+	 (math-format-number (math-floor math-fd-date)))
 	((eq x 'J)
-	 (math-format-number (math-add date '(float (bigpos 235 214 17) -1))))
+	 (math-format-number (math-add math-fd-date '(float (bigpos 235 214 17) -1))))
 	((eq x 'j)
-	 (math-format-number (math-add (math-floor date) '(bigpos 424 721 1))))
+	 (math-format-number (math-add (math-floor math-fd-date) '(bigpos 424 721 1))))
 	((eq x 'U)
-	 (math-format-number (nth 1 (math-date-parts date 719164))))
+	 (math-format-number (nth 1 (math-date-parts math-fd-date 719164))))
 	((progn
-	   (or dt
+	   (or math-fd-dt
 	       (progn
-		 (setq dt (math-date-to-dt date)
-		       year (car dt)
-		       month (nth 1 dt)
-		       day (nth 2 dt)
-		       weekday (math-mod (math-add (math-floor date) 6) 7)
-		       hour (nth 3 dt)
-		       minute (nth 4 dt)
-		       second (nth 5 dt))
+		 (setq math-fd-dt (math-date-to-dt math-fd-date)
+		       math-fd-year (car math-fd-dt)
+		       math-fd-month (nth 1 math-fd-dt)
+		       math-fd-day (nth 2 math-fd-dt)
+		       math-fd-weekday (math-mod 
+                                        (math-add (math-floor math-fd-date) 6) 7)
+		       math-fd-hour (nth 3 math-fd-dt)
+		       math-fd-minute (nth 4 math-fd-dt)
+		       math-fd-second (nth 5 math-fd-dt))
 		 (and (memq 'b calc-date-format)
-		      (math-negp year)
-		      (setq year (math-neg year)
-			    bc-flag t))))
+		      (math-negp math-fd-year)
+		      (setq math-fd-year (math-neg math-fd-year)
+			    math-fd-bc-flag t))))
 	   (memq x '(Y YY BY)))
-	 (if (and (integerp year) (> year 1940) (< year 2040))
+	 (if (and (integerp math-fd-year) (> math-fd-year 1940) (< math-fd-year 2040))
 	     (format (cond ((eq x 'YY) "%02d")
 			   ((eq x 'BYY) "%2d")
 			   (t "%d"))
-		     (% year 100))
-	   (if (and (natnump year) (< year 100))
-	       (format "+%d" year)
-	     (math-format-number year))))
+		     (% math-fd-year 100))
+	   (if (and (natnump math-fd-year) (< math-fd-year 100))
+	       (format "+%d" math-fd-year)
+	     (math-format-number math-fd-year))))
 	((eq x 'YYY)
-	 (math-format-number year))
+	 (math-format-number math-fd-year))
 	((eq x 'YYYY)
-	 (if (and (natnump year) (< year 100))
-	     (format "+%d" year)
-	   (math-format-number year)))
+	 (if (and (natnump math-fd-year) (< math-fd-year 100))
+	     (format "+%d" math-fd-year)
+	   (math-format-number math-fd-year)))
 	((eq x 'b) "")
 	((eq x 'aa)
-	 (and (not bc-flag) "ad"))
+	 (and (not math-fd-bc-flag) "ad"))
 	((eq x 'AA)
-	 (and (not bc-flag) "AD"))
+	 (and (not math-fd-bc-flag) "AD"))
 	((eq x 'aaa)
-	 (and (not bc-flag) "ad "))
+	 (and (not math-fd-bc-flag) "ad "))
 	((eq x 'AAA)
-	 (and (not bc-flag) "AD "))
+	 (and (not math-fd-bc-flag) "AD "))
 	((eq x 'aaaa)
-	 (and (not bc-flag) "a.d."))
+	 (and (not math-fd-bc-flag) "a.d."))
 	((eq x 'AAAA)
-	 (and (not bc-flag) "A.D."))
+	 (and (not math-fd-bc-flag) "A.D."))
 	((eq x 'bb)
-	 (and bc-flag "bc"))
+	 (and math-fd-bc-flag "bc"))
 	((eq x 'BB)
-	 (and bc-flag "BC"))
+	 (and math-fd-bc-flag "BC"))
 	((eq x 'bbb)
-	 (and bc-flag " bc"))
+	 (and math-fd-bc-flag " bc"))
 	((eq x 'BBB)
-	 (and bc-flag " BC"))
+	 (and math-fd-bc-flag " BC"))
 	((eq x 'bbbb)
-	 (and bc-flag "b.c."))
+	 (and math-fd-bc-flag "b.c."))
 	((eq x 'BBBB)
-	 (and bc-flag "B.C."))
+	 (and math-fd-bc-flag "B.C."))
 	((eq x 'M)
-	 (format "%d" month))
+	 (format "%d" math-fd-month))
 	((eq x 'MM)
-	 (format "%02d" month))
+	 (format "%02d" math-fd-month))
 	((eq x 'BM)
-	 (format "%2d" month))
+	 (format "%2d" math-fd-month))
 	((eq x 'mmm)
-	 (downcase (nth (1- month) math-short-month-names)))
+	 (downcase (nth (1- math-fd-month) math-short-month-names)))
 	((eq x 'Mmm)
-	 (nth (1- month) math-short-month-names))
+	 (nth (1- math-fd-month) math-short-month-names))
 	((eq x 'MMM)
-	 (upcase (nth (1- month) math-short-month-names)))
+	 (upcase (nth (1- math-fd-month) math-short-month-names)))
 	((eq x 'Mmmm)
-	 (nth (1- month) math-long-month-names))
+	 (nth (1- math-fd-month) math-long-month-names))
 	((eq x 'MMMM)
-	 (upcase (nth (1- month) math-long-month-names)))
+	 (upcase (nth (1- math-fd-month) math-long-month-names)))
 	((eq x 'D)
-	 (format "%d" day))
+	 (format "%d" math-fd-day))
 	((eq x 'DD)
-	 (format "%02d" day))
+	 (format "%02d" math-fd-day))
 	((eq x 'BD)
-	 (format "%2d" day))
+	 (format "%2d" math-fd-day))
 	((eq x 'W)
-	 (format "%d" weekday))
+	 (format "%d" math-fd-weekday))
 	((eq x 'www)
-	 (downcase (nth weekday math-short-weekday-names)))
+	 (downcase (nth math-fd-weekday math-short-weekday-names)))
 	((eq x 'Www)
-	 (nth weekday math-short-weekday-names))
+	 (nth math-fd-weekday math-short-weekday-names))
 	((eq x 'WWW)
-	 (upcase (nth weekday math-short-weekday-names)))
+	 (upcase (nth math-fd-weekday math-short-weekday-names)))
 	((eq x 'Wwww)
-	 (nth weekday math-long-weekday-names))
+	 (nth math-fd-weekday math-long-weekday-names))
 	((eq x 'WWWW)
-	 (upcase (nth weekday math-long-weekday-names)))
+	 (upcase (nth math-fd-weekday math-long-weekday-names)))
 	((eq x 'd)
-	 (format "%d" (math-day-number year month day)))
+	 (format "%d" (math-day-number math-fd-year math-fd-month math-fd-day)))
 	((eq x 'ddd)
-	 (format "%03d" (math-day-number year month day)))
+	 (format "%03d" (math-day-number math-fd-year math-fd-month math-fd-day)))
 	((eq x 'bdd)
-	 (format "%3d" (math-day-number year month day)))
+	 (format "%3d" (math-day-number math-fd-year math-fd-month math-fd-day)))
 	((eq x 'h)
-	 (and hour (format "%d" hour)))
+	 (and math-fd-hour (format "%d" math-fd-hour)))
 	((eq x 'hh)
-	 (and hour (format "%02d" hour)))
+	 (and math-fd-hour (format "%02d" math-fd-hour)))
 	((eq x 'bh)
-	 (and hour (format "%2d" hour)))
+	 (and math-fd-hour (format "%2d" math-fd-hour)))
 	((eq x 'H)
-	 (and hour (format "%d" (1+ (% (+ hour 11) 12)))))
+	 (and math-fd-hour (format "%d" (1+ (% (+ math-fd-hour 11) 12)))))
 	((eq x 'HH)
-	 (and hour (format "%02d" (1+ (% (+ hour 11) 12)))))
+	 (and math-fd-hour (format "%02d" (1+ (% (+ math-fd-hour 11) 12)))))
 	((eq x 'BH)
-	 (and hour (format "%2d" (1+ (% (+ hour 11) 12)))))
+	 (and math-fd-hour (format "%2d" (1+ (% (+ math-fd-hour 11) 12)))))
 	((eq x 'p)
-	 (and hour (if (< hour 12) "a" "p")))
+	 (and math-fd-hour (if (< math-fd-hour 12) "a" "p")))
 	((eq x 'P)
-	 (and hour (if (< hour 12) "A" "P")))
+	 (and math-fd-hour (if (< math-fd-hour 12) "A" "P")))
 	((eq x 'pp)
-	 (and hour (if (< hour 12) "am" "pm")))
+	 (and math-fd-hour (if (< math-fd-hour 12) "am" "pm")))
 	((eq x 'PP)
-	 (and hour (if (< hour 12) "AM" "PM")))
+	 (and math-fd-hour (if (< math-fd-hour 12) "AM" "PM")))
 	((eq x 'pppp)
-	 (and hour (if (< hour 12) "a.m." "p.m.")))
+	 (and math-fd-hour (if (< math-fd-hour 12) "a.m." "p.m.")))
 	((eq x 'PPPP)
-	 (and hour (if (< hour 12) "A.M." "P.M.")))
+	 (and math-fd-hour (if (< math-fd-hour 12) "A.M." "P.M.")))
 	((eq x 'm)
-	 (and minute (format "%d" minute)))
+	 (and math-fd-minute (format "%d" math-fd-minute)))
 	((eq x 'mm)
-	 (and minute (format "%02d" minute)))
+	 (and math-fd-minute (format "%02d" math-fd-minute)))
 	((eq x 'bm)
-	 (and minute (format "%2d" minute)))
+	 (and math-fd-minute (format "%2d" math-fd-minute)))
 	((eq x 'C)
-	 (and second (not (math-zerop second))
+	 (and math-fd-second (not (math-zerop math-fd-second))
 	      ":"))
 	((memq x '(s ss bs SS BS))
-	 (and second
-	      (not (and (memq x '(SS BS)) (math-zerop second)))
-	      (if (integerp second)
+	 (and math-fd-second
+	      (not (and (memq x '(SS BS)) (math-zerop math-fd-second)))
+	      (if (integerp math-fd-second)
 		  (format (cond ((memq x '(ss SS)) "%02d")
 				((memq x '(bs BS)) "%2d")
 				(t "%d"))
-			  second)
-		(concat (if (Math-lessp second 10)
+			  math-fd-second)
+		(concat (if (Math-lessp math-fd-second 10)
 			    (cond ((memq x '(ss SS)) "0")
 				  ((memq x '(bs BS)) " ")
 				  (t ""))
@@ -692,29 +707,33 @@
 			(let ((calc-float-format
 			       (list 'fix (min (- 12 calc-internal-prec)
 					       0))))
-			  (math-format-number second))))))))
+			  (math-format-number math-fd-second))))))))
 
+;; The variable math-pd-str is local to math-parse-date and
+;; math-parse-standard-date, but is used by math-parse-date-word,
+;; which is called by math-parse-date and math-parse-standard-date.
+(defvar math-pd-str)
 
-(defun math-parse-date (str)
+(defun math-parse-date (math-pd-str)
   (catch 'syntax
-    (or (math-parse-standard-date str t)
-	(math-parse-standard-date str nil)
-	(and (string-match "\\`[^-+/0-9a-zA-Z]*\\([-+]?[0-9]+\\.?[0-9]*\\([eE][-+]?[0-9]+\\)?\\)[^-+/0-9a-zA-Z]*\\'" str)
-	     (list 'date (math-read-number (math-match-substring str 1))))
+    (or (math-parse-standard-date math-pd-str t)
+	(math-parse-standard-date math-pd-str nil)
+	(and (string-match "\\`[^-+/0-9a-zA-Z]*\\([-+]?[0-9]+\\.?[0-9]*\\([eE][-+]?[0-9]+\\)?\\)[^-+/0-9a-zA-Z]*\\'" math-pd-str)
+	     (list 'date (math-read-number (math-match-substring math-pd-str 1))))
 	(let ((case-fold-search t)
 	      (year nil) (month nil) (day nil) (weekday nil)
 	      (hour nil) (minute nil) (second nil) (bc-flag nil)
 	      (a nil) (b nil) (c nil) (bigyear nil) temp)
 
 	  ;; Extract the time, if any.
-	  (if (or (string-match "\\([0-9][0-9]?\\):\\([0-9][0-9]?\\)\\(:\\([0-9][0-9]?\\(\\.[0-9]+\\)?\\)\\)? *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)?" str)
-		  (string-match "\\([0-9][0-9]?\\)\\(\\)\\(\\(\\(\\)\\)\\) *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)" str))
-	      (let ((ampm (math-match-substring str 6)))
-		(setq hour (string-to-int (math-match-substring str 1))
-		      minute (math-match-substring str 2)
-		      second (math-match-substring str 4)
-		      str (concat (substring str 0 (match-beginning 0))
-				  (substring str (match-end 0))))
+	  (if (or (string-match "\\([0-9][0-9]?\\):\\([0-9][0-9]?\\)\\(:\\([0-9][0-9]?\\(\\.[0-9]+\\)?\\)\\)? *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)?" math-pd-str)
+		  (string-match "\\([0-9][0-9]?\\)\\(\\)\\(\\(\\(\\)\\)\\) *\\([ap]m?\\|[ap]\\. *m\\.\\|noon\\|n\\>\\|midnight\\|mid\\>\\|m\\>\\)" math-pd-str))
+	      (let ((ampm (math-match-substring math-pd-str 6)))
+		(setq hour (string-to-int (math-match-substring math-pd-str 1))
+		      minute (math-match-substring math-pd-str 2)
+		      second (math-match-substring math-pd-str 4)
+		      math-pd-str (concat (substring math-pd-str 0 (match-beginning 0))
+				  (substring math-pd-str (match-end 0))))
 		(if (equal minute "")
 		    (setq minute 0)
 		  (setq minute (string-to-int minute)))
@@ -736,13 +755,13 @@
 			(setq hour (% (+ hour 12) 24)))))))
 
 	  ;; Rewrite xx-yy-zz to xx/yy/zz to avoid seeing "-" as a minus sign.
-	  (while (string-match "[0-9a-zA-Z]\\(-\\)[0-9a-zA-Z]" str)
+	  (while (string-match "[0-9a-zA-Z]\\(-\\)[0-9a-zA-Z]" math-pd-str)
 	    (progn
-	      (setq str (copy-sequence str))
-	      (aset str (match-beginning 1) ?\/)))
+	      (setq math-pd-str (copy-sequence math-pd-str))
+	      (aset math-pd-str (match-beginning 1) ?\/)))
 
 	  ;; Extract obvious month or weekday names.
-	  (if (string-match "[a-zA-Z]" str)
+	  (if (string-match "[a-zA-Z]" math-pd-str)
 	      (progn
 		(setq month (math-parse-date-word math-long-month-names))
 		(setq weekday (math-parse-date-word math-long-weekday-names))
@@ -756,31 +775,32 @@
 		(or (math-parse-date-word '( "ad" "a.d." ))
 		    (if (math-parse-date-word '( "bc" "b.c." ))
 			(setq bc-flag t)))
-		(if (string-match "[a-zA-Z]+" str)
+		(if (string-match "[a-zA-Z]+" math-pd-str)
 		    (throw 'syntax (format "Bad word in date: \"%s\""
-					   (math-match-substring str 0))))))
+					   (math-match-substring math-pd-str 0))))))
 
 	  ;; If there is a huge number other than the year, ignore it.
-	  (while (and (string-match "[-+]?0*[1-9][0-9][0-9][0-9][0-9]+" str)
-		      (setq temp (concat (substring str 0 (match-beginning 0))
-					 (substring str (match-end 0))))
-		      (string-match "[4-9][0-9]\\|[0-9][0-9][0-9]\\|[-+][0-9]+[^-]*\\'" temp))
-	    (setq str temp))
+	  (while (and (string-match "[-+]?0*[1-9][0-9][0-9][0-9][0-9]+" math-pd-str)
+		      (setq temp (concat (substring math-pd-str 0 (match-beginning 0))
+					 (substring math-pd-str (match-end 0))))
+		      (string-match 
+                       "[4-9][0-9]\\|[0-9][0-9][0-9]\\|[-+][0-9]+[^-]*\\'" temp))
+	    (setq math-pd-str temp))
 
 	  ;; If there is a number with a sign or a large number, it is a year.
-	  (if (or (string-match "\\([-+][0-9]+\\)[^-]*\\'" str)
-		  (string-match "\\(0*[1-9][0-9][0-9]+\\)" str))
-	      (setq year (math-match-substring str 1)
-		    str (concat (substring str 0 (match-beginning 1))
-				(substring str (match-end 1)))
+	  (if (or (string-match "\\([-+][0-9]+\\)[^-]*\\'" math-pd-str)
+		  (string-match "\\(0*[1-9][0-9][0-9]+\\)" math-pd-str))
+	      (setq year (math-match-substring math-pd-str 1)
+		    math-pd-str (concat (substring math-pd-str 0 (match-beginning 1))
+				(substring math-pd-str (match-end 1)))
 		    year (math-read-number year)
 		    bigyear t))
 
 	  ;; Collect remaining numbers.
 	  (setq temp 0)
-	  (while (string-match "[0-9]+" str temp)
+	  (while (string-match "[0-9]+" math-pd-str temp)
 	    (and c (throw 'syntax "Too many numbers in date"))
-	    (setq c (string-to-int (math-match-substring str 0)))
+	    (setq c (string-to-int (math-match-substring math-pd-str 0)))
 	    (or b (setq b c c nil))
 	    (or a (setq a b b nil))
 	    (setq temp (match-end 0)))
@@ -867,18 +887,18 @@
     (while (and names (not (string-match (if (equal (car names) "Sep")
 					     "Sept?"
 					   (regexp-quote (car names)))
-					 str)))
+					 math-pd-str)))
       (setq names (cdr names)
 	    n (1+ n)))
     (and names
 	 (or (not front) (= (match-beginning 0) 0))
 	 (progn
-	   (setq str (concat (substring str 0 (match-beginning 0))
+	   (setq math-pd-str (concat (substring math-pd-str 0 (match-beginning 0))
 			     (if front "" " ")
-			     (substring str (match-end 0))))
+			     (substring math-pd-str (match-end 0))))
 	   n))))
 
-(defun math-parse-standard-date (str with-time)
+(defun math-parse-standard-date (math-pd-str with-time)
   (let ((case-fold-search t)
 	(okay t) num
 	(fmt calc-date-format) this next (gnext nil)
@@ -898,16 +918,16 @@
 		     (setq gnext fmt
 			   fmt this)))
 		((stringp this)
-		 (if (and (<= (length this) (length str))
+		 (if (and (<= (length this) (length math-pd-str))
 			  (equal this
-				 (substring str 0 (length this))))
-		     (setq str (substring str (length this)))))
+				 (substring math-pd-str 0 (length this))))
+		     (setq math-pd-str (substring math-pd-str (length this)))))
 		((eq this 'X)
 		 t)
 		((memq this '(n N j J))
-		 (and (string-match "\\`[-+]?[0-9.]+\\([eE][-+]?[0-9]+\\)?" str)
-		      (setq num (math-match-substring str 0)
-			    str (substring str (match-end 0))
+		 (and (string-match "\\`[-+]?[0-9.]+\\([eE][-+]?[0-9]+\\)?" math-pd-str)
+		      (setq num (math-match-substring math-pd-str 0)
+			    math-pd-str (substring math-pd-str (match-end 0))
 			    num (math-date-to-dt (math-read-number num))
 			    num (math-sub num
 					  (if (memq this '(n N))
@@ -924,9 +944,9 @@
 			    month (nth 1 num)
 			    day (nth 2 num))))
 		((eq this 'U)
-		 (and (string-match "\\`[-+]?[0-9]+" str)
-		      (setq num (math-match-substring str 0)
-			    str (substring str (match-end 0))
+		 (and (string-match "\\`[-+]?[0-9]+" math-pd-str)
+		      (setq num (math-match-substring math-pd-str 0)
+			    math-pd-str (substring math-pd-str (match-end 0))
 			    num (math-date-to-dt
 				 (math-add 719164
 					   (math-div (math-read-number num)
@@ -946,63 +966,63 @@
 		((memq this '(Wwww WWWW))
 		 (math-parse-date-word math-long-weekday-names t))
 		((memq this '(p P))
-		 (if (string-match "\\`a" str)
+		 (if (string-match "\\`a" math-pd-str)
 		     (setq hour (if (= hour 12) 0 hour)
-			   str (substring str 1))
-		   (if (string-match "\\`p" str)
+			   math-pd-str (substring math-pd-str 1))
+		   (if (string-match "\\`p" math-pd-str)
 		       (setq hour (if (= hour 12) 12 (% (+ hour 12) 24))
-			     str (substring str 1)))))
+			     math-pd-str (substring math-pd-str 1)))))
 		((memq this '(pp PP pppp PPPP))
-		 (if (string-match "\\`am\\|a\\.m\\." str)
+		 (if (string-match "\\`am\\|a\\.m\\." math-pd-str)
 		     (setq hour (if (= hour 12) 0 hour)
-			   str (substring str (match-end 0)))
-		   (if (string-match "\\`pm\\|p\\.m\\." str)
+			   math-pd-str (substring math-pd-str (match-end 0)))
+		   (if (string-match "\\`pm\\|p\\.m\\." math-pd-str)
 		       (setq hour (if (= hour 12) 12 (% (+ hour 12) 24))
-			     str (substring str (match-end 0))))))
+			     math-pd-str (substring math-pd-str (match-end 0))))))
 		((memq this '(Y YY BY YYY YYYY))
 		 (and (if (memq next '(MM DD ddd hh HH mm ss SS))
 			  (if (memq this '(Y YY BYY))
-			      (string-match "\\` *[0-9][0-9]" str)
-			    (string-match "\\`[0-9][0-9][0-9][0-9]" str))
-			(string-match "\\`[-+]?[0-9]+" str))
-		      (setq year (math-match-substring str 0)
+			      (string-match "\\` *[0-9][0-9]" math-pd-str)
+			    (string-match "\\`[0-9][0-9][0-9][0-9]" math-pd-str))
+			(string-match "\\`[-+]?[0-9]+" math-pd-str))
+		      (setq year (math-match-substring math-pd-str 0)
 			    bigyear (or (eq this 'YYY)
-					(memq (aref str 0) '(?\+ ?\-)))
-			    str (substring str (match-end 0))
+					(memq (aref math-pd-str 0) '(?\+ ?\-)))
+			    math-pd-str (substring math-pd-str (match-end 0))
 			    year (math-read-number year))))
 		((eq this 'b)
 		 t)
 		((memq this '(aa AA aaaa AAAA))
-		 (if (string-match "\\` *\\(ad\\|a\\.d\\.\\)" str)
-		     (setq str (substring str (match-end 0)))))
+		 (if (string-match "\\` *\\(ad\\|a\\.d\\.\\)" math-pd-str)
+		     (setq math-pd-str (substring math-pd-str (match-end 0)))))
 		((memq this '(aaa AAA))
-		 (if (string-match "\\` *ad *" str)
-		     (setq str (substring str (match-end 0)))))
+		 (if (string-match "\\` *ad *" math-pd-str)
+		     (setq math-pd-str (substring math-pd-str (match-end 0)))))
 		((memq this '(bb BB bbb BBB bbbb BBBB))
-		 (if (string-match "\\` *\\(bc\\|b\\.c\\.\\)" str)
-		     (setq str (substring str (match-end 0))
+		 (if (string-match "\\` *\\(bc\\|b\\.c\\.\\)" math-pd-str)
+		     (setq math-pd-str (substring math-pd-str (match-end 0))
 			   bc-flag t)))
 		((memq this '(s ss bs SS BS))
 		 (and (if (memq next '(YY YYYY MM DD hh HH mm))
-			  (string-match "\\` *[0-9][0-9]\\(\\.[0-9]+\\)?" str)
-			(string-match "\\` *[0-9][0-9]?\\(\\.[0-9]+\\)?" str))
-		      (setq second (math-match-substring str 0)
-			    str (substring str (match-end 0))
+			  (string-match "\\` *[0-9][0-9]\\(\\.[0-9]+\\)?" math-pd-str)
+			(string-match "\\` *[0-9][0-9]?\\(\\.[0-9]+\\)?" math-pd-str))
+		      (setq second (math-match-substring math-pd-str 0)
+			    math-pd-str (substring math-pd-str (match-end 0))
 			    second (math-read-number second))))
 		((eq this 'C)
-		 (if (string-match "\\`:[0-9][0-9]" str)
-		     (setq str (substring str 1))
+		 (if (string-match "\\`:[0-9][0-9]" math-pd-str)
+		     (setq math-pd-str (substring math-pd-str 1))
 		   t))
 		((or (not (if (and (memq this '(ddd MM DD hh HH mm))
 				   (memq next '(YY YYYY MM DD ddd
 						   hh HH mm ss SS)))
 			      (if (eq this 'ddd)
-				  (string-match "\\` *[0-9][0-9][0-9]" str)
-				(string-match "\\` *[0-9][0-9]" str))
-			    (string-match "\\` *[0-9]+" str)))
+				  (string-match "\\` *[0-9][0-9][0-9]" math-pd-str)
+				(string-match "\\` *[0-9][0-9]" math-pd-str))
+			    (string-match "\\` *[0-9]+" math-pd-str)))
 		     (and (setq num (string-to-int
-				     (math-match-substring str 0))
-				str (substring str (match-end 0)))
+				     (math-match-substring math-pd-str 0))
+				math-pd-str (substring math-pd-str (match-end 0)))
 			  nil))
 		 nil)
 		((eq this 'W)
@@ -1022,7 +1042,7 @@
 	(if (and month day)
 	    (setq yearday nil)
 	  (setq month 1 day 1)))
-    (if (and okay (equal str ""))
+    (if (and okay (equal math-pd-str ""))
 	(and month day (or (not (or hour minute second))
 			   (and hour minute))
 	     (progn
@@ -1148,6 +1168,30 @@
 		  (calcFunc-tzone zone date))
       (math-reject-arg date 'datep))))
 
+
+;;; Note: Longer names must appear before shorter names which are
+;;;       substrings of them.
+(defvar math-tzone-names
+  '(( "UTC" 0 0) 
+    ( "MEGT" -1 "MET" "METDST" )                          ; Middle Europe
+    ( "METDST" -1 -1 ) ( "MET" -1 0 )
+    ( "MEGZ" -1 "MEZ" "MESZ" ) ( "MEZ" -1 0 ) ( "MESZ" -1 -1 )
+    ( "WEGT" 0 "WET" "WETDST" )                           ; Western Europe
+    ( "WETDST" 0 -1 ) ( "WET" 0 0 )
+    ( "BGT" 0 "GMT" "BST" ) ( "GMT" 0 0 ) ( "BST" 0 -1 )  ; Britain
+    ( "NGT" (float 35 -1) "NST" "NDT" )                   ; Newfoundland
+    ( "NST" (float 35 -1) 0 ) ( "NDT" (float 35 -1) -1 )
+    ( "AGT" 4 "AST" "ADT" ) ( "AST" 4 0 ) ( "ADT" 4 -1 )  ; Atlantic
+    ( "EGT" 5 "EST" "EDT" ) ( "EST" 5 0 ) ( "EDT" 5 -1 )  ; Eastern
+    ( "CGT" 6 "CST" "CDT" ) ( "CST" 6 0 ) ( "CDT" 6 -1 )  ; Central
+    ( "MGT" 7 "MST" "MDT" ) ( "MST" 7 0 ) ( "MDT" 7 -1 )  ; Mountain
+    ( "PGT" 8 "PST" "PDT" ) ( "PST" 8 0 ) ( "PDT" 8 -1 )  ; Pacific
+    ( "YGT" 9 "YST" "YDT" ) ( "YST" 9 0 ) ( "YDT" 9 -1 )  ; Yukon
+    )
+  "No doc yet.  See calc manual for now. ")
+
+(defvar var-TimeZone)
+
 (defun calcFunc-tzone (&optional zone date)
   (if zone
       (cond ((math-realp zone)
@@ -1226,27 +1270,7 @@
 	(calc-refresh-evaltos 'var-TimeZone)
 	(calcFunc-tzone tz date)))))
 
-;;; Note: Longer names must appear before shorter names which are
-;;;       substrings of them.
-(defvar math-tzone-names
-  '(( "UTC" 0 0) 
-    ( "MEGT" -1 "MET" "METDST" )                          ; Middle Europe
-    ( "METDST" -1 -1 ) ( "MET" -1 0 )
-    ( "MEGZ" -1 "MEZ" "MESZ" ) ( "MEZ" -1 0 ) ( "MESZ" -1 -1 )
-    ( "WEGT" 0 "WET" "WETDST" )                           ; Western Europe
-    ( "WETDST" 0 -1 ) ( "WET" 0 0 )
-    ( "BGT" 0 "GMT" "BST" ) ( "GMT" 0 0 ) ( "BST" 0 -1 )  ; Britain
-    ( "NGT" (float 35 -1) "NST" "NDT" )                   ; Newfoundland
-    ( "NST" (float 35 -1) 0 ) ( "NDT" (float 35 -1) -1 )
-    ( "AGT" 4 "AST" "ADT" ) ( "AST" 4 0 ) ( "ADT" 4 -1 )  ; Atlantic
-    ( "EGT" 5 "EST" "EDT" ) ( "EST" 5 0 ) ( "EDT" 5 -1 )  ; Eastern
-    ( "CGT" 6 "CST" "CDT" ) ( "CST" 6 0 ) ( "CDT" 6 -1 )  ; Central
-    ( "MGT" 7 "MST" "MDT" ) ( "MST" 7 0 ) ( "MDT" 7 -1 )  ; Mountain
-    ( "PGT" 8 "PST" "PDT" ) ( "PST" 8 0 ) ( "PDT" 8 -1 )  ; Pacific
-    ( "YGT" 9 "YST" "YDT" ) ( "YST" 9 0 ) ( "YDT" 9 -1 )  ; Yukon
-    )
-  "No doc yet.  See calc manual for now. ")
-
+(defvar math-daylight-savings-hook 'math-std-daylight-savings)
 
 (defun math-daylight-savings-adjust (date zone &optional dt)
   (or date (setq date (nth 1 (calcFunc-now))))
@@ -1286,8 +1310,6 @@
       (nth 1 (calcFunc-tzconv (list 'date date) z1 z2))
     (calcFunc-unixtime (calcFunc-unixtime date z1) z2)))
 
-(defvar math-daylight-savings-hook 'math-std-daylight-savings)
-
 (defun math-std-daylight-savings (date dt zone bump)
   "Standard North American daylight savings algorithm.
 This implements the rules for the U.S. and Canada as of 1987.
@@ -1507,6 +1529,10 @@
       (and (not (math-setup-holidays day))
 	   (list 'date (math-add day time))))))
 
+;; The variable math-sh-year is local to math-setup-holidays
+;; and math-setup-year-holiday, but is used by math-setup-add-holidays,
+;; which is called by math-setup-holidays and math-setup-year-holiday.
+(defvar math-sh-year)
 
 (defun math-setup-holidays (&optional date)
   (or (eq (calc-var-value 'var-Holidays) math-holidays-cache-tag)
@@ -1581,7 +1607,7 @@
 	(unwind-protect
 	    (let ((days (nth 6 math-holidays-cache)))
 	      (if days
-		  (let ((year nil))   ; see below
+		  (let ((math-sh-year nil))   ; see below
 		    (setcar (nthcdr 6 math-holidays-cache) nil)
 		    (math-setup-add-holidays (cons 'vec (cdr days)))
 		    (setcar (nthcdr 2 math-holidays-cache) (car days))))
@@ -1613,10 +1639,10 @@
 		     nil)))
 	  (or done (setq math-holidays-cache-tag t))))))
 
-(defun math-setup-year-holidays (year)
+(defun math-setup-year-holidays (math-sh-year)
   (let ((exprs (nth 2 math-holidays-cache)))
     (while exprs
-      (let* ((var-y year)
+      (let* ((var-y math-sh-year)
 	     (var-m nil)
 	     (expr (math-evaluate-expr (car exprs))))
 	(if (math-expr-contains expr '(var m var-m))
@@ -1626,7 +1652,7 @@
 	  (math-setup-add-holidays expr)))
       (setq exprs (cdr exprs)))))
 
-(defun math-setup-add-holidays (days)   ; uses "year"
+(defun math-setup-add-holidays (days)   ; uses "math-sh-year"
   (cond ((eq (car-safe days) 'vec)
 	 (while (setq days (cdr days))
 	   (math-setup-add-holidays (car days))))
@@ -1641,7 +1667,7 @@
 	 (math-setup-add-holidays (nth 1 days)))
 	((eq days 0))
 	((integerp days)
-	 (let ((b (math-to-business-day days year)))
+	 (let ((b (math-to-business-day days math-sh-year)))
 	   (or (cdr b)   ; don't register holidays twice!
 	       (let ((prev (car math-holidays-cache))
 		     (iprev (nth 1 math-holidays-cache)))
@@ -1789,6 +1815,12 @@
 	  (t
 	   (math-make-intv 2 0 b)))))
 
+;; The variables math-exp-str and math-exp-pos are local to
+;; math-read-exprs in math-aent.el, but are used by 
+;; math-read-angle-brackets, which is called (indirectly) by
+;; math-read-exprs.
+(defvar math-exp-str)
+(defvar math-exp-pos)
 
 (defun math-read-angle-brackets ()
   (let* ((last (or (math-check-for-commas t) (length math-exp-str)))
@@ -1822,5 +1854,7 @@
     (math-read-token)
     res))
 
+(provide 'calc-forms)
+
 ;;; arch-tag: a3d8f33b-9508-4043-8060-d02b8c9c750c
 ;;; calc-forms.el ends here
--- a/lisp/calc/calc-frac.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-frac.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,12 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-frac () nil)
-
 (defun calc-fdiv (arg)
   (interactive "P")
   (calc-slow-wrapper
@@ -220,5 +217,7 @@
 	(math-reject-arg b 'integerp))
     (math-reject-arg a 'integerp)))
 
+(provide 'calc-frac)
+
 ;;; arch-tag: 89d65274-0b3b-42d8-aacd-eaf86da5b4ea
 ;;; calc-frac.el ends here
--- a/lisp/calc/calc-funcs.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-funcs.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-funcs () nil)
-
-
 (defun calc-inc-gamma (arg)
   (interactive "P")
   (calc-slow-wrapper
@@ -972,6 +968,7 @@
   (math-sub 1 (calcFunc-utpt tt v)))
 (put 'calcFunc-ltpt 'math-expandable t)
 
+(provide 'calc-funcs)
 
 ;;; arch-tag: 421ddb7a-550f-4dda-a31c-06638ebfc43a
 ;;; calc-funcs.el ends here
--- a/lisp/calc/calc-graph.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-graph.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,30 +27,35 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-graph () nil)
-
-
 ;;; Graphics
 
-;;; Note that some of the following initial values also occur in calc.el.
+(defvar calc-gnuplot-name "gnuplot"
+  "*Name of GNUPLOT program, for calc-graph features.")
+
+(defvar calc-gnuplot-plot-command nil
+  "*Name of command for displaying GNUPLOT output; %s = file name to print.")
+
+(defvar calc-gnuplot-print-command "lp %s"
+  "*Name of command for printing GNUPLOT output; %s = file name to print.")
+
 (defvar calc-gnuplot-tempfile "calc")
 
-(defvar calc-gnuplot-default-device "default")
-(defvar calc-gnuplot-default-output "STDOUT")
-(defvar calc-gnuplot-print-device "postscript")
-(defvar calc-gnuplot-print-output "auto")
+(defvar calc-gnuplot-default-device)
+(defvar calc-gnuplot-default-output)
+(defvar calc-gnuplot-print-device)
+(defvar calc-gnuplot-print-output)
 (defvar calc-gnuplot-keep-outfile nil)
 (defvar calc-gnuplot-version nil)
 
 (defvar calc-gnuplot-display (getenv "DISPLAY"))
-(defvar calc-gnuplot-geometry nil)
+(defvar calc-gnuplot-geometry)
 
-(defvar calc-graph-default-resolution 15)
-(defvar calc-graph-default-resolution-3d 5)
+(defvar calc-graph-default-resolution)
+(defvar calc-graph-default-resolution-3d)
 (defvar calc-graph-default-precision 5)
 
 (defvar calc-gnuplot-buffer nil)
@@ -1473,5 +1477,7 @@
 	    (goto-char (point-max))
 	    (insert "\n"))))))
 
+(provide 'calc-graph)
+
 ;;; arch-tag: e4b06a52-c386-4d54-a2bb-7c0a0ef533c2
 ;;; calc-graph.el ends here
--- a/lisp/calc/calc-help.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-help.el	Wed Dec 08 22:20:27 2004 +0000
@@ -4,8 +4,7 @@
 ;;           Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -29,13 +28,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-help () nil)
-
-
 (defun calc-help-prefix (arg)
   "This key is the prefix for Calc help functions.  See calc-help-for-help."
   (interactive "P")
@@ -139,6 +135,8 @@
   (interactive "kDescribe key briefly: ")
   (calc-describe-key key t))
 
+(defvar Info-history)
+
 (defun calc-describe-key (key &optional briefly)
   (interactive "kDescribe key: ")
   (let ((defn (if (eq (key-binding key) 'calc-dispatch)
@@ -157,7 +155,8 @@
 		      (lookup-key calc-help-map key2))
 		  (key-binding key))))
 	(inv nil)
-	(hyp nil))
+	(hyp nil)
+        calc-summary-indentation)
     (while (or (equal key "I") (equal key "H"))
       (if (equal key "I")
 	  (setq inv (not inv))
@@ -187,11 +186,12 @@
 				 (copy-to-buffer "*Calc Summary*"
 						 (point) (point-max))
                                  (if Info-history
-                                     (Info-last))))
-			     (setq case-fold-search nil)
-			     (re-search-forward "^\\(.*\\)\\[\\.\\. a b")
-			     (setq calc-summary-indentation
-				   (- (match-end 1) (match-beginning 1)))))
+                                     (Info-last))))))
+                       (goto-char (point-min))
+                       (setq case-fold-search nil)
+                       (re-search-forward "^\\(.*\\)\\[\\.\\. a b")
+                       (setq calc-summary-indentation
+                             (- (match-end 1) (match-beginning 1)))
 		       (goto-char (point-min))
 		       (setq target (if (and (string-match "[0-9]\\'" desc)
 					     (not (string-match "[d#]" desc)))
@@ -400,6 +400,12 @@
     (delete-region (point-min) (point))
     (goto-char (point-min))))
 
+(defvar calc-help-long-names '((?b . "binary/business")
+			       (?g . "graphics")
+			       (?j . "selection")
+			       (?k . "combinatorics/statistics")
+			       (?u . "units/statistics")))
+
 (defun calc-full-help ()
   (interactive)
   (with-output-to-temp-buffer "*Help*"
@@ -456,12 +462,6 @@
 		calc-z-prefix-help)))
     (print-help-return-message)))
 
-(defvar calc-help-long-names '((?b . "binary/business")
-			       (?g . "graphics")
-			       (?j . "selection")
-			       (?k . "combinatorics/statistics")
-			       (?u . "units/statistics")))
-
 (defun calc-h-prefix-help ()
   (interactive)
   (calc-do-prefix-help
@@ -674,5 +674,7 @@
      "} (matrix brackets); . (abbreviate); / (multi-lines)")
    "vec/mat" ?v))
 
+(provide 'calc-help)
+
 ;; arch-tag: 2d347593-7591-449e-a64a-93dab5f2f686
 ;;; calc-help.el ends here
--- a/lisp/calc/calc-incom.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-incom.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-incom () nil)
-
-
 ;;; Incomplete forms.
 
 (defun calc-begin-complex ()
@@ -172,6 +168,12 @@
 				   (cons 'vec (append (cdr (cdr inc)) stuff)))
 			     (list 'incomplete 'vec))))))))
 
+;; The following variables are initially declared in calc.el,
+;; but are used by calc-digit-dots.
+(defvar calc-prev-char)
+(defvar calc-prev-prev-char)
+(defvar calc-digit-value)
+
 (defun calc-digit-dots ()
   (if (eq calc-prev-char ?.)
       (progn
@@ -227,5 +229,7 @@
 	 (error "Interval form is incomplete"))
 	(t (error "Object is incomplete"))))
 
+(provide 'calc-incom)
+
 ;;; arch-tag: b8001270-4dc7-481b-a3e3-a952e19b390d
 ;;; calc-incom.el ends here
--- a/lisp/calc/calc-keypd.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-keypd.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -27,15 +26,11 @@
 
 ;;; Code:
 
-
 ;; This file is autoloaded from calc-ext.el.
-(require 'calc-ext)
 
+(require 'calc-ext)
 (require 'calc-macs)
 
-(defun calc-Need-calc-keypd () nil)
-
-
 (defvar calc-keypad-buffer nil)
 (defvar calc-keypad-menu 0)
 (defvar calc-keypad-full-layout nil)
@@ -612,6 +607,7 @@
 	(command-execute cmd)
       (error "Not a Calc command: %s" (key-description keys)))))
 
+(provide 'calc-keypd)
 
 ;;; arch-tag: 4ba0d360-2bb6-40b8-adfa-eb373765b3f9
 ;;; calc-keypd.el ends here
--- a/lisp/calc/calc-lang.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-lang.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -27,15 +26,11 @@
 
 ;;; Code:
 
-
 ;; This file is autoloaded from calc-ext.el.
-(require 'calc-ext)
 
+(require 'calc-ext)
 (require 'calc-macs)
 
-(defun calc-Need-calc-lang () nil)
-
-
 ;;; Alternate entry/display languages.
 
 (defun calc-set-language (lang &optional option no-refresh)
@@ -258,6 +253,13 @@
 (put 'fortran 'math-input-filter 'calc-input-case-filter)
 (put 'fortran 'math-output-filter 'calc-output-case-filter)
 
+;; The next few variables are local to math-read-exprs in calc-aent.el 
+;; and math-read-expr in calc-ext.el, but are set in functions they call.
+
+(defvar math-exp-token)
+(defvar math-expr-data)
+(defvar math-exp-old-pos)
+
 (defvar math-parsing-fortran-vector nil)
 (defun math-parse-fortran-vector (op)
   (let ((math-parsing-fortran-vector '(end . "\000")))
@@ -708,134 +710,168 @@
   (list 'intv 3 x (math-read-expr-level (nth 3 op))))
 
 
+;; The variable math-read-big-lines is local to math-read-big-expr in
+;; calc-ext.el, but is used by math-read-big-rec, math-read-big-char,
+;; math-read-big-emptyp, math-read-big-error and math-read-big-balance,
+;; which are called (directly and indirectly) by math-read-big-expr.
+;; It is also local to math-read-big-bigp in calc-ext.el, which calls
+;; math-read-big-balance.
+(defvar math-read-big-lines)
 
+;; The variables math-read-big-baseline and math-read-big-h2 are
+;; local to math-read-big-expr in calc-ext.el, but used by
+;; math-read-big-rec.
+(defvar math-read-big-baseline)
+(defvar math-read-big-h2)
 
+;; The variables math-rb-h1, math-rb-h2, math-rb-v1 and math-rb-v2 
+;; are local to math-read-big-rec, but are used by math-read-big-char, 
+;; math-read-big-emptyp and math-read-big-balance which are called by 
+;; math-read-big-rec.
+;; math-rb-h2 is also local to math-read-big-bigp in calc-ext.el,
+;; which calls math-read-big-balance.
+(defvar math-rb-h1)
+(defvar math-rb-h2)
+(defvar math-rb-v1)
+(defvar math-rb-v2)
 
-(defun math-read-big-rec (h1 v1 h2 v2 &optional baseline prec short)
+(defun math-read-big-rec (math-rb-h1 math-rb-v1 math-rb-h2 math-rb-v2 
+                                     &optional baseline prec short)
   (or prec (setq prec 0))
 
   ;; Clip whitespace above or below.
-  (while (and (< v1 v2) (math-read-big-emptyp h1 v1 h2 (1+ v1)))
-    (setq v1 (1+ v1)))
-  (while (and (< v1 v2) (math-read-big-emptyp h1 (1- v2) h2 v2))
-    (setq v2 (1- v2)))
+  (while (and (< math-rb-v1 math-rb-v2) 
+              (math-read-big-emptyp math-rb-h1 math-rb-v1 math-rb-h2 (1+ math-rb-v1)))
+    (setq math-rb-v1 (1+ math-rb-v1)))
+  (while (and (< math-rb-v1 math-rb-v2) 
+              (math-read-big-emptyp math-rb-h1 (1- math-rb-v2) math-rb-h2 math-rb-v2))
+    (setq math-rb-v2 (1- math-rb-v2)))
 
   ;; If formula is a single line high, normal parser can handle it.
-  (if (<= v2 (1+ v1))
-      (if (or (<= v2 v1)
-	      (> h1 (length (setq v2 (nth v1 lines)))))
-	  (math-read-big-error h1 v1)
-	(setq the-baseline v1
-	      the-h2 h2
-	      v2 (nth v1 lines)
-	      h2 (math-read-expr (substring v2 h1 (min h2 (length v2)))))
-	(if (eq (car-safe h2) 'error)
-	    (math-read-big-error (+ h1 (nth 1 h2)) v1 (nth 2 h2))
-	  h2))
+  (if (<= math-rb-v2 (1+ math-rb-v1))
+      (if (or (<= math-rb-v2 math-rb-v1)
+	      (> math-rb-h1 (length (setq math-rb-v2 
+                                          (nth math-rb-v1 math-read-big-lines)))))
+	  (math-read-big-error math-rb-h1 math-rb-v1)
+	(setq math-read-big-baseline math-rb-v1
+	      math-read-big-h2 math-rb-h2
+	      math-rb-v2 (nth math-rb-v1 math-read-big-lines)
+	      math-rb-h2 (math-read-expr 
+                          (substring math-rb-v2 math-rb-h1 
+                                     (min math-rb-h2 (length math-rb-v2)))))
+	(if (eq (car-safe math-rb-h2) 'error)
+	    (math-read-big-error (+ math-rb-h1 (nth 1 math-rb-h2)) 
+                                 math-rb-v1 (nth 2 math-rb-h2))
+	  math-rb-h2))
 
     ;; Clip whitespace at left or right.
-    (while (and (< h1 h2) (math-read-big-emptyp h1 v1 (1+ h1) v2))
-      (setq h1 (1+ h1)))
-    (while (and (< h1 h2) (math-read-big-emptyp (1- h2) v1 h2 v2))
-      (setq h2 (1- h2)))
+    (while (and (< math-rb-h1 math-rb-h2) 
+                (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) math-rb-v2))
+      (setq math-rb-h1 (1+ math-rb-h1)))
+    (while (and (< math-rb-h1 math-rb-h2) 
+                (math-read-big-emptyp (1- math-rb-h2) math-rb-v1 math-rb-h2 math-rb-v2))
+      (setq math-rb-h2 (1- math-rb-h2)))
 
     ;; Scan to find widest left-justified "----" in the region.
     (let* ((widest nil)
 	   (widest-h2 0)
-	   (lines-v1 (nthcdr v1 lines))
+	   (lines-v1 (nthcdr math-rb-v1 math-read-big-lines))
 	   (p lines-v1)
-	   (v v1)
+	   (v math-rb-v1)
 	   (other-v nil)
 	   other-char line len h)
-      (while (< v v2)
+      (while (< v math-rb-v2)
 	(setq line (car p)
-	      len (min h2 (length line)))
-	(and (< h1 len)
-	     (/= (aref line h1) ?\ )
-	     (if (and (= (aref line h1) ?\-)
+	      len (min math-rb-h2 (length line)))
+	(and (< math-rb-h1 len)
+	     (/= (aref line math-rb-h1) ?\ )
+	     (if (and (= (aref line math-rb-h1) ?\-)
 		      ;; Make sure it's not a minus sign.
-		      (or (and (< (1+ h1) len) (= (aref line (1+ h1)) ?\-))
-			  (/= (math-read-big-char h1 (1- v)) ?\ )
-			  (/= (math-read-big-char h1 (1+ v)) ?\ )))
+		      (or (and (< (1+ math-rb-h1) len) 
+                               (= (aref line (1+ math-rb-h1)) ?\-))
+			  (/= (math-read-big-char math-rb-h1 (1- v)) ?\ )
+			  (/= (math-read-big-char math-rb-h1 (1+ v)) ?\ )))
 		 (progn
-		   (setq h h1)
+		   (setq h math-rb-h1)
 		   (while (and (< (setq h (1+ h)) len)
 			       (= (aref line h) ?\-)))
 		   (if (> h widest-h2)
 		       (setq widest v
 			     widest-h2 h)))
-	       (or other-v (setq other-v v other-char (aref line h1)))))
+	       (or other-v (setq other-v v other-char (aref line math-rb-h1)))))
 	(setq v (1+ v)
 	      p (cdr p)))
 
       (cond ((not (setq v other-v))
-	     (math-read-big-error h1 v1))   ; Should never happen!
+	     (math-read-big-error math-rb-h1 math-rb-v1))   ; Should never happen!
 
 	    ;; Quotient.
 	    (widest
 	     (setq h widest-h2
 		   v widest)
-	     (let ((num (math-read-big-rec h1 v1 h v))
-		   (den (math-read-big-rec h1 (1+ v) h v2)))
+	     (let ((num (math-read-big-rec math-rb-h1 math-rb-v1 h v))
+		   (den (math-read-big-rec math-rb-h1 (1+ v) h math-rb-v2)))
 	       (setq p (if (and (math-integerp num) (math-integerp den))
 			   (math-make-frac num den)
 			 (list '/ num den)))))
 
 	    ;; Big radical sign.
 	    ((= other-char ?\\)
-	     (or (= (math-read-big-char (1+ h1) v) ?\|)
-		 (math-read-big-error (1+ h1) v "Malformed root sign"))
-	     (math-read-big-emptyp h1 v1 (1+ h1) v nil t)
-	     (while (= (math-read-big-char (1+ h1) (setq v (1- v))) ?\|))
-	     (or (= (math-read-big-char (setq h (+ h1 2)) v) ?\_)
+	     (or (= (math-read-big-char (1+ math-rb-h1) v) ?\|)
+		 (math-read-big-error (1+ math-rb-h1) v "Malformed root sign"))
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
+	     (while (= (math-read-big-char (1+ math-rb-h1) (setq v (1- v))) ?\|))
+	     (or (= (math-read-big-char (setq h (+ math-rb-h1 2)) v) ?\_)
 		 (math-read-big-error h v "Malformed root sign"))
 	     (while (= (math-read-big-char (setq h (1+ h)) v) ?\_))
-	     (math-read-big-emptyp h1 v1 (1+ h1) v nil t)
-	     (math-read-big-emptyp h1 (1+ other-v) h v2 nil t)
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
+	     (math-read-big-emptyp math-rb-h1 (1+ other-v) h math-rb-v2 nil t)
 	     (setq p (list 'calcFunc-sqrt (math-read-big-rec
-					   (+ h1 2) (1+ v)
+					   (+ math-rb-h1 2) (1+ v)
 					   h (1+ other-v) baseline))
-		   v the-baseline))
+		   v math-read-big-baseline))
 
 	    ;; Small radical sign.
 	    ((and (= other-char ?V)
-		  (= (math-read-big-char (1+ h1) (1- v)) ?\_))
-	     (setq h (1+ h1))
-	     (math-read-big-emptyp h1 v1 h (1- v) nil t)
-	     (math-read-big-emptyp h1 (1+ v) h v2 nil t)
-	     (math-read-big-emptyp h1 v1 (1+ h1) v nil t)
+		  (= (math-read-big-char (1+ math-rb-h1) (1- v)) ?\_))
+	     (setq h (1+ math-rb-h1))
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 h (1- v) nil t)
+	     (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
 	     (while (= (math-read-big-char (setq h (1+ h)) (1- v)) ?\_))
 	     (setq p (list 'calcFunc-sqrt (math-read-big-rec
-					   (1+ h1) v h (1+ v) t))
-		   v the-baseline))
+					   (1+ math-rb-h1) v h (1+ v) t))
+		   v math-read-big-baseline))
 
 	    ;; Binomial coefficient.
 	    ((and (= other-char ?\()
-		  (= (math-read-big-char (1+ h1) v) ?\ )
-		  (= (string-match "( *)" (nth v lines) h1) h1))
+		  (= (math-read-big-char (1+ math-rb-h1) v) ?\ )
+		  (= (string-match "( *)" (nth v math-read-big-lines) 
+                                   math-rb-h1) math-rb-h1))
 	     (setq h (match-end 0))
-	     (math-read-big-emptyp h1 v1 (1+ h1) v nil t)
-	     (math-read-big-emptyp h1 (1+ v) (1+ h1) v2 nil t)
-	     (math-read-big-emptyp (1- h) v1 h v nil t)
-	     (math-read-big-emptyp (1- h) (1+ v) h v2 nil t)
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
+	     (math-read-big-emptyp math-rb-h1 (1+ v) (1+ math-rb-h1) math-rb-v2 nil t)
+	     (math-read-big-emptyp (1- h) math-rb-v1 h v nil t)
+	     (math-read-big-emptyp (1- h) (1+ v) h math-rb-v2 nil t)
 	     (setq p (list 'calcFunc-choose
-			   (math-read-big-rec (1+ h1) v1 (1- h) v)
-			   (math-read-big-rec (1+ h1) (1+ v)
-					      (1- h) v2))))
+			   (math-read-big-rec (1+ math-rb-h1) math-rb-v1 (1- h) v)
+			   (math-read-big-rec (1+ math-rb-h1) (1+ v)
+					      (1- h) math-rb-v2))))
 
 	    ;; Minus sign.
 	    ((= other-char ?\-)
-	     (setq p (list 'neg (math-read-big-rec (1+ h1) v1 h2 v2 v 250 t))
-		   v the-baseline
-		   h the-h2))
+	     (setq p (list 'neg (math-read-big-rec (1+ math-rb-h1) math-rb-v1 
+                                                   math-rb-h2 math-rb-v2 v 250 t))
+		   v math-read-big-baseline
+		   h math-read-big-h2))
 
 	    ;; Parentheses.
 	    ((= other-char ?\()
-	     (math-read-big-emptyp h1 v1 (1+ h1) v nil t)
-	     (math-read-big-emptyp h1 (1+ v) (1+ h1) v2 nil t)
-	     (setq h (math-read-big-balance (1+ h1) v "(" t))
-	     (math-read-big-emptyp (1- h) v1 h v nil t)
-	     (math-read-big-emptyp (1- h) (1+ v) h v2 nil t)
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
+	     (math-read-big-emptyp math-rb-h1 (1+ v) (1+ math-rb-h1) math-rb-v2 nil t)
+	     (setq h (math-read-big-balance (1+ math-rb-h1) v "(" t))
+	     (math-read-big-emptyp (1- h) math-rb-v1 h v nil t)
+	     (math-read-big-emptyp (1- h) (1+ v) h math-rb-v2 nil t)
 	     (let ((sep (math-read-big-char (1- h) v))
 		   hmid)
 	       (if (= sep ?\.)
@@ -843,9 +879,11 @@
 	       (if (= sep ?\])
 		   (math-read-big-error (1- h) v "Expected `)'"))
 	       (if (= sep ?\))
-		   (setq p (math-read-big-rec (1+ h1) v1 (1- h) v2 v))
+		   (setq p (math-read-big-rec 
+                            (1+ math-rb-h1) math-rb-v1 (1- h) math-rb-v2 v))
 		 (setq hmid (math-read-big-balance h v "(")
-		       p (list p (math-read-big-rec h v1 (1- hmid) v2 v))
+		       p (list p 
+                               (math-read-big-rec h math-rb-v1 (1- hmid) math-rb-v2 v))
 		       h hmid)
 		 (cond ((= sep ?\.)
 			(setq p (cons 'intv (cons (if (= (math-read-big-char
@@ -858,22 +896,22 @@
 		       ((= sep ?\,)
 			(or (and (math-realp (car p)) (math-realp (nth 1 p)))
 			    (math-read-big-error
-			     h1 v "Complex components must be real"))
+			     math-rb-h1 v "Complex components must be real"))
 			(setq p (cons 'cplx p)))
 		       ((= sep ?\;)
 			(or (and (math-realp (car p)) (math-anglep (nth 1 p)))
 			    (math-read-big-error
-			     h1 v "Complex components must be real"))
+			     math-rb-h1 v "Complex components must be real"))
 			(setq p (cons 'polar p)))))))
 
 	    ;; Matrix.
 	    ((and (= other-char ?\[)
-		  (or (= (math-read-big-char (setq h h1) (1+ v)) ?\[)
+		  (or (= (math-read-big-char (setq h math-rb-h1) (1+ v)) ?\[)
 		      (= (math-read-big-char (setq h (1+ h)) v) ?\[)
 		      (and (= (math-read-big-char h v) ?\ )
 			   (= (math-read-big-char (setq h (1+ h)) v) ?\[)))
 		  (= (math-read-big-char h (1+ v)) ?\[))
-	     (math-read-big-emptyp h1 v1 h v nil t)
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
 	     (let ((vtop v)
 		   (hleft h)
 		   (hright nil))
@@ -889,7 +927,7 @@
 			(and (memq (math-read-big-char h v) '(?\  ?\,))
 			     (= (math-read-big-char hleft (1+ v)) ?\[)))
 		 (setq v (1+ v)))
-	       (or (= hleft h1)
+	       (or (= hleft math-rb-h1)
 		   (progn
 		     (if (= (math-read-big-char h v) ?\ )
 			 (setq h (1+ h)))
@@ -898,22 +936,22 @@
 		   (math-read-big-error (1- h) v "Expected `]'"))
 	       (if (= (math-read-big-char h vtop) ?\,)
 		   (setq h (1+ h)))
-	       (math-read-big-emptyp h1 (1+ v) (1- h) v2 nil t)
+	       (math-read-big-emptyp math-rb-h1 (1+ v) (1- h) math-rb-v2 nil t)
 	       (setq v (+ vtop (/ (- v vtop) 2))
 		     p (cons 'vec (nreverse p)))))
 
 	    ;; Square brackets.
 	    ((= other-char ?\[)
-	     (math-read-big-emptyp h1 v1 (1+ h1) v nil t)
-	     (math-read-big-emptyp h1 (1+ v) (1+ h1) v2 nil t)
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 (1+ math-rb-h1) v nil t)
+	     (math-read-big-emptyp math-rb-h1 (1+ v) (1+ math-rb-h1) math-rb-v2 nil t)
 	     (setq p nil
-		   h (1+ h1))
+		   h (1+ math-rb-h1))
 	     (while (progn
 		      (setq widest (math-read-big-balance h v "[" t))
-		      (math-read-big-emptyp (1- h) v1 h v nil t)
-		      (math-read-big-emptyp (1- h) (1+ v) h v2 nil t)
+		      (math-read-big-emptyp (1- h) math-rb-v1 h v nil t)
+		      (math-read-big-emptyp (1- h) (1+ v) h math-rb-v2 nil t)
 		      (setq p (cons (math-read-big-rec
-				     h v1 (1- widest) v2 v) p)
+				     h math-rb-v1 (1- widest) math-rb-v2 v) p)
 			    h widest)
 		      (= (math-read-big-char (1- h) v) ?\,)))
 	     (setq widest (math-read-big-char (1- h) v))
@@ -923,8 +961,8 @@
 	     (if (= widest ?\.)
 		 (setq h (1+ h)
 		       widest (math-read-big-balance h v "[")
-		       p (nconc p (list (math-read-big-big-rec
-					 h v1 (1- widest) v2 v)))
+		       p (nconc p (list (math-read-big-rec
+					 h math-rb-v1 (1- widest) math-rb-v2 v)))
 		       h widest
 		       p (cons 'intv (cons (if (= (math-read-big-char (1- h) v)
 						  ?\])
@@ -934,23 +972,23 @@
 
 	    ;; Date form.
 	    ((= other-char ?\<)
-	     (setq line (nth v lines))
-	     (string-match ">" line h1)
+	     (setq line (nth v math-read-big-lines))
+	     (string-match ">" line math-rb-h1)
 	     (setq h (match-end 0))
-	     (math-read-big-emptyp h1 v1 h v nil t)
-	     (math-read-big-emptyp h1 (1+ v) h v2 nil t)
-	     (setq p (math-read-big-rec h1 v h (1+ v) v)))
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
+	     (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)
+	     (setq p (math-read-big-rec math-rb-h1 v h (1+ v) v)))
 
 	    ;; Variable name or function call.
 	    ((or (and (>= other-char ?a) (<= other-char ?z))
 		 (and (>= other-char ?A) (<= other-char ?Z)))
-	     (setq line (nth v lines))
-	     (string-match "\\([a-zA-Z'_]+\\) *" line h1)
+	     (setq line (nth v math-read-big-lines))
+	     (string-match "\\([a-zA-Z'_]+\\) *" line math-rb-h1)
 	     (setq h (match-end 1)
 		   widest (match-end 0)
 		   p (math-match-substring line 1))
-	     (math-read-big-emptyp h1 v1 h v nil t)
-	     (math-read-big-emptyp h1 (1+ v) h v2 nil t)
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
+	     (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)
 	     (if (= (math-read-big-char widest v) ?\()
 		 (progn
 		   (setq line (if (string-match "-" p)
@@ -958,14 +996,14 @@
 				(intern (concat "calcFunc-" p)))
 			 h (1+ widest)
 			 p nil)
-		   (math-read-big-emptyp widest v1 h v nil t)
-		   (math-read-big-emptyp widest (1+ v) h v2 nil t)
+		   (math-read-big-emptyp widest math-rb-v1 h v nil t)
+		   (math-read-big-emptyp widest (1+ v) h math-rb-v2 nil t)
 		   (while (progn
 			    (setq widest (math-read-big-balance h v "(" t))
-			    (math-read-big-emptyp (1- h) v1 h v nil t)
-			    (math-read-big-emptyp (1- h) (1+ v) h v2 nil t)
+			    (math-read-big-emptyp (1- h) math-rb-v1 h v nil t)
+			    (math-read-big-emptyp (1- h) (1+ v) h math-rb-v2 nil t)
 			    (setq p (cons (math-read-big-rec
-					   h v1 (1- widest) v2 v) p)
+					   h math-rb-v1 (1- widest) math-rb-v2 v) p)
 				  h widest)
 			    (= (math-read-big-char (1- h) v) ?\,)))
 		   (or (= (math-read-big-char (1- h) v) ?\))
@@ -979,44 +1017,45 @@
 
 	    ;; Number.
 	    (t
-	     (setq line (nth v lines))
-	     (or (= (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\([0-9]+\\(#\\|\\^\\^\\)[0-9a-zA-Z:]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" line h1) h1)
+	     (setq line (nth v math-read-big-lines))
+	     (or (= (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\([0-9]+\\(#\\|\\^\\^\\)[0-9a-zA-Z:]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" line math-rb-h1) math-rb-h1)
 		 (math-read-big-error h v "Expected a number"))
 	     (setq h (match-end 0)
 		   p (math-read-number (math-match-substring line 0)))
-	     (math-read-big-emptyp h1 v1 h v nil t)
-	     (math-read-big-emptyp h1 (1+ v) h v2 nil t)))
+	     (math-read-big-emptyp math-rb-h1 math-rb-v1 h v nil t)
+	     (math-read-big-emptyp math-rb-h1 (1+ v) h math-rb-v2 nil t)))
 
-      ;; Now left term is bounded by h1, v1, h, v2; baseline = v.
+      ;; Now left term is bounded by math-rb-h1, math-rb-v1, h, math-rb-v2; 
+      ;; baseline = v.
       (if baseline
 	  (or (= v baseline)
-	      (math-read-big-error h1 v "Inconsistent baseline in formula"))
+	      (math-read-big-error math-rb-h1 v "Inconsistent baseline in formula"))
 	(setq baseline v))
 
       ;; Look for superscripts or subscripts.
-      (setq line (nth baseline lines)
-	    len (min h2 (length line))
+      (setq line (nth baseline math-read-big-lines)
+	    len (min math-rb-h2 (length line))
 	    widest h)
       (while (and (< widest len)
 		  (= (aref line widest) ?\ ))
 	(setq widest (1+ widest)))
-      (and (>= widest len) (setq widest h2))
-      (if (math-read-big-emptyp h v widest v2)
-	  (if (math-read-big-emptyp h v1 widest v)
+      (and (>= widest len) (setq widest math-rb-h2))
+      (if (math-read-big-emptyp h v widest math-rb-v2)
+	  (if (math-read-big-emptyp h math-rb-v1 widest v)
 	      (setq h widest)
-	    (setq p (list '^ p (math-read-big-rec h v1 widest v))
+	    (setq p (list '^ p (math-read-big-rec h math-rb-v1 widest v))
 		  h widest))
-	  (if (math-read-big-emptyp h v1 widest v)
+	  (if (math-read-big-emptyp h math-rb-v1 widest v)
 	      (setq p (list 'calcFunc-subscr p
-			    (math-read-big-rec h v widest v2))
+			    (math-read-big-rec h v widest math-rb-v2))
 		    h widest)))
 
       ;; Look for an operator name and grab additional terms.
       (while (and (< h len)
 		  (if (setq widest (and (math-read-big-emptyp
-					 h v1 (1+ h) v)
+					 h math-rb-v1 (1+ h) v)
 					(math-read-big-emptyp
-					 h (1+ v) (1+ h) v2)
+					 h (1+ v) (1+ h) math-rb-v2)
 					(string-match "<=\\|>=\\|\\+/-\\|!=\\|&&\\|||\\|:=\\|=>\\|." line h)
 					(assoc (math-match-substring line 0)
 					       math-standard-opers)))
@@ -1028,44 +1067,46 @@
 	(cond ((eq (nth 3 widest) -1)
 	       (setq p (list (nth 1 widest) p)))
 	      ((equal (car widest) "?")
-	       (let ((y (math-read-big-rec h v1 h2 v2 baseline nil t)))
-		 (or (= (math-read-big-char the-h2 baseline) ?\:)
-		     (math-read-big-error the-h2 baseline "Expected `:'"))
+	       (let ((y (math-read-big-rec h math-rb-v1 math-rb-h2 
+                                           math-rb-v2 baseline nil t)))
+		 (or (= (math-read-big-char math-read-big-h2 baseline) ?\:)
+		     (math-read-big-error math-read-big-h2 baseline "Expected `:'"))
 		 (setq p (list (nth 1 widest) p y
-			       (math-read-big-rec (1+ the-h2) v1 h2 v2
-						  baseline (nth 3 widest) t))
-		       h the-h2)))
+			       (math-read-big-rec 
+                                (1+ math-read-big-h2) math-rb-v1 math-rb-h2 math-rb-v2
+                                baseline (nth 3 widest) t))
+		       h math-read-big-h2)))
 	      (t
 	       (setq p (list (nth 1 widest) p
-			     (math-read-big-rec h v1 h2 v2
+			     (math-read-big-rec h math-rb-v1 math-rb-h2 math-rb-v2
 						baseline (nth 3 widest) t))
-		     h the-h2))))
+		     h math-read-big-h2))))
 
       ;; Return all relevant information to caller.
-      (setq the-baseline baseline
-	    the-h2 h)
-      (or short (= the-h2 h2)
+      (setq math-read-big-baseline baseline
+	    math-read-big-h2 h)
+      (or short (= math-read-big-h2 math-rb-h2)
 	  (math-read-big-error h baseline))
       p)))
 
 (defun math-read-big-char (h v)
-  (or (and (>= h h1)
-	   (< h h2)
-	   (>= v v1)
-	   (< v v2)
-	   (let ((line (nth v lines)))
+  (or (and (>= h math-rb-h1)
+	   (< h math-rb-h2)
+	   (>= v math-rb-v1)
+	   (< v math-rb-v2)
+	   (let ((line (nth v math-read-big-lines)))
 	     (and line
 		  (< h (length line))
 		  (aref line h))))
       ?\ ))
 
 (defun math-read-big-emptyp (eh1 ev1 eh2 ev2 &optional what error)
-  (and (< ev1 v1) (setq ev1 v1))
-  (and (< eh1 h1) (setq eh1 h1))
-  (and (> ev2 v2) (setq ev2 v2))
-  (and (> eh2 h2) (setq eh2 h2))
+  (and (< ev1 math-rb-v1) (setq ev1 math-rb-v1))
+  (and (< eh1 math-rb-h1) (setq eh1 math-rb-h1))
+  (and (> ev2 math-rb-v2) (setq ev2 math-rb-v2))
+  (and (> eh2 math-rb-h2) (setq eh2 math-rb-h2))
   (or what (setq what ?\ ))
-  (let ((p (nthcdr ev1 lines))
+  (let ((p (nthcdr ev1 math-read-big-lines))
 	h)
     (while (and (< ev1 ev2)
 		(progn
@@ -1081,25 +1122,30 @@
 	    p (cdr p)))
     (>= ev1 ev2)))
 
+;; math-read-big-err-msg is local to math-read-big-expr in calc-ext.el,
+;; but is used by math-read-big-error which is called (indirectly) by
+;; math-read-big-expr.
+(defvar math-read-big-err-msg)
+
 (defun math-read-big-error (h v &optional msg)
   (let ((pos 0)
-	(p lines))
+	(p math-read-big-lines))
     (while (> v 0)
       (setq pos (+ pos 1 (length (car p)))
 	    p (cdr p)
 	    v (1- v)))
     (setq h (+ pos (min h (length (car p))))
-	  err-msg (list 'error h (or msg "Syntax error")))
+	  math-read-big-err-msg (list 'error h (or msg "Syntax error")))
     (throw 'syntax nil)))
 
 (defun math-read-big-balance (h v what &optional commas)
-  (let* ((line (nth v lines))
-	 (len (min h2 (length line)))
+  (let* ((line (nth v math-read-big-lines))
+	 (len (min math-rb-h2 (length line)))
 	 (count 1))
     (while (> count 0)
       (if (>= h len)
 	  (if what
-	      (math-read-big-error h1 v (format "Unmatched `%s'" what))
+	      (math-read-big-error nil v (format "Unmatched `%s'" what))
 	    (setq count 0))
 	(if (memq (aref line h) '(?\( ?\[))
 	    (setq count (1+ count))
@@ -1113,5 +1159,7 @@
 	(setq h (1+ h))))
     h))
 
+(provide 'calc-lang)
+
 ;;; arch-tag: 483bfe15-f290-4fef-bb7d-ce65be687f2e
 ;;; calc-lang.el ends here
--- a/lisp/calc/calc-macs.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-macs.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -27,10 +26,6 @@
 
 ;;; Code:
 
-(provide 'calc-macs)
-
-(defun calc-need-macros () nil)
-
 (defmacro calc-wrapper (&rest body)
   `(calc-do (function (lambda ()
 			,@body))))
@@ -201,5 +196,7 @@
     (or (consp b)
 	(< a b))))
 
+(provide 'calc-macs)
+
 ;;; arch-tag: 08ba8ec2-fcff-4b80-a079-ec661bdb057e
 ;;; calc-macs.el ends here
--- a/lisp/calc/calc-maint.el	Sun Nov 28 14:39:06 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,392 +0,0 @@
-;;; calc-maint.el --- maintenance routines for Calc
-
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
-
-;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY.  No author or distributor
-;; accepts responsibility to anyone for the consequences of using it
-;; or for whether it serves any particular purpose or works at all,
-;; unless he says so in writing.  Refer to the GNU Emacs General Public
-;; License for full details.
-
-;; Everyone is granted permission to copy, modify and redistribute
-;; GNU Emacs, but only under the conditions described in the
-;; GNU Emacs General Public License.   A copy of this license is
-;; supposed to have been given to you along with GNU Emacs so you
-;; can know your rights and responsibilities.  It should be in a
-;; file named COPYING.  Among other things, the copyright notice
-;; and this notice must be preserved on all copies.
-
-;;; Commentary:
-
-;;; Code:
-
-(defun calc-compile ()
-  "Compile all parts of Calc.
-Unix usage:
-     emacs -batch -l calc-maint -f calc-compile"
-  (interactive)
-  (if (equal (user-full-name) "David Gillespie")
-      (load "~/lisp/newbytecomp"))
-  (setq byte-compile-verbose t)
-  (if noninteractive
-      (let ((old-message (symbol-function 'message))
-	    (old-write-region (symbol-function 'write-region))
-	    (comp-was-func nil)
-	    (comp-len 0))
-	(unwind-protect
-	    (progn
-	      (fset 'message (symbol-function 'calc-compile-message))
-	      (fset 'write-region (symbol-function 'calc-compile-write-region))
-	      (calc-do-compile))
-	  (fset 'message old-message)
-	  (fset 'write-region old-write-region)))
-    (calc-do-compile)))
-
-(defun calc-do-compile ()
-  (let ((make-backup-files nil)
-	(changed-rules nil)
-	(changed-units nil)
-	(message-bug (string-match "^18.\\([0-4][0-9]\\|5[0-6]\\)"
-				   emacs-version)))
-    (setq max-lisp-eval-depth (max 400 max-lisp-eval-depth))
-    ;; Enable some irrelevant warnings to avoid compiler bug in 19.29:
-    (setq byte-compile-warnings (and (string-match "^19.29" emacs-version)
-				     '(obsolete)))
-
-    ;; Make sure we're in the right directory.
-    (find-file "calc.el")
-    (if (= (buffer-size) 0)
-	(error "This command must be used in the Calc source directory"))
-
-    ;; Make sure current directory is in load-path.
-    (setq load-path (cons default-directory load-path))
-    (load "calc-macs.el" nil t t)
-    (provide 'calc)
-    (provide 'calc-ext)
-
-    ;; Compile all the source files.
-    (let ((files (append
-		  '("calc.el" "calc-ext.el")
-		  (sort (directory-files
-			 default-directory nil
-			 "\\`calc-.[^x].*\\.el\\'")
-			'string<))))
-      (while files
-	(if (file-newer-than-file-p (car files) (concat (car files) "c"))
-	    (progn
-	      (if (string-match "calc-rules" (car files))
-		  (setq changed-rules t))
-	      (if (string-match "calc-units" (car files))
-		  (setq changed-units t))
-	      (or message-bug (message ""))
-	      (byte-compile-file (car files)))
-	  (message "File %s is up to date" (car files)))
-	(if (string-match "calc\\(-ext\\)?.el" (car files))
-	    (load (concat (car files) "c") nil t t))
-	(setq files (cdr files))))
-
-    (if (or changed-units changed-rules)
-	(condition-case err
-	    (progn
-
-	      ;; Pre-build the units table.
-	      (if (and changed-units
-		       (not (string-match "Lucid" emacs-version)))
-		  (progn
-		    (or message-bug (message ""))
-		    (save-excursion
-		      (calc-create-buffer)
-		      (math-build-units-table))
-		    (find-file "calc-units.elc")
-		    (goto-char (point-max))
-		    (insert "\n(setq math-units-table '"
-			    (prin1-to-string math-units-table)
-			    ")\n")
-		    (save-buffer)))
-
-	      ;; Pre-build rewrite rules for j D, j M, etc.
-	      (if (and changed-rules (not (string-match "^19" emacs-version)))
-		  (let ((rules nil))
-		    (or message-bug (message ""))
-		    (find-file "calc-rules.elc")
-		    (goto-char (point-min))
-		    (while (re-search-forward "defun calc-\\([A-Za-z]*Rules\\)"
-					      nil t)
-		      (setq rules (cons (buffer-substring (match-beginning 1)
-							  (match-end 1))
-					rules)))
-		    (goto-char (point-min))
-		    (re-search-forward "\n(defun calc-[A-Za-z]*Rules")
-		    (beginning-of-line)
-		    (delete-region (point) (point-max))
-		    (mapcar (function
-			     (lambda (v)
-			       (let* ((vv (intern (concat "var-" v)))
-				      (val (save-excursion
-					     (calc-create-buffer)
-					     (calc-var-value vv))))
-				 (insert "\n(defun calc-" v " () '"
-					 (prin1-to-string val) ")\n"))))
-			    (sort rules 'string<))
-		    (save-buffer))))
-	  (error (message "Unable to pre-build tables %s" err))))
-    (message "Done.  Don't forget to install with \"make public\" or \"make private\"")))
-
-(defun calc-compile-message (fmt &rest args)
-  (cond ((and (= (length args) 2)
-	      (stringp (car args))
-	      (string-match ".elc?\\'" (car args))
-	      (symbolp (nth 1 args)))
-	 (let ((name (symbol-name (nth 1 args))))
-	   (princ (if comp-was-func ", " "  "))
-	   (if (and comp-was-func (eq (string-match comp-was-func name) 0))
-	       (setq name (substring name (1- (length comp-was-func))))
-	     (setq comp-was-func (if (string-match "\\`[a-zA-Z]+-" name)
-				     (substring name 0 (match-end 0))
-				   " ")))
-	   (if (> (+ comp-len (length name)) 75)
-	       (progn
-		 (princ "\n  ")
-		 (setq comp-len 0)))
-	   (princ name)
-	   (send-string-to-terminal "")  ; cause an fflush(stdout)
-	   (setq comp-len (+ comp-len 2 (length name)))))
-	((and (setq comp-was-func nil
-		    comp-len 0)
-	      (= (length args) 1)
-	      (stringp (car args))
-	      (string-match ".elc?\\'" (car args)))
-	 (unless (string-match "Saving file %s..." fmt)
-	   (funcall old-message fmt (file-name-nondirectory (car args)))))
-	((string-match "\\(Preparing\\|Building\\).*\\.\\.\\.$" fmt)
-	 (send-string-to-terminal (apply 'format fmt args)))
-	((string-match "\\(Preparing\\|Building\\).*\\.\\.\\. *done$" fmt)
-	 (send-string-to-terminal "done\n"))
-	(t (apply old-message fmt args))))
-
-(defun calc-compile-write-region (start end filename &optional append visit &rest rest)
-  (if (eq visit t)
-      (set-buffer-auto-saved))
-  (if (and (string-match "\\.elc" filename)
-	   (= start (point-min))
-	   (= end (point-max)))
-      (save-excursion
-	(goto-char (point-min))
-	(if (search-forward "\n(require (quote calc-macs))\n" nil t)
-	    (replace-match ""))
-	(setq end (point-max))))
-  (apply old-write-region start end filename append 'quietly rest)
-  (message "Wrote %s" filename)
-  nil)
-
-(defun calc-split-tutorial (&optional force)
-  (interactive "P")
-  (calc-split-manual force 1))
-
-(defun calc-split-reference (&optional force)
-  (interactive "P")
-  (calc-split-manual force 2))
-
-(defun calc-split-manual (&optional force part)
-  "Split the Calc manual into separate Tutorial and Reference manuals.
-Use this if your TeX installation is too small-minded to handle
-calc.texinfo all at once.
-Usage:  C-x C-f calc.texinfo RET
-        M-x calc-split-manual RET"
-  (interactive "P")
-  (or (let ((case-fold-search t))
-	(string-match "calc\\.texi" (buffer-name)))
-      force
-      (error "This command should be used in the calc.texi buffer"))
-  (let ((srcbuf (current-buffer))
-	tutpos refpos endpos (maxpos (point-max)))
-    (goto-char 1)
-    (search-forward "@c [tutorial]")
-    (beginning-of-line)
-    (setq tutpos (point))
-    (search-forward "@c [reference]")
-    (beginning-of-line)
-    (setq refpos (point))
-    (search-forward "@c [end]")
-    (beginning-of-line)
-    (setq endpos (point))
-    (or (eq part 2)
-	(progn
-	  (find-file "calctut.tex")
-	  (erase-buffer)
-	  (insert-buffer-substring srcbuf 1 refpos)
-	  (insert-buffer-substring srcbuf endpos maxpos)
-	  (calc-split-volume "I" "ref" "Tutorial" "Reference")
-	  (save-buffer)))
-    (or (eq part 1)
-	(progn
-	  (find-file "calcref.tex")
-	  (erase-buffer)
-	  (insert-buffer-substring srcbuf 1 tutpos)
-	  (insert "\n@tex\n\\global\\advance\\chapno by 1\n@end tex\n")
-	  (insert-buffer-substring srcbuf refpos maxpos)
-	  (calc-split-volume "II" "tut" "Reference" "Tutorial")
-	  (save-buffer)))
-    (switch-to-buffer srcbuf)
-    (goto-char 1))
-  (message (cond ((eq part 1) "Wrote file calctut.tex")
-		 ((eq part 2) "Wrote file calcref.tex")
-		 (t "Wrote files calctut.tex and calcref.tex"))))
-
-(defun calc-split-volume (number fix name other-name)
-  (goto-char 1)
-  (search-forward "@c [title]\n")
-  (search-forward "Manual")
-  (delete-backward-char 6)
-  (insert name)
-  (search-forward "@c [volume]\n")
-  (insert "@sp 1\n@center Volume " number ": " name "\n")
-  (let ((pat (format "@c \\[fix-%s \\(.*\\)\\]\n" fix)))
-    (while (re-search-forward pat nil t)
-      (let ((topic (buffer-substring (match-beginning 1) (match-end 1))))
-	(re-search-forward "@\\(p?xref\\){[^}]*}")
-	(let ((cmd (buffer-substring (match-beginning 1) (match-end 1))))
-	  (delete-region (match-beginning 0) (match-end 0))
-	  (insert (if (equal cmd "pxref") "see" "See")
-		  " ``" topic "'' in @emph{the Calc "
-		  other-name "}")))))
-  (goto-char 1)
-  (while (search-forward "@c [when-split]\n" nil t)
-    (while (looking-at "@c ")
-      (delete-char 3)
-      (forward-line 1)))
-  (goto-char 1)
-  (while (search-forward "@c [not-split]\n" nil t)
-    (while (not (looking-at "@c"))
-      (insert "@c ")
-      (forward-line 1))))
-
-
-(defun calc-inline-summary ()
-  "Make a special \"calcsum.tex\" file to be used with main manual."
-  (calc-split-summary nil t))
-
-(defun calc-split-summary (&optional force in-line)
-  "Make a special \"calcsum.tex\" file with just the Calc summary."
-  (interactive "P")
-  (or (let ((case-fold-search t))
-	(string-match "calc\\.texinfo" (buffer-name)))
-      force
-      (error "This command should be used in the calc.texinfo buffer"))
-  (let ((srcbuf (current-buffer))
-	begpos sumpos endpos midpos)
-    (goto-char 1)
-    (search-forward "{Calc Manual}")
-    (backward-char 1)
-    (delete-backward-char 6)
-    (insert "Summary")
-    (search-forward "@c [begin]")
-    (beginning-of-line)
-    (setq begpos (point))
-    (search-forward "@c [summary]")
-    (beginning-of-line)
-    (setq sumpos (point))
-    (search-forward "@c [end-summary]")
-    (beginning-of-line)
-    (setq endpos (point))
-    (find-file "calcsum.tex")
-    (erase-buffer)
-    (insert-buffer-substring srcbuf 1 begpos)
-    (insert "@tex\n"
-	    "\\global\\advance\\appendixno2\n"
-	    "\\gdef\\xref#1.{See ``#1.''}\n")
-    (setq midpos (point))
-    (insert "@end tex\n")
-    (insert-buffer-substring srcbuf sumpos endpos)
-    (insert "@bye\n")
-    (goto-char 1)
-    (if (search-forward "{. a b c" nil t)
-	(replace-match "{... a b c"))
-    (goto-char 1)
-    (if in-line
-	(let ((buf (current-buffer))
-	      (page nil))
-	  (find-file "calc.aux")
-	  (if (> (buffer-size) 0)
-	      (progn
-		(goto-char 1)
-		(re-search-forward "{Summary-pg}{\\([0-9]+\\)}")
-		(setq page (string-to-int (buffer-substring (match-beginning 1)
-							    (match-end 1))))))
-	  (switch-to-buffer buf)
-	  (if page
-	      (progn
-		(message "Adjusting starting page number to %d" page)
-		(goto-char midpos)
-		(insert (format "\\global\\pageno=%d\n" page)))
-	    (message "Unable to find page number from calc.aux")))
-      (if (search-forward "@c smallbook" nil t)
-	  (progn   ; activate "smallbook" format for compactness
-	    (beginning-of-line)
-	    (forward-char 1)
-	    (delete-char 2))))
-    (let ((buf (current-buffer)))
-      (find-file "calc.ky")
-      (if (> (buffer-size) 0)
-	  (let ((ibuf (current-buffer)))
-	    (message "Mixing in page numbers from Key Index (calc.ky)")
-	    (switch-to-buffer buf)
-	    (goto-char 1)
-	    (search-forward "notes at the end")
-	    (insert "; the number in italics is\n"
-		    "the page number where the command is described")
-	    (while (re-search-forward
-		    "@r{.*@: *\\([^ ]\\(.*[^ ]\\)?\\) *@:.*@:.*@:\\(.*\\)@:.*}"
-		    nil t)
-	      (let ((key (buffer-substring (match-beginning 1) (match-end 1)))
-		    (pos (match-beginning 3))
-		    num)
-		(set-buffer ibuf)
-		(goto-char 1)
-		(let ((p '( ( "I H " . "H I " )  ; oops!
-			    ( "@@ ' \"" . "@@" ) ( "h m s" . "@@" )
-			    ( "\\\\" . "{\\tt\\indexbackslash }" )
-			    ( "_" . "{\\_}" )
-			    ( "\\^" . "{\\tt\\hat}" )
-			    ( "<" . "{\\tt\\less}" )
-			    ( ">" . "{\\tt\\gtr}" )
-			    ( "\"" ) ( "@{" ) ( "@}" )
-			    ( "~" ) ( "|" ) ( "@@" )
-			    ( "\\+" . "{\\tt\\char43}" )
-			    ( "# l" . "# L" )
-			    ( "I f I" . "f I" ) ( "I f Q" . "f Q" )
-			    ( "V &" . "&" ) ( "C-u " . "" ) ))
-		      (case-fold-search nil))
-		  (while p
-		    (if (string-match (car (car p)) key)
-			(setq key (concat (substring key 0 (match-beginning 0))
-					  (or (cdr (car p))
-					      (format "{\\tt\\char'%03o}"
-						      (aref key (1- (match-end
-								     0)))))
-					  (substring key (match-end 0)))))
-		    (setq p (cdr p)))
-		  (setq num (and (search-forward (format "\\entry {%s}{" key)
-						 nil t)
-				 (looking-at "[0-9]+")
-				 (buffer-substring (point) (match-end 0)))))
-		(set-buffer buf)
-		(goto-char pos)
-		(insert "@pgref{" (or num "") "}")))
-	    (goto-char midpos)
-	    (insert "\\gdef\\pgref#1{\\hbox to 2em{\\indsl\\hss#1}\\ \\ }\n"))
-	(message
-	 "Unable to find Key Index (calc.ky); no page numbers inserted"))
-      (switch-to-buffer buf))
-    (save-buffer))
-  (message "Wrote file calcsum.tex"))
-
-;;; arch-tag: 46cf3de8-6248-4a11-9034-d9850195761d
-;;; calc-maint.el ends here
--- a/lisp/calc/calc-map.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-map.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2004 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-map () nil)
-
-
 (defun calc-apply (&optional oper)
   (interactive)
   (calc-wrapper
@@ -802,25 +798,34 @@
 	  (cons f args))))))
 
 ;;; Do substitutions in parallel to avoid crosstalk.
+
+;; The variables math-ms-temp and math-ms-args are local to 
+;; math-multi-subst, but are used by math-multi-subst-rec, which 
+;; is called by math-multi-subst.
+(defvar math-ms-temp)
+(defvar math-ms-args)
+
 (defun math-multi-subst (expr olds news)
-  (let ((args nil)
-	temp)
+  (let ((math-ms-args nil)
+	math-ms-temp)
     (while (and olds news)
-      (setq args (cons (cons (car olds) (car news)) args)
+      (setq math-ms-args (cons (cons (car olds) (car news)) math-ms-args)
 	    olds (cdr olds)
 	    news (cdr news)))
     (math-multi-subst-rec expr)))
 
 (defun math-multi-subst-rec (expr)
-  (cond ((setq temp (assoc expr args)) (cdr temp))
+  (cond ((setq math-ms-temp (assoc expr math-ms-args)) 
+         (cdr math-ms-temp))
 	((Math-primp expr) expr)
 	((and (eq (car expr) 'calcFunc-lambda) (> (length expr) 2))
 	 (let ((new (list (car expr)))
-	       (args args))
+	       (math-ms-args math-ms-args))
 	   (while (cdr (setq expr (cdr expr)))
 	     (setq new (cons (car expr) new))
-	     (if (assoc (car expr) args)
-		 (setq args (cons (cons (car expr) (car expr)) args))))
+	     (if (assoc (car expr) math-ms-args)
+		 (setq math-ms-args (cons (cons (car expr) (car expr)) 
+                                          math-ms-args))))
 	   (nreverse (cons (math-multi-subst-rec (car expr)) new))))
 	(t
 	 (cons (car expr)
@@ -1033,7 +1038,7 @@
 						  (calcFunc-mod . math-mod)
 						  (calcFunc-vconcat .
 						   math-concat) )))
-				    lfunc)))
+				    func)))
 		     (while (cdr vec)
 		       (setq expr (funcall lfunc expr (nth 1 vec))
 			     vec (cdr vec)))))
@@ -1222,7 +1227,13 @@
     (math-normalize (cons 'vec (nreverse mat)))))
 
 
-(defun calcFunc-inner (mul-func add-func a b)
+;; The variables math-inner-mul-func and math-inner-add-func are
+;; local to calcFunc-inner, but are used by math-inner-mats,
+;; which is called by math-inner-mats.
+(defvar math-inner-mul-func)
+(defvar math-inner-add-func)
+
+(defun calcFunc-inner (math-inner-mul-func math-inner-add-func a b)
   (or (math-vectorp a) (math-reject-arg a 'vectorp))
   (or (math-vectorp b) (math-reject-arg b 'vectorp))
   (if (math-matrixp a)
@@ -1240,7 +1251,7 @@
 	    (math-dimension-error))))
     (if (math-matrixp b)
 	(nth 1 (math-inner-mats (list 'vec a) b))
-      (calcFunc-reduce add-func (calcFunc-map mul-func a b)))))
+      (calcFunc-reduce math-inner-add-func (calcFunc-map math-inner-mul-func a b)))))
 
 (defun math-inner-mats (a b)
   (let ((mat nil)
@@ -1250,13 +1261,15 @@
       (setq col cols
 	    row nil)
       (while (> (setq col (1- col)) 0)
-	(setq row (cons (calcFunc-reduce add-func
-					 (calcFunc-map mul-func
+	(setq row (cons (calcFunc-reduce math-inner-add-func
+					 (calcFunc-map math-inner-mul-func
 						       (car a)
 						       (math-mat-col b col)))
 			row)))
       (setq mat (cons (cons 'vec row) mat)))
     (cons 'vec (nreverse mat))))
 
+(provide 'calc-map)
+
 ;;; arch-tag: 980eac49-00e0-4870-b72a-e726b74c7990
 ;;; calc-map.el ends here
--- a/lisp/calc/calc-math.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-math.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-math () nil)
-
-
 (defun calc-sqrt (arg)
   (interactive "P")
   (calc-slow-wrapper
@@ -574,39 +570,51 @@
 	   (and root (list 'polar root (math-div (nth 2 a) n)))))
 	(t nil)))
 
-(defun math-nth-root-float (a n &optional guess)
+;; The variables math-nrf-n, math-nrf-nf and math-nrf-nfm1 are local
+;; to math-nth-root-float, but are used by math-nth-root-float-iter,
+;; which is called by math-nth-root-float.
+(defvar math-nrf-n)
+(defvar math-nrf-nf)
+(defvar math-nrf-nfm1)
+
+(defun math-nth-root-float (a math-nrf-n &optional guess)
   (math-inexact-result)
   (math-with-extra-prec 1
-    (let ((nf (math-float n))
-	  (nfm1 (math-float (1- n))))
+    (let ((math-nrf-nf (math-float math-nrf-n))
+	  (math-nrf-nfm1 (math-float (1- math-nrf-n))))
       (math-nth-root-float-iter a (or guess
 				      (math-make-float
 				       1 (/ (+ (math-numdigs (nth 1 a))
 					       (nth 2 a)
-					       (/ n 2))
-					    n)))))))
+					       (/ math-nrf-n 2))
+					    math-nrf-n)))))))
 
-(defun math-nth-root-float-iter (a guess)   ; uses "n", "nf", "nfm1"
+(defun math-nth-root-float-iter (a guess)
   (math-working "root" guess)
-  (let ((g2 (math-div-float (math-add-float (math-mul nfm1 guess)
+  (let ((g2 (math-div-float (math-add-float (math-mul math-nrf-nfm1 guess)
 					    (math-div-float
-					     a (math-ipow guess (1- n))))
-			    nf)))
+					     a (math-ipow guess (1- math-nrf-n))))
+			    math-nrf-nf)))
     (if (math-nearly-equal-float g2 guess)
 	g2
       (math-nth-root-float-iter a g2))))
 
-(defun math-nth-root-integer (a n &optional guess)   ; [I I S]
+;; The variable math-nri-n is local to math-nth-root-integer, but
+;; is used by math-nth-root-int-iter, which is called by
+;; math-nth-root-int.
+(defvar math-nri-n)
+
+(defun math-nth-root-integer (a math-nri-n &optional guess)   ; [I I S]
   (math-nth-root-int-iter a (or guess
 				(math-scale-int 1 (/ (+ (math-numdigs a)
-							(1- n))
-						     n)))))
+							(1- math-nri-n))
+						     math-nri-n)))))
 
-(defun math-nth-root-int-iter (a guess)   ; uses "n"
+(defun math-nth-root-int-iter (a guess)
   (math-working "root" guess)
-  (let* ((q (math-idivmod a (math-ipow guess (1- n))))
-	 (s (math-add (car q) (math-mul (1- n) guess)))
-	 (g2 (math-idivmod s n)))
+  (let* ((q (math-idivmod a (math-ipow guess (1- math-nri-n))))
+	 (s (math-add (car q) (math-mul (1- math-nri-n) guess)))
+	 (g2 (math-idivmod s math-nri-n)))
     (if (Math-natnum-lessp (car g2) guess)
 	(math-nth-root-int-iter a (car g2))
       (cons (and (equal (car g2) guess)
@@ -1247,7 +1255,7 @@
 	     (math-div (calcFunc-ln x) 0)
 	   (math-reject-arg b "*Logarithm base one")))
 	((math-equal-int x 1)
-	 (if (or (math-floatp a) (math-floatp b)) '(float 0 0) 0))
+	 (if (math-floatp b) '(float 0 0) 0))
 	((and (Math-ratp x) (Math-ratp b)
 	      (math-posp x) (math-posp b)
 	      (let* ((sign 1) (inv nil)
@@ -1676,5 +1684,7 @@
 	(t (list 'calcFunc-deg a))))
 (put 'calcFunc-deg 'math-expandable t)
 
+(provide 'calc-math)
+
 ;;; arch-tag: c7367e8e-d0b8-4f70-8577-2fb3f31dbb4c
 ;;; calc-math.el ends here
--- a/lisp/calc/calc-misc.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-misc.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc.el.
+
 (require 'calc)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-misc () nil)
-
-
 (defun calc-dispatch-help (arg)
   "M-# is a prefix key; follow it with one of these letters:
 
@@ -232,6 +228,9 @@
 
 ;;;; Stack and buffer management.
 
+;; The variable calc-last-why-command is set in calc-do-handly-whys
+;; and used in calc-why (in calc-stuff.el).
+(defvar calc-last-why-command)
 
 (defun calc-do-handle-whys ()
   (setq calc-why (sort calc-next-why
@@ -243,7 +242,7 @@
 			(and (eq (car (car calc-why)) '*)
 			     calc-auto-why)))
       (progn
-	(calc-extensions)
+	(require 'calc-ext)
 	(calc-explain-why (car calc-why)
 			  (if (eq calc-auto-why t)
 			      (cdr calc-why)
@@ -329,14 +328,14 @@
 
 (defun calc-last-args-stub (arg)
   (interactive "p")
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-last-args arg))
 
 
 (defun calc-power (arg)
   (interactive "P")
   (calc-slow-wrapper
-   (if (and calc-extensions-loaded
+   (if (and (featurep 'calc-ext)
 	    (calc-is-inverse))
        (calc-binary-op "root" 'calcFunc-nroot arg nil nil)
      (calc-binary-op "^" 'calcFunc-pow arg nil nil '^))))
@@ -418,7 +417,7 @@
 When this key is used, calc-ext (the Calculator extensions module) will be
 loaded and the keystroke automatically re-typed."
   (interactive "P")
-  (calc-extensions)
+  (require 'calc-ext)
   (if (keymapp (key-binding (char-to-string last-command-char)))
       (message "%s%c-" (calc-num-prefix-name n) last-command-char))
   (calc-unread-command)
@@ -426,7 +425,7 @@
 
 (defun calc-shift-Y-prefix-help ()
   (interactive)
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-do-prefix-help calc-Y-help-msgs "other" ?Y))
 
 
@@ -465,7 +464,7 @@
 (defun math-concat (v1 v2)
   (if (stringp v1)
       (concat v1 v2)
-    (calc-extensions)
+    (require 'calc-ext)
     (if (and (or (math-objvecp v1) (math-known-scalarp v1))
 	     (or (math-objvecp v2) (math-known-scalarp v2)))
 	(append (if (and (math-vectorp v1)
@@ -593,31 +592,39 @@
 
 
 ;;; Coerce A to be an integer (by truncation toward zero).  [I N] [Public]
-(defun math-trunc (a &optional prec)
-  (cond (prec
-	 (calc-extensions)
-	 (math-trunc-special a prec))
+
+;; The variable math-trunc-prec is local to math-trunc, but used by
+;; math-trunc-fancy in calc-arith.el, which is called by math-trunc.
+
+(defun math-trunc (a &optional math-trunc-prec)
+  (cond (math-trunc-prec
+	 (require 'calc-ext)
+	 (math-trunc-special a math-trunc-prec))
 	((Math-integerp a) a)
 	((Math-looks-negp a)
 	 (math-neg (math-trunc (math-neg a))))
 	((eq (car a) 'float)
 	 (math-scale-int (nth 1 a) (nth 2 a)))
-	(t (calc-extensions)
+	(t (require 'calc-ext)
 	   (math-trunc-fancy a))))
 (defalias 'calcFunc-trunc 'math-trunc)
 
 ;;; Coerce A to be an integer (by truncation toward minus infinity).  [I N]
-(defun math-floor (a &optional prec)    ;  [Public]
-  (cond (prec
-	 (calc-extensions)
-	 (math-floor-special a prec))
+
+;; The variable math-floor-prec is local to math-floor, but used by
+;; math-floor-fancy in calc-arith.el, which is called by math-floor.
+
+(defun math-floor (a &optional math-floor-prec)    ;  [Public]
+  (cond (math-floor-prec
+	 (require 'calc-ext)
+	 (math-floor-special a math-floor-prec))
 	((Math-integerp a) a)
 	((Math-messy-integerp a) (math-trunc a))
 	((Math-realp a)
 	 (if (Math-negp a)
 	     (math-add (math-trunc a) -1)
 	   (math-trunc a)))
-	(t (calc-extensions)
+	(t (require 'calc-ext)
 	   (math-floor-fancy a))))
 (defalias 'calcFunc-floor 'math-floor)
 
@@ -633,7 +640,7 @@
 (defun calcFunc-inv (m)
   (if (Math-vectorp m)
       (progn
-	(calc-extensions)
+	(require 'calc-ext)
 	(if (math-square-matrixp m)
 	    (or (math-with-extra-prec 2 (math-matrix-inv-raw m))
 		(math-reject-arg m "*Singular matrix"))
@@ -663,7 +670,7 @@
 	 (math-imod a b))
 	((and (Math-anglep a) (Math-anglep b))
 	 (math-sub a (math-mul (math-floor (math-div a b)) b)))
-	(t (calc-extensions)
+	(t (require 'calc-ext)
 	   (math-mod-fancy a b))))
 
 
@@ -676,7 +683,7 @@
 	((Math-zerop a)
 	 (if (and (Math-scalarp b) (Math-posp b))
 	     (if (math-floatp b) (math-float a) a)
-	   (calc-extensions)
+	   (require 'calc-ext)
 	   (math-pow-of-zero a b)))
 	((or (eq a 1) (eq b 1)) a)
 	((or (equal a '(float 1 0)) (equal b '(float 1 0))) a)
@@ -684,7 +691,7 @@
 	 (if (Math-scalarp a)
 	     (if (or (math-floatp a) (math-floatp b))
 		 '(float 1 0) 1)
-	   (calc-extensions)
+	   (require 'calc-ext)
 	   (math-pow-zero a b)))
 	((and (Math-integerp b) (or (Math-numberp a) (Math-vectorp a)))
 	 (if (and (equal a '(float 1 1)) (integerp b))
@@ -692,7 +699,7 @@
 	   (math-with-extra-prec 2
 	     (math-ipow a b))))
 	(t
-	 (calc-extensions)
+	 (require 'calc-ext)
 	 (math-pow-fancy a b))))
 
 (defun math-ipow (a n)   ; [O O I] [Public]
@@ -750,5 +757,7 @@
 " )))
 (defalias 'calc-report-bug 'report-calc-bug)
 
+(provide 'calc-misc)
+
 ;;; arch-tag: 7984d9d0-62e5-41dc-afb8-e904b975f250
 ;;; calc-misc.el ends here
--- a/lisp/calc/calc-mode.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-mode.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -27,15 +26,11 @@
 
 ;;; Code:
 
-
 ;; This file is autoloaded from calc-ext.el.
-(require 'calc-ext)
 
+(require 'calc-ext)
 (require 'calc-macs)
 
-(defun calc-Need-calc-mode () nil)
-
-
 (defun calc-line-numbering (n)
   (interactive "P")
   (calc-wrapper
@@ -672,5 +667,7 @@
 	 (error "Unrecognized character: %c" (aref arg bad)))
      (calc-change-mode 'calc-matrix-brackets code t))))
 
+(provide 'calc-mode)
+
 ;;; arch-tag: ecc70eea-c712-43f2-9085-4205e58d6ddf
 ;;; calc-mode.el ends here
--- a/lisp/calc/calc-mtx.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-mtx.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -27,15 +26,11 @@
 
 ;;; Code:
 
-
 ;; This file is autoloaded from calc-ext.el.
-(require 'calc-ext)
 
+(require 'calc-ext)
 (require 'calc-macs)
 
-(defun calc-Need-calc-mat () nil)
-
-
 (defun calc-mdet (arg)
   (interactive "P")
   (calc-slow-wrapper
@@ -176,6 +171,10 @@
 	(nth 1 m)
       (math-reject-arg m 'square-matrixp))))
 
+;; The variable math-det-lu is local to math-det-raw, but is
+;; used by math-det-step, which is called by math-det-raw.
+(defvar math-det-lu)
+
 (defun math-det-raw (m)
   (let ((n (1- (length m))))
     (cond ((= n 1)
@@ -211,13 +210,13 @@
 				(nth 3 (nth 3 m))))))
 	  (t (let ((lud (math-matrix-lud m)))
 	       (if lud
-		   (let ((lu (car lud)))
+		   (let ((math-det-lu (car lud)))
 		     (math-det-step n (nth 2 lud)))
 		 0))))))
 
 (defun math-det-step (n prod)
   (if (> n 0)
-      (math-det-step (1- n) (math-mul prod (nth n (nth n lu))))
+      (math-det-step (1- n) (math-mul prod (nth n (nth n math-det-lu))))
     prod))
 
 ;;; This returns a list (LU index d), or nil if not possible.
@@ -365,5 +364,7 @@
 	  (math-reject-arg m "*Singular matrix"))
     (math-reject-arg m 'square-matrixp)))
 
+(provide 'calc-mtx)
+
 ;;; arch-tag: fc0947b1-90e1-4a23-8950-d8ead9c3a306
 ;;; calc-mtx.el ends here
--- a/lisp/calc/calc-poly.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-poly.el	Wed Dec 08 22:20:27 2004 +0000
@@ -27,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-poly () nil)
-
-
 (defun calcFunc-pcont (expr &optional var)
   (cond ((Math-primp expr)
 	 (cond ((Math-zerop expr) 1)
@@ -516,48 +513,72 @@
 
 ;;; Given an expression find all variables that are polynomial bases.
 ;;; Return list in the form '( (var1 degree1) (var2 degree2) ... ).
-;;; Note dynamic scope of mpb-total-base.
+
+;; The variable math-poly-base-total-base is local to 
+;; math-total-polynomial-base, but is used by math-polynomial-p1,
+;; which is called by math-total-polynomial-base.
+(defvar math-poly-base-total-base)
+
 (defun math-total-polynomial-base (expr)
-  (let ((mpb-total-base nil))
+  (let ((math-poly-base-total-base nil))
     (math-polynomial-base expr 'math-polynomial-p1)
-    (math-sort-poly-base-list mpb-total-base)))
+    (math-sort-poly-base-list math-poly-base-total-base)))
+
+;; The variable math-poly-base-top-expr is local to math-polynomial-base
+;; in calc-alg.el, but is used by math-polynomial-p1 which is called
+;; by math-polynomial-base.
+(defvar math-poly-base-top-expr)
 
 (defun math-polynomial-p1 (subexpr)
-  (or (assoc subexpr mpb-total-base)
+  (or (assoc subexpr math-poly-base-total-base)
       (memq (car subexpr) '(+ - * / neg))
       (and (eq (car subexpr) '^) (natnump (nth 2 subexpr)))
       (let* ((math-poly-base-variable subexpr)
-	     (exponent (math-polynomial-p mpb-top-expr subexpr)))
+	     (exponent (math-polynomial-p math-poly-base-top-expr subexpr)))
 	(if exponent
-	    (setq mpb-total-base (cons (list subexpr exponent)
-				       mpb-total-base)))))
+	    (setq math-poly-base-total-base (cons (list subexpr exponent)
+				       math-poly-base-total-base)))))
   nil)
 
-
+;; The variable math-factored-vars is local to calcFunc-factors and
+;; calcFunc-factor, but is used by math-factor-expr and 
+;; math-factor-expr-part, which are called (directly and indirectly) by
+;; calcFunc-factor and calcFunc-factors.
+(defvar math-factored-vars)
 
+;; The variable math-fact-expr is local to calcFunc-factors,
+;; calcFunc-factor and math-factor-expr, but is used by math-factor-expr-try 
+;; and math-factor-expr-part, which are called (directly and indirectly) by
+;; calcFunc-factor, calcFunc-factors and math-factor-expr.
+(defvar math-fact-expr)
 
-(defun calcFunc-factors (expr &optional var)
+;; The variable math-to-list is local to calcFunc-factors and 
+;; calcFunc-factor, but is used by math-accum-factors, which is 
+;; called (indirectly) by calcFunc-factors and calcFunc-factor.
+(defvar math-to-list)
+
+(defun calcFunc-factors (math-fact-expr &optional var)
   (let ((math-factored-vars (if var t nil))
 	(math-to-list t)
 	(calc-prefer-frac t))
     (or var
-	(setq var (math-polynomial-base expr)))
+	(setq var (math-polynomial-base math-fact-expr)))
     (let ((res (math-factor-finish
 		(or (catch 'factor (math-factor-expr-try var))
-		    expr))))
+		    math-fact-expr))))
       (math-simplify (if (math-vectorp res)
 			 res
 		       (list 'vec (list 'vec res 1)))))))
 
-(defun calcFunc-factor (expr &optional var)
+(defun calcFunc-factor (math-fact-expr &optional var)
   (let ((math-factored-vars nil)
 	(math-to-list nil)
 	(calc-prefer-frac t))
     (math-simplify (math-factor-finish
 		    (if var
 			(let ((math-factored-vars t))
-			  (or (catch 'factor (math-factor-expr-try var)) expr))
-		      (math-factor-expr expr))))))
+			  (or (catch 'factor (math-factor-expr-try var)) math-fact-expr))
+		      (math-factor-expr math-fact-expr))))))
 
 (defun math-factor-finish (x)
   (if (Math-primp x)
@@ -571,18 +592,18 @@
       (list 'calcFunc-Fac-Prot x)
     x))
 
-(defun math-factor-expr (expr)
-  (cond ((eq math-factored-vars t) expr)
-	((or (memq (car-safe expr) '(* / ^ neg))
-	     (assq (car-safe expr) calc-tweak-eqn-table))
-	 (cons (car expr) (mapcar 'math-factor-expr (cdr expr))))
-	((memq (car-safe expr) '(+ -))
+(defun math-factor-expr (math-fact-expr)
+  (cond ((eq math-factored-vars t) math-fact-expr)
+	((or (memq (car-safe math-fact-expr) '(* / ^ neg))
+	     (assq (car-safe math-fact-expr) calc-tweak-eqn-table))
+	 (cons (car math-fact-expr) (mapcar 'math-factor-expr (cdr math-fact-expr))))
+	((memq (car-safe math-fact-expr) '(+ -))
 	 (let* ((math-factored-vars math-factored-vars)
-		(y (catch 'factor (math-factor-expr-part expr))))
+		(y (catch 'factor (math-factor-expr-part math-fact-expr))))
 	   (if y
 	       (math-factor-expr y)
-	     expr)))
-	(t expr)))
+	     math-fact-expr)))
+	(t math-fact-expr)))
 
 (defun math-factor-expr-part (x)    ; uses "expr"
   (if (memq (car-safe x) '(+ - * / ^ neg))
@@ -590,21 +611,25 @@
 	(math-factor-expr-part (car x)))
     (and (not (Math-objvecp x))
 	 (not (assoc x math-factored-vars))
-	 (> (math-factor-contains expr x) 1)
+	 (> (math-factor-contains math-fact-expr x) 1)
 	 (setq math-factored-vars (cons (list x) math-factored-vars))
 	 (math-factor-expr-try x))))
 
-(defun math-factor-expr-try (x)
-  (if (eq (car-safe expr) '*)
-      (let ((res1 (catch 'factor (let ((expr (nth 1 expr)))
-				   (math-factor-expr-try x))))
-	    (res2 (catch 'factor (let ((expr (nth 2 expr)))
-				   (math-factor-expr-try x)))))
+;; The variable math-fet-x is local to math-factor-expr-try, but is
+;; used by math-factor-poly-coefs, which is called by math-factor-expr-try.
+(defvar math-fet-x)
+
+(defun math-factor-expr-try (math-fet-x)
+  (if (eq (car-safe math-fact-expr) '*)
+      (let ((res1 (catch 'factor (let ((math-fact-expr (nth 1 math-fact-expr)))
+				   (math-factor-expr-try math-fet-x))))
+	    (res2 (catch 'factor (let ((math-fact-expr (nth 2 math-fact-expr)))
+				   (math-factor-expr-try math-fet-x)))))
 	(and (or res1 res2)
-	     (throw 'factor (math-accum-factors (or res1 (nth 1 expr)) 1
-						(or res2 (nth 2 expr))))))
-    (let* ((p (math-is-polynomial expr x 30 'gen))
-	   (math-poly-modulus (math-poly-modulus expr))
+	     (throw 'factor (math-accum-factors (or res1 (nth 1 math-fact-expr)) 1
+						(or res2 (nth 2 math-fact-expr))))))
+    (let* ((p (math-is-polynomial math-fact-expr math-fet-x 30 'gen))
+	   (math-poly-modulus (math-poly-modulus math-fact-expr))
 	   res)
       (and (cdr p)
 	   (setq res (math-factor-poly-coefs p))
@@ -642,11 +667,11 @@
     (math-mul (math-pow fac pow) facs)))
 
 (defun math-factor-poly-coefs (p &optional square-free)    ; uses "x"
-  (let (t1 t2)
+  (let (t1 t2 temp)
     (cond ((not (cdr p))
 	   (or (car p) 0))
 
-	  ;; Strip off multiples of x.
+	  ;; Strip off multiples of math-fet-x.
 	  ((Math-zerop (car p))
 	   (let ((z 0))
 	     (while (and p (Math-zerop (car p)))
@@ -654,7 +679,7 @@
 	     (if (cdr p)
 		 (setq p (math-factor-poly-coefs p square-free))
 	       (setq p (math-sort-terms (math-factor-expr (car p)))))
-	     (math-accum-factors x z (math-factor-protect p))))
+	     (math-accum-factors math-fet-x z (math-factor-protect p))))
 
 	  ;; Factor out content.
 	  ((and (not square-free)
@@ -665,12 +690,12 @@
 	   (math-accum-factors t1 1 (math-factor-poly-coefs
 				     (math-poly-div-list p t1) 'cont)))
 
-	  ;; Check if linear in x.
+	  ;; Check if linear in math-fet-x.
 	  ((not (cdr (cdr p)))
 	   (math-add (math-factor-protect
 		      (math-sort-terms
 		       (math-factor-expr (car p))))
-		     (math-mul x (math-factor-protect
+		     (math-mul math-fet-x (math-factor-protect
 				  (math-sort-terms
 				   (math-factor-expr (nth 1 p)))))))
 
@@ -683,7 +708,7 @@
 	       (setq pp (cdr pp)))
 	     pp)
 	   (let ((res (math-rewrite
-		       (list 'calcFunc-thecoefs x (cons 'vec p))
+		       (list 'calcFunc-thecoefs math-fet-x (cons 'vec p))
 		       '(var FactorRules var-FactorRules))))
 	     (or (and (eq (car-safe res) 'calcFunc-thefactors)
 		      (= (length res) 3)
@@ -693,7 +718,7 @@
 			(while (setq vec (cdr vec))
 			  (setq facs (math-accum-factors (car vec) 1 facs)))
 			facs))
-		 (math-build-polynomial-expr p x))))
+		 (math-build-polynomial-expr p math-fet-x))))
 
 	  ;; Check if rational coefficients (i.e., not modulo a prime).
 	  ((eq math-poly-modulus 1)
@@ -724,12 +749,13 @@
 					   (setq scale (math-div scale den))
 					   (math-add
 					    (math-add
-					     (math-mul den (math-pow x 2))
-					     (math-mul (math-mul coef1 den) x))
+					     (math-mul den (math-pow math-fet-x 2))
+					     (math-mul (math-mul coef1 den) 
+                                                       math-fet-x))
 					    (math-mul coef0 den)))
 				       (let ((den (math-lcm-denoms coef0)))
 					 (setq scale (math-div scale den))
-					 (math-add (math-mul den x)
+					 (math-add (math-mul den math-fet-x)
 						   (math-mul coef0 den))))
 				     1 expr)
 			       roots (cdr roots))))
@@ -738,8 +764,8 @@
 				 (math-mul csign
 					   (math-build-polynomial-expr
 					    (math-mul-list (nth 1 t1) scale)
-					    x)))))
-		 (math-build-polynomial-expr p x))   ; can't factor it.
+					    math-fet-x)))))
+		 (math-build-polynomial-expr p math-fet-x))   ; can't factor it.
 
 	     ;; Separate out the squared terms (Knuth exercise 4.6.2-34).
 	     ;; This step also divides out the content of the polynomial.
@@ -1144,5 +1170,7 @@
 (defun calcFunc-expandpow (x n)
   (math-normalize (math-expand-power x n)))
 
+(provide 'calc-poly)
+
 ;;; arch-tag: d2566c51-2ccc-45f1-8c50-f3462c2953ff
 ;;; calc-poly.el ends here
--- a/lisp/calc/calc-prog.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-prog.el	Wed Dec 08 22:20:27 2004 +0000
@@ -26,14 +26,11 @@
 
 ;;; Code:
 
-
 ;; This file is autoloaded from calc-ext.el.
-(require 'calc-ext)
 
+(require 'calc-ext)
 (require 'calc-macs)
 
-(defun calc-Need-calc-prog () nil)
-
 
 (defun calc-equal-to (arg)
   (interactive "P")
@@ -271,7 +268,7 @@
                                    x))) calc-user-formula-alist))
      (if cmd
 	 (progn
-	   (calc-need-macros)
+	   (require 'calc-macs)
 	   (fset cmd
 		 (list 'lambda
 		       '()
@@ -1711,7 +1708,7 @@
 ;;; Compiling Lisp-like forms to use the math library.
 
 (defun math-do-defmath (func args body)
-  (calc-need-macros)
+  (require 'calc-macs)
   (let* ((fname (intern (concat "calcFunc-" (symbol-name func))))
 	 (doc (if (stringp (car body)) (list (car body))))
 	 (clargs (mapcar 'math-clean-arg args))
@@ -2283,5 +2280,7 @@
 		 (math-read-expr-level (nth 3 op)) (nth 1 x))
 	      (throw 'syntax "Syntax error"))))))
 
+(provide 'calc-prog)
+
 ;;; arch-tag: 4c5a183b-c9e5-4632-bb3f-e41a764518b0
 ;;; calc-prog.el ends here
--- a/lisp/calc/calc-rewr.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-rewr.el	Wed Dec 08 22:20:27 2004 +0000
@@ -27,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-rewr () nil)
-
-
 (defvar math-rewrite-default-iters 100)
 
 ;; The variable calc-rewr-sel is local to calc-rewrite-selection and 
@@ -2116,5 +2113,7 @@
 				    nil nil)
 			      (cdr rules)))))))
 
+(provide 'calc-rewr)
+
 ;;; arch-tag: ca8d7b7d-bff1-4535-90f3-e2241f5e786b
 ;;; calc-rewr.el ends here
--- a/lisp/calc/calc-rules.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-rules.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-rules () nil)
-
-
 (defun calc-compile-rule-set (name rules)
   (prog2
    (message "Preparing rule set %s..." name)
@@ -438,5 +434,7 @@
 						    hasfitparams(pv)))),
 fitparam(n) = x  :=  x ]"))
 
+(provide 'calc-rules)
+
 ;;; arch-tag: 0ed54a52-38f3-4ed7-9ca7-b8ecf8f2febe
 ;;; calc-rules.el ends here
--- a/lisp/calc/calc-sel.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-sel.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-sel () nil)
-
-
 ;;; Selection commands.
 
 (defvar calc-keep-selection t)
@@ -416,6 +412,10 @@
 	      (setcar x (list 'cplx (car x) 0))
 	    (calc-encase-atoms-rec (car x)))))))
 
+;; The variable math-comp-sel-tag is local to calc-find-selected-part,
+;; but is used by math-comp-sel-flat-term and math-comp-add-string-sel
+;; in calccomp.el, which are called (indirectly) by calc-find-selected-part.
+
 (defun calc-find-selected-part ()
   (let* ((math-comp-sel-hpos (- (current-column) calc-selection-cache-offset))
 	 toppt
@@ -857,5 +857,7 @@
   (interactive "P")
   (calc-sel-add-both-sides no-simp t))
 
+(provide 'calc-sel)
+
 ;;; arch-tag: e5169792-777d-428f-bff5-acca66813fa2
 ;;; calc-sel.el ends here
--- a/lisp/calc/calc-stat.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-stat.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-stat () nil)
-
-
 ;;; Statistical operations on vectors.
 
 (defun calc-vector-count (arg)
@@ -586,5 +582,7 @@
 		 (math-div (math-mul suminvsqrwts (1- len)) len))
 	     (if pop len (1- len)))))))))
 
+(provide 'calc-stat)
+
 ;;; arch-tag: 423858e9-8513-489c-9f35-710cd9d9c307
 ;;; calc-stat.el ends here
--- a/lisp/calc/calc-store.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-store.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-store () nil)
-
-
 ;;; Memory commands.
 
 (defvar calc-store-keep nil)
@@ -44,6 +40,8 @@
     (calc-store-into var)))
 
 (defvar calc-given-value-flag nil)
+(defvar calc-given-value)
+
 (defun calc-store-into (&optional var)
   (interactive)
   (calc-wrapper
@@ -155,6 +153,24 @@
 			     tag (and (not val) 1))
 	   (message "Stored to variable \"%s\"" (calc-var-name var)))))))
 
+(defvar calc-var-name-map nil "Keymap for reading Calc variable names.")
+(if calc-var-name-map
+    ()
+  (setq calc-var-name-map (copy-keymap minibuffer-local-completion-map))
+  (define-key calc-var-name-map " " 'self-insert-command)
+  (mapcar (function
+	   (lambda (x)
+	     (define-key calc-var-name-map (char-to-string x)
+	       'calcVar-digit)))
+	  "0123456789")
+  (mapcar (function
+	   (lambda (x)
+	     (define-key calc-var-name-map (char-to-string x)
+	       'calcVar-oper)))
+	  "+-*/^|"))
+
+(defvar calc-store-opers)
+
 (defun calc-read-var-name (prompt &optional calc-store-opers)
   (setq calc-given-value nil
 	calc-aborted-prefix nil)
@@ -178,22 +194,6 @@
 		 svar))
 	   (intern var)))))
 
-(defvar calc-var-name-map nil "Keymap for reading Calc variable names.")
-(if calc-var-name-map
-    ()
-  (setq calc-var-name-map (copy-keymap minibuffer-local-completion-map))
-  (define-key calc-var-name-map " " 'self-insert-command)
-  (mapcar (function
-	   (lambda (x)
-	     (define-key calc-var-name-map (char-to-string x)
-	       'calcVar-digit)))
-	  "0123456789")
-  (mapcar (function
-	   (lambda (x)
-	     (define-key calc-var-name-map (char-to-string x)
-	       'calcVar-oper)))
-	  "+-*/^|"))
-
 (defun calcVar-digit ()
   (interactive)
   (if (calc-minibuffer-contains "var-\\'")
@@ -530,11 +530,16 @@
 				     var-PlotData5 var-PlotData6
 				     var-DUMMY))
 
+;; The variable calc-pv-pos is local to calc-permanent-variable, but
+;; used by calc-insert-permanent-variable, which is called by
+;; calc-permanent-variable.
+(defvar calc-pv-pos)
+
 (defun calc-permanent-variable (&optional var)
   (interactive)
   (calc-wrapper
    (or var (setq var (calc-read-var-name "Save variable (default=all): ")))
-   (let (pos)
+   (let (calc-pv-pos)
      (and var (or (and (boundp var) (symbol-value var))
 		  (error "No such variable")))
      (set-buffer (find-file-noselect (substitute-in-file-name
@@ -556,16 +561,16 @@
   (goto-char (point-min))
   (if (search-forward (concat "(setq " (symbol-name var) " '") nil t)
       (progn
-	(setq pos (point-marker))
+	(setq calc-pv-pos (point-marker))
 	(forward-line -1)
 	(if (looking-at ";;; Variable .* stored by Calc on ")
 	    (progn
 	      (delete-region (match-end 0) (progn (end-of-line) (point)))
 	      (insert (current-time-string))))
-	(goto-char (- pos 8 (length (symbol-name var))))
+	(goto-char (- calc-pv-pos 8 (length (symbol-name var))))
 	(forward-sexp 1)
 	(backward-char 1)
-	(delete-region pos (point)))
+	(delete-region calc-pv-pos (point)))
     (goto-char (point-max))
     (insert "\n;;; Variable \""
 	    (symbol-name var)
@@ -619,5 +624,7 @@
   (calc-slow-wrapper
    (calc-binary-op "sub" 'calcFunc-subscr arg)))
 
+(provide 'calc-store)
+
 ;;; arch-tag: 2fbfec82-a521-42ca-bcd8-4f254ae6313e
 ;;; calc-store.el ends here
--- a/lisp/calc/calc-stuff.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-stuff.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-stuff () nil)
-
-
 (defun calc-num-prefix (n)
   "Use the number at the top of stack as the numeric prefix for the next command.
 With a prefix, push that prefix as a number onto the stack."
@@ -165,6 +161,18 @@
   (interactive)
   (message "Calc %s" calc-version))
 
+;; The following caches are declared in other files, but are
+;; reset here.
+(defvar math-lud-cache) ; calc-mtx.el
+(defvar math-log2-cache) ; calc-bin.el
+(defvar math-radix-digits-cache) ; calc-bin.el
+(defvar math-radix-float-cache-tag) ; calc-bin.el
+(defvar math-random-cache) ; calc-comb.el
+(defvar math-max-digits-cache) ; calc-bin.el
+(defvar math-integral-cache) ; calcalg2.el
+(defvar math-units-table) ; calc-units.el
+(defvar math-format-date-cache) ; calc-forms.el
+(defvar math-holidays-cache-tag) ; calc-forms.el
 
 (defun calc-flush-caches (&optional inhibit-msg)
   (interactive "P")
@@ -175,13 +183,10 @@
 	 math-radix-float-cache-tag nil
 	 math-random-cache nil
 	 math-max-digits-cache nil
-	 math-checked-rewrites nil
 	 math-integral-cache nil
 	 math-units-table nil
 	 math-decls-cache-tag nil
 	 math-eval-rules-cache-tag t
-	 math-graph-var-cache nil
-	 math-graph-data-cache nil
 	 math-format-date-cache nil
 	 math-holidays-cache-tag t)
    (mapcar (function (lambda (x) (set x -100))) math-cache-list)
@@ -270,17 +275,22 @@
   (math-map-over-constants (function (lambda (x) (calcFunc-frac x tol)))
 			   a))
 
-(defun math-map-over-constants (func expr)
+;; The variable math-moc-func is local to math-map-over-constants,
+;; but is used by math-map-over-constants-rec, which is called by
+;; math-map-over-constants.
+(defvar math-moc-func)
+
+(defun math-map-over-constants (math-moc-func expr)
   (math-map-over-constants-rec expr))
 
 (defun math-map-over-constants-rec (expr)
   (cond ((or (Math-primp expr)
 	     (memq (car expr) '(intv sdev)))
 	 (or (and (Math-objectp expr)
-		  (funcall func expr))
+		  (funcall math-moc-func expr))
 	     expr))
 	((and (memq (car expr) '(^ calcFunc-subscr))
-	      (eq func 'math-float)
+	      (eq math-moc-func 'math-float)
 	      (= (length expr) 3)
 	      (Math-integerp (nth 2 expr)))
 	 (list (car expr)
@@ -288,5 +298,7 @@
 	       (nth 2 expr)))
 	(t (cons (car expr) (mapcar 'math-map-over-constants-rec (cdr expr))))))
 
+(provide 'calc-stuff)
+
 ;;; arch-tag: 789332ef-a178-49d3-8fb7-5d7ed7e21f56
 ;;; calc-stuff.el ends here
--- a/lisp/calc/calc-trail.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-trail.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-trail () nil)
-
-
 ;;; Trail commands.
 
 (defun calc-trail-in ()
@@ -177,5 +173,7 @@
        (kill-line n)))
    (calc-trail-here)))
 
+(provide 'calc-trail)
+
 ;;; arch-tag: 59b76655-d882-4aab-a3ee-b83870e530d0
 ;;; calc-trail.el ends here
--- a/lisp/calc/calc-undo.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-undo.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-undo () nil)
-
-
 ;;; Undo.
 
 (defun calc-undo (n)
@@ -150,5 +146,7 @@
        (or (eq (car (car list)) 'pop)
 	   (calc-undo-does-pushes (cdr list)))))
 
+(provide 'calc-undo)
+
 ;;; arch-tag: eeb485d2-fb3d-454a-9d79-450af1f50d6c
 ;;; calc-undo.el ends here
--- a/lisp/calc/calc-units.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-units.el	Wed Dec 08 22:20:27 2004 +0000
@@ -27,12 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-units () nil)
-
 ;;; Units operations.
 
 ;;; Units table last updated 9-Jan-91 by Ulrich Mueller (ulm@vsnhd1.cern.ch)
@@ -313,7 +311,8 @@
   (calc-slow-wrapper
    (let ((expr (calc-top-n 1))
 	 (uoldname nil)
-	 unew)
+	 unew
+         units)
      (unless (math-units-in-expr-p expr t)
        (let ((uold (or old-units
 		       (progn
@@ -409,20 +408,26 @@
    (calc-enter-result 1 "rmun" (math-simplify-units
 				(math-extract-units (calc-top-n 1))))))
 
+;; The variables calc-num-units and calc-den-units are local to 
+;; calc-explain-units, but are used by calc-explain-units-rec,
+;; which is called by calc-explain-units.
+(defvar calc-num-units)
+(defvar calc-den-units)
+
 (defun calc-explain-units ()
   (interactive)
   (calc-wrapper
-   (let ((num-units nil)
-	 (den-units nil))
+   (let ((calc-num-units nil)
+	 (calc-den-units nil))
      (calc-explain-units-rec (calc-top-n 1) 1)
-     (and den-units (string-match "^[^(].* .*[^)]$" den-units)
-	  (setq den-units (concat "(" den-units ")")))
-     (if num-units
-	 (if den-units
-	     (message "%s per %s" num-units den-units)
-	   (message "%s" num-units))
-       (if den-units
-	   (message "1 per %s" den-units)
+     (and calc-den-units (string-match "^[^(].* .*[^)]$" calc-den-units)
+	  (setq calc-den-units (concat "(" calc-den-units ")")))
+     (if calc-num-units
+	 (if calc-den-units
+	     (message "%s per %s" calc-num-units calc-den-units)
+	   (message "%s" calc-num-units))
+       (if calc-den-units
+	   (message "1 per %s" calc-den-units)
 	 (message "No units in expression"))))))
 
 (defun calc-explain-units-rec (expr pow)
@@ -463,11 +468,11 @@
 		 (setq name (concat name "^"
 				    (math-format-number (math-abs pow))))))
 	  (if (math-posp pow)
-	      (setq num-units (if num-units
-				  (concat num-units " " name)
+	      (setq calc-num-units (if calc-num-units
+				  (concat calc-num-units " " name)
 				name))
-	    (setq den-units (if den-units
-				(concat den-units " " name)
+	    (setq calc-den-units (if calc-den-units
+				(concat calc-den-units " " name)
 			      name))))
       (cond ((eq (car-safe expr) '*)
 	     (calc-explain-units-rec (nth 1 expr) pow)
@@ -615,12 +620,18 @@
      (save-buffer))))
 
 
+;; The variable math-cu-unit-list is local to math-build-units-table,
+;; but is used by math-compare-unit-names, which is called (indirectly)
+;; by math-build-units-table.
+;; math-cu-unit-list is also local to math-convert-units, but is used
+;; by math-convert-units-rec, which is called by math-convert-units.
+(defvar math-cu-unit-list)
 
 (defun math-build-units-table ()
   (or math-units-table
       (let* ((combined-units (append math-additional-units
 				     math-standard-units))
-	     (unit-list (mapcar 'car combined-units))
+	     (math-cu-unit-list (mapcar 'car combined-units))
 	     tab)
 	(message "Building units table...")
 	(setq math-units-table-buffer-valid nil)
@@ -646,28 +657,34 @@
 	(message "Building units table...done")
 	(setq math-units-table tab))))
 
-(defun math-find-base-units (entry)
-  (if (eq (nth 4 entry) 'boom)
-      (error "Circular definition involving unit %s" (car entry)))
-  (or (nth 4 entry)
-      (let (base)
-	(setcar (nthcdr 4 entry) 'boom)
-	(math-find-base-units-rec (nth 1 entry) 1)
-	'(or base
-	    (error "Dimensionless definition for unit %s" (car entry)))
-	(while (eq (cdr (car base)) 0)
-	  (setq base (cdr base)))
-	(let ((b base))
+;; The variables math-fbu-base and math-fbu-entry are local to
+;; math-find-base-units, but are used by math-find-base-units-rec,
+;; which is called by math-find-base-units.
+(defvar math-fbu-base)
+(defvar math-fbu-entry)
+
+(defun math-find-base-units (math-fbu-entry)
+  (if (eq (nth 4 math-fbu-entry) 'boom)
+      (error "Circular definition involving unit %s" (car math-fbu-entry)))
+  (or (nth 4 math-fbu-entry)
+      (let (math-fbu-base)
+	(setcar (nthcdr 4 math-fbu-entry) 'boom)
+	(math-find-base-units-rec (nth 1 math-fbu-entry) 1)
+	'(or math-fbu-base
+	    (error "Dimensionless definition for unit %s" (car math-fbu-entry)))
+	(while (eq (cdr (car math-fbu-base)) 0)
+	  (setq math-fbu-base (cdr math-fbu-base)))
+	(let ((b math-fbu-base))
 	  (while (cdr b)
 	    (if (eq (cdr (car (cdr b))) 0)
 		(setcdr b (cdr (cdr b)))
 	      (setq b (cdr b)))))
-	(setq base (sort base 'math-compare-unit-names))
-	(setcar (nthcdr 4 entry) base)
-	base)))
+	(setq math-fbu-base (sort math-fbu-base 'math-compare-unit-names))
+	(setcar (nthcdr 4 math-fbu-entry) math-fbu-base)
+	math-fbu-base)))
 
 (defun math-compare-unit-names (a b)
-  (memq (car b) (cdr (memq (car a) unit-list))))
+  (memq (car b) (cdr (memq (car a) math-cu-unit-list))))
 
 (defun math-find-base-units-rec (expr pow)
   (let ((u (math-check-unit-name expr)))
@@ -675,10 +692,11 @@
 	   (let ((ulist (math-find-base-units u)))
 	     (while ulist
 	       (let ((p (* (cdr (car ulist)) pow))
-		     (old (assq (car (car ulist)) base)))
+		     (old (assq (car (car ulist)) math-fbu-base)))
 		 (if old
 		     (setcdr old (+ (cdr old) p))
-		   (setq base (cons (cons (car (car ulist)) p) base))))
+		   (setq math-fbu-base 
+                         (cons (cons (car (car ulist)) p) math-fbu-base))))
 	       (setq ulist (cdr ulist)))))
 	  ((math-scalarp expr))
 	  ((and (eq (car expr) '^)
@@ -697,8 +715,8 @@
 	  ((eq (car expr) 'var)
 	   (or (eq (nth 1 expr) 'pi)
 	       (error "Unknown name %s in defining expression for unit %s"
-		      (nth 1 expr) (car entry))))
-	  (t (error "Malformed defining expression for unit %s" (car entry))))))
+		      (nth 1 expr) (car math-fbu-entry))))
+	  (t (error "Malformed defining expression for unit %s" (car math-fbu-entry))))))
 
 
 (defun math-units-in-expr-p (expr sub-exprs)
@@ -751,8 +769,12 @@
 			   (assq (intern (substring name 3))
 				 math-units-table))))))))
 
+;; The variable math-which-standard is local to math-to-standard-units,
+;; but is used by math-to-standard-rec, which is called by
+;; math-to-standard-units.
+(defvar math-which-standard)
 
-(defun math-to-standard-units (expr which-standard)
+(defun math-to-standard-units (expr math-which-standard)
   (math-to-standard-rec expr))
 
 (defun math-to-standard-rec (expr)
@@ -763,7 +785,7 @@
 	    (progn
 	      (if (nth 1 u)
 		  (setq expr (math-to-standard-rec (nth 1 u)))
-		(let ((st (assq (car u) which-standard)))
+		(let ((st (assq (car u) math-which-standard)))
 		  (if st
 		      (setq expr (nth 1 st))
 		    (setq expr (list 'var (car u)
@@ -842,9 +864,14 @@
 						unit nil))
 			  t)))
 
+;; The variable math-fcu-u is local to math-find-compatible-unit,
+;; but is used by math-find-compatible-rec which is called by
+;; math-find-compatible-unit.
+(defvar math-fcu-u)
+
 (defun math-find-compatible-unit (expr unit)
-  (let ((u (math-check-unit-name unit)))
-    (if u
+  (let ((math-fcu-u (math-check-unit-name unit)))
+    (if math-fcu-u
 	(math-find-compatible-unit-rec expr 1))))
 
 (defun math-find-compatible-unit-rec (expr pow)
@@ -859,39 +886,47 @@
 	 (math-find-compatible-unit-rec (nth 1 expr) (* pow (nth 2 expr))))
 	(t
 	 (let ((u2 (math-check-unit-name expr)))
-	   (if (equal (nth 4 u) (nth 4 u2))
+	   (if (equal (nth 4 math-fcu-u) (nth 4 u2))
 	       (cons expr pow))))))
 
-(defun math-convert-units (expr new-units &optional pure)
+;; The variables math-cu-new-units and math-cu-pure are local to 
+;; math-convert-units, but are used by math-convert-units-rec, 
+;; which is called by math-convert-units.
+(defvar math-cu-new-units)
+(defvar math-cu-pure)
+
+(defun math-convert-units (expr math-cu-new-units &optional math-cu-pure)
   (math-with-extra-prec 2
-    (let ((compat (and (not pure) (math-find-compatible-unit expr new-units)))
-	  (unit-list nil)
+    (let ((compat (and (not math-cu-pure) 
+                       (math-find-compatible-unit expr math-cu-new-units)))
+	  (math-cu-unit-list nil)
 	  (math-combining-units nil))
       (if compat
 	  (math-simplify-units
 	   (math-mul (math-mul (math-simplify-units
 				(math-div expr (math-pow (car compat)
 							 (cdr compat))))
-			       (math-pow new-units (cdr compat)))
+			       (math-pow math-cu-new-units (cdr compat)))
 		     (math-simplify-units
 		      (math-to-standard-units
-		       (math-pow (math-div (car compat) new-units)
+		       (math-pow (math-div (car compat) math-cu-new-units)
 				 (cdr compat))
 		       nil))))
-	(when (setq unit-list (math-decompose-units new-units))
-	  (setq new-units (nth 2 (car unit-list))))
+	(when (setq math-cu-unit-list (math-decompose-units math-cu-new-units))
+	  (setq math-cu-new-units (nth 2 (car math-cu-unit-list))))
 	(when (eq (car-safe expr) '+)
 	  (setq expr (math-simplify-units expr)))
 	(if (math-units-in-expr-p expr t)
 	    (math-convert-units-rec expr)
 	  (math-apply-units (math-to-standard-units
-			     (list '/ expr new-units) nil)
-			    new-units unit-list pure))))))
+			     (list '/ expr math-cu-new-units) nil)
+			    math-cu-new-units math-cu-unit-list math-cu-pure))))))
 
 (defun math-convert-units-rec (expr)
   (if (math-units-in-expr-p expr nil)
-      (math-apply-units (math-to-standard-units (list '/ expr new-units) nil)
-			new-units unit-list pure)
+      (math-apply-units (math-to-standard-units 
+                         (list '/ expr math-cu-new-units) nil)
+			math-cu-new-units math-cu-unit-list math-cu-pure)
     (if (Math-primp expr)
 	expr
       (cons (car expr)
@@ -1026,10 +1061,12 @@
 		       (setcar unitp pname)
 		       math-simplify-expr)))))))
 
+(defvar math-try-cancel-units)
+
 (math-defsimplify /
   (and math-simplifying-units
        (let ((np (cdr math-simplify-expr))
-	     (try-cancel-units 0)
+	     (math-try-cancel-units 0)
 	     n nn)
 	 (setq n (if (eq (car-safe (nth 2 math-simplify-expr)) '*)
 		     (cdr (nth 2 math-simplify-expr))
@@ -1044,7 +1081,7 @@
 	   (math-simplify-units-divisor (cdr n) (cdr (cdr math-simplify-expr)))
 	   (setq np (cdr (cdr n))))
 	 (math-simplify-units-divisor np (cdr (cdr math-simplify-expr)))
-	 (if (eq try-cancel-units 0)
+	 (if (eq math-try-cancel-units 0)
 	     (let* ((math-simplifying-units nil)
 		    (base (math-simplify 
                            (math-to-standard-units math-simplify-expr nil))))
@@ -1089,8 +1126,8 @@
 		 (setq ud1 ud)
 		 (while ud1
 		   (and (eq (car (car un)) (car (car ud1)))
-			(setq try-cancel-units
-			      (+ try-cancel-units
+			(setq math-try-cancel-units
+			      (+ math-try-cancel-units
 				 (- (* (cdr (car un)) pow1)
 				    (* (cdr (car ud)) pow2)))))
 		   (setq ud1 (cdr ud1)))
@@ -1304,6 +1341,8 @@
 	(pop-to-buffer (get-buffer "*Units Table*"))
       (display-buffer (get-buffer "*Units Table*")))))
 
+(provide 'calc-units)
+
 ;; Local Variables:
 ;; coding: iso-latin-1
 ;; End:
--- a/lisp/calc/calc-vec.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-vec.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-vec () nil)
-
-
 (defun calc-display-strings (n)
   (interactive "P")
   (calc-wrapper
@@ -1101,21 +1097,26 @@
       (cons 'vec (nreverse (sort (copy-sequence (cdr vec)) 'math-beforep)))
     (math-reject-arg vec 'vectorp)))
 
-(defun calcFunc-grade (grade-vec)
-  (if (math-vectorp grade-vec)
-      (let* ((len (1- (length grade-vec))))
+;; The variable math-grade-vec is local to calcFunc-grade and 
+;; calcFunc-rgrade, but is used by math-grade-beforep, which is called
+;; by calcFunc-grade and calcFunc-rgrade.
+(defvar math-grade-vec)
+
+(defun calcFunc-grade (math-grade-vec)
+  (if (math-vectorp math-grade-vec)
+      (let* ((len (1- (length math-grade-vec))))
 	(cons 'vec (sort (cdr (calcFunc-index len)) 'math-grade-beforep)))
-    (math-reject-arg grade-vec 'vectorp)))
+    (math-reject-arg math-grade-vec 'vectorp)))
 
-(defun calcFunc-rgrade (grade-vec)
-  (if (math-vectorp grade-vec)
-      (let* ((len (1- (length grade-vec))))
+(defun calcFunc-rgrade (math-grade-vec)
+  (if (math-vectorp math-grade-vec)
+      (let* ((len (1- (length math-grade-vec))))
 	(cons 'vec (nreverse (sort (cdr (calcFunc-index len))
 				   'math-grade-beforep))))
-    (math-reject-arg grade-vec 'vectorp)))
+    (math-reject-arg math-grade-vec 'vectorp)))
 
 (defun math-grade-beforep (i j)
-  (math-beforep (nth i grade-vec) (nth j grade-vec)))
+  (math-beforep (nth i math-grade-vec) (nth j math-grade-vec)))
 
 
 ;;; Compile a histogram of data from a vector.
@@ -1461,14 +1462,26 @@
 
 
 
-
+;; The variable math-rb-close is local to math-read-brackets, but
+;; is used by math-read-vector, which is called (directly and
+;; indirectly) by math-read-brackets.
+(defvar math-rb-close)
 
-(defun math-read-brackets (space-sep close)
+;; The next few variables are local to math-read-exprs in calc-aent.el 
+;; and math-read-expr in calc-ext.el, but are set in functions they call.
+(defvar math-exp-pos)
+(defvar math-exp-str)
+(defvar math-exp-old-pos)
+(defvar math-exp-token)
+(defvar math-exp-keep-spaces)
+(defvar math-expr-data)
+
+(defun math-read-brackets (space-sep math-rb-close)
   (and space-sep (setq space-sep (not (math-check-for-commas))))
   (math-read-token)
   (while (eq math-exp-token 'space)
     (math-read-token))
-  (if (or (equal math-expr-data close)
+  (if (or (equal math-expr-data math-rb-close)
 	  (eq math-exp-token 'end))
       (progn
 	(math-read-token)
@@ -1495,7 +1508,7 @@
 		  (setq vals2 (catch 'syntax (math-read-vector))))
 		(if (and (not (stringp vals2))
 			 (or (assoc math-expr-data '(("\\ldots") ("\\dots") (";")))
-			     (equal math-expr-data close)
+			     (equal math-expr-data math-rb-close)
 			     (eq math-exp-token 'end)))
 		    (setq space-sep nil
 			  vals vals2)
@@ -1509,7 +1522,7 @@
 	    (math-read-token)
 	    (setq vals (if (> (length vals) 2)
 			   (cons 'calcFunc-mul (cdr vals)) (nth 1 vals)))
-	    (let ((exp2 (if (or (equal math-expr-data close)
+	    (let ((exp2 (if (or (equal math-expr-data math-rb-close)
 				(equal math-expr-data ")")
 				(eq math-exp-token 'end))
 			    '(var inf var-inf)
@@ -1519,14 +1532,14 @@
 			  (if (equal math-expr-data ")") 2 3)
 			  vals
 			  exp2)))
-	    (if (not (or (equal math-expr-data close)
+	    (if (not (or (equal math-expr-data math-rb-close)
 			 (equal math-expr-data ")")
 			 (eq math-exp-token 'end)))
 		(throw 'syntax "Expected `]'")))
 	(if (equal math-expr-data ";")
 	    (let ((math-exp-keep-spaces space-sep))
 	      (setq vals (cons 'vec (math-read-matrix (list vals))))))
-	(if (not (or (equal math-expr-data close)
+	(if (not (or (equal math-expr-data math-rb-close)
 		     (eq math-exp-token 'end)))
 	    (throw 'syntax "Expected `]'")))
       (or (eq math-exp-token 'end)
@@ -1557,7 +1570,7 @@
 	       (math-read-token))
 	     (and (not (eq math-exp-token 'end))
 		  (not (equal math-expr-data ";"))
-		  (not (equal math-expr-data close))
+		  (not (equal math-expr-data math-rb-close))
 		  (not (equal math-expr-data "\\dots"))
 		  (not (equal math-expr-data "\\ldots"))))
       (if (equal math-expr-data ",")
@@ -1577,5 +1590,7 @@
     (setq mat (nconc mat (list (math-read-vector)))))
   mat)
 
+(provide 'calc-vec)
+
 ;;; arch-tag: 7902a7af-ec69-440a-8635-ebb4db263402
 ;;; calc-vec.el ends here
--- a/lisp/calc/calc-yank.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc-yank.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-yank () nil)
-
-
 ;;; Kill ring commands.
 
 (defun calc-kill (nn &optional no-delete)
@@ -428,6 +424,13 @@
   (define-key calc-edit-mode-map "\r" 'calc-edit-return)
   (define-key calc-edit-mode-map "\C-c\C-c" 'calc-edit-finish))
 
+(defvar calc-original-buffer)
+(defvar calc-return-buffer)
+(defvar calc-one-window)
+(defvar calc-edit-handler)
+(defvar calc-restore-trail)
+(defvar calc-allow-ret)
+
 (defun calc-edit-mode (&optional handler allow-ret title)
   "Calculator editing mode.  Press RET, LFD, or C-c C-c to finish.
 To cancel the edit, simply kill the *Calc Edit* buffer."
@@ -575,5 +578,7 @@
 		    (calc-enter-result num "edit" vals)
 		  (calc-enter-result 1 "edit" vals (- num))))))))))
 
+(provide 'calc-yank)
+
 ;;; arch-tag: ca61019e-caca-4daa-b32c-b6afe372d5b5
 ;;; calc-yank.el ends here
--- a/lisp/calc/calc.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calc.el	Wed Dec 08 22:20:27 2004 +0000
@@ -203,39 +203,12 @@
 
 ;;; Code:
 
-(provide 'calc)
 (require 'calc-macs)
 
-;;; The "###autoload" comment will be used by Emacs version 19 for
-;;; maintaining the loaddefs.el file automatically.
-
-;;;###autoload
-(defvar calc-info-filename "calc.info"
-  "*File name in which to look for the Calculator's Info documentation.")
-
 ;;;###autoload
 (defvar calc-settings-file user-init-file
   "*File in which to record permanent settings; default is `user-init-file'.")
 
-;;;###autoload
-(defvar calc-autoload-directory nil
-  "Name of directory from which additional \".elc\" files for Calc should be
-loaded.  Should include a trailing \"/\".
-If nil, use original installation directory.
-This can safely be nil as long as the Calc files are on the load-path.")
-
-;;;###autoload
-(defvar calc-gnuplot-name "gnuplot"
-  "*Name of GNUPLOT program, for calc-graph features.")
-
-;;;###autoload
-(defvar calc-gnuplot-plot-command nil
-  "*Name of command for displaying GNUPLOT output; %s = file name to print.")
-
-;;;###autoload
-(defvar calc-gnuplot-print-command "lp %s"
-  "*Name of command for printing GNUPLOT output; %s = file name to print.")
-
 (defvar calc-bug-address "belanger@truman.edu"
   "Address of the author of Calc, for use by `report-calc-bug'.")
 
@@ -243,15 +216,10 @@
   "If t, scan keymaps to find all DEL-like keys.
 if nil, only DEL itself is mapped to calc-pop.")
 
-(defvar calc-extensions-loaded nil)
-
 (defvar calc-stack '((top-of-stack 1 nil))
   "Calculator stack.
 Entries are 3-lists:  Formula, Height (in lines), Selection (or nil).")
 
-(defvar calc-show-banner t
-  "*If non-nil, show a friendly greeting above the stack.")
-
 (defvar calc-stack-top 1
   "Index into `calc-stack' of \"top\" of stack.
 This is 1 unless `calc-truncate-stack' has been used.")
@@ -589,7 +557,8 @@
   
   (calc-invocation-macro nil)
 
-  (calc-show-banner t))
+  (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)
@@ -704,14 +673,7 @@
 					 (directory-file-name
 					  (file-name-directory
 					   (expand-file-name
-					    name (car p2))))))))))
-
-	;; If calc-autoload-directory is given, use that (and hope it works!).
-	(and calc-autoload-directory
-	     (not (equal calc-autoload-directory ""))
-	     (setq load-path (nconc load-path
-				    (list (directory-file-name
-					   calc-autoload-directory)))))))
+					    name (car p2))))))))))))
 
 ;; The following modes use specially-formatted data.
 (put 'calc-mode 'mode-class 'special)
@@ -919,21 +881,20 @@
 	       ( ?? . calc-dispatch-help ) ))
     map))
 
-(autoload 'calc-extensions "calc-ext")
-(autoload 'calc-need-macros "calc-macs")
-
 ;;;; (Autoloads here)
 (mapcar
  (lambda (x) (dolist (func (cdr x)) (autoload func (car x))))
     '(
 
- ("calc-aent" calc-Need-calc-aent calc-alg-digit-entry calc-alg-entry
+ ("calc-aent" calc-alg-digit-entry calc-alg-entry
     calc-check-user-syntax calc-do-alg-entry calc-do-calc-eval
     calc-do-quick-calc calc-match-user-syntax math-build-parse-table
     math-find-user-tokens math-read-expr-list math-read-exprs math-read-if
     math-read-token math-remove-dashes)
 
- ("calc-misc" calc-Need-calc-misc
+ ("calc-embed" calc-do-embedded-activate)
+
+ ("calc-misc" 
     calc-do-handle-whys calc-do-refresh calc-num-prefix-name
     calc-record-list calc-record-why calc-report-bug calc-roll-down-stack
     calc-roll-up-stack calc-temp-minibuffer-message calcFunc-floor
@@ -991,7 +952,7 @@
     (message "")
     (if key
 	(progn
-	  (or (commandp key) (calc-extensions))
+	  (or (commandp key) (require 'calc-ext))
 	  (call-interactively key))
       (beep))))
 
@@ -1006,9 +967,7 @@
 	  (progn
 	    (use-global-map map)
 	    (use-local-map nil)
-	    (read-key-sequence
-	     (if (commandp (key-binding (vector (cdr key))))
-		 "" prompt2)))
+	    (read-key-sequence nil))
 	(use-global-map glob)
 	(use-local-map loc)))))
 
@@ -1050,7 +1009,7 @@
 	   (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list)
   (kill-all-local-variables)
   (use-local-map (if (eq calc-algebraic-mode 'total)
-		     (progn (calc-extensions) calc-alg-map) calc-mode-map))
+		     (progn (require 'calc-ext) calc-alg-map) calc-mode-map))
   (mapcar (function (lambda (v) (make-local-variable v))) calc-local-var-list)
   (make-local-variable 'overlay-arrow-position)
   (make-local-variable 'overlay-arrow-string)
@@ -1090,8 +1049,8 @@
 	  (setq plist (cdr (cdr plist))))
 	(if plist
 	    (save-excursion
-	      (calc-extensions)
-	      (calc-need-macros)
+	      (require 'calc-ext)
+	      (require 'calc-macs)
 	      (set-buffer "*Calculator*")
 	      (while plist
 		(put 'calc-define (car plist) nil)
@@ -1137,9 +1096,9 @@
       (calc-mode))
   (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
   (when calc-always-load-extensions
-    (calc-extensions))
+    (require 'calc-ext))
   (when calc-language
-    (calc-extensions)
+    (require 'calc-ext)
     (calc-set-language calc-language calc-language-option t)))
 
 ;;;###autoload
@@ -1148,7 +1107,7 @@
   (interactive "P\ni\np")
   (if arg
       (unless (eq arg 0)
-	(calc-extensions)
+	(require 'calc-ext)
 	(if (= (prefix-numeric-value arg) -1)
 	    (calc-grab-region (region-beginning) (region-end) nil)
 	  (when (= (prefix-numeric-value arg) -2)
@@ -1272,7 +1231,7 @@
 In this mode, click on the Calc \"buttons\" using the left mouse button.
 Or, position the cursor manually and do M-x calc-keypad-press."
   (interactive "p")
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-do-keypad calc-full-mode interactive))
 
 ;;;###autoload
@@ -1280,7 +1239,7 @@
   "Invoke the Calculator in full-screen \"visual keypad\" mode.
 See calc-keypad for details."
   (interactive "p")
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-do-keypad t interactive))
 
 
@@ -1294,7 +1253,7 @@
   (calc-check-defines)
   (let* ((calc-command-flags nil)
 	 (calc-start-time (and calc-timing (not calc-start-time)
-			       (calc-extensions)
+			       (require 'calc-ext)
 			       (current-time-string)))
 	 (gc-cons-threshold (max gc-cons-threshold
 				 (if calc-timing 2000000 100000)))
@@ -1307,7 +1266,7 @@
 		  (calc-embedded-select-buffer)
 		(calc-select-buffer))
 	      (and (eq calc-algebraic-mode 'total)
-		   (calc-extensions)
+		   (require 'calc-ext)
 		   (use-local-map calc-alg-map))
 	      (when (and do-slow calc-display-working-message)
 		(message "Working...")
@@ -1582,7 +1541,7 @@
 (defun calc-normalize (val)
   (if (memq calc-simplify-mode '(nil none num))
       (math-normalize val)
-    (calc-extensions)
+    (require 'calc-ext)
     (calc-normalize-fancy val)))
 
 (defun calc-handle-whys ()
@@ -1862,7 +1821,7 @@
       (calc-enter-result 2 name (cons (or func2 func)
 				      (mapcar 'math-check-complete
 					      (calc-top-list 2))))
-    (calc-extensions)
+    (require 'calc-ext)
     (calc-binary-op-fancy name func arg ident unary)))
 
 (defun calc-unary-op (name func arg &optional func2)
@@ -1870,7 +1829,7 @@
   (if (null arg)
       (calc-enter-result 1 name (list (or func2 func)
 				      (math-check-complete (calc-top 1))))
-    (calc-extensions)
+    (require 'calc-ext)
     (calc-unary-op-fancy name func arg)))
 
 
@@ -1982,7 +1941,7 @@
 						 calc-digit-value))))))
        (if (eq calc-prev-char 'dots)
 	   (progn
-	     (calc-extensions)
+	     (require 'calc-ext)
 	     (calc-dots)))))))
 
 (defsubst calc-minibuffer-size ()
@@ -2106,7 +2065,7 @@
 	(if (and (eq this-command last-command)
 		 (eq last-command-char ?.))
 	    (progn
-	      (calc-extensions)
+	      (require 'calc-ext)
 	      (calc-digit-dots))
 	  (delete-backward-char 1)
 	  (beep)
@@ -2281,11 +2240,11 @@
 	(integerp (car math-normalize-a))
 	(and (consp (car math-normalize-a)) 
              (not (eq (car (car math-normalize-a)) 'lambda))))
-    (calc-extensions)
+    (require 'calc-ext)
     (math-normalize-fancy math-normalize-a))
    (t
     (or (and calc-simplify-mode
-	     (calc-extensions)
+	     (require 'calc-ext)
 	     (math-normalize-nonstandard))
 	(let ((args (mapcar 'math-normalize (cdr math-normalize-a))))
 	  (or (condition-case err
@@ -2302,7 +2261,7 @@
 			     (progn
 			       (or (eq var-EvalRules math-eval-rules-cache-tag)
 				   (progn
-				     (calc-extensions)
+				     (require 'calc-ext)
 				     (math-recompile-eval-rules)))
 			       (and (or math-eval-rules-cache-other
 					(assq (car math-normalize-a) 
@@ -2315,8 +2274,8 @@
 			    (apply (cdr func) args)
 			  (and (or (consp (car math-normalize-a))
 				   (fboundp (car math-normalize-a))
-				   (and (not calc-extensions-loaded)
-					(calc-extensions)
+				   (and (not (featurep 'calc-ext))
+					(require 'calc-ext)
 					(fboundp (car math-normalize-a))))
 			       (apply (car math-normalize-a) args)))))
 		(wrong-number-of-arguments
@@ -2584,7 +2543,7 @@
 			   (cons 'bigpos diff))))
 		    (cons 'bigpos (math-add-bignum (cdr a) (cdr b)))))))
 	 (and (Math-ratp a) (Math-ratp b)
-	      (calc-extensions)
+	      (require 'calc-ext)
 	      (calc-add-fractions a b))
 	 (and (Math-realp a) (Math-realp b)
 	      (progn
@@ -2593,9 +2552,9 @@
 		(or (and (consp b) (eq (car b) 'float))
 		    (setq b (math-float b)))
 		(math-add-float a b)))
-	 (and (calc-extensions)
+	 (and (require 'calc-ext)
 	      (math-add-objects-fancy a b))))
-   (and (calc-extensions)
+   (and (require 'calc-ext)
 	(math-add-symb-fancy a b))))
 
 (defun math-add-bignum (a b)   ; [L L L; l l l]
@@ -2724,12 +2683,12 @@
    (and (Math-zerop a) (not (eq (car-safe b) 'mod))
 	(if (Math-scalarp b)
 	    (if (and (math-floatp b) (Math-ratp a)) (math-float a) a)
-	  (calc-extensions)
+	  (require 'calc-ext)
 	  (math-mul-zero a b)))
    (and (Math-zerop b) (not (eq (car-safe a) 'mod))
 	(if (Math-scalarp a)
 	    (if (and (math-floatp a) (Math-ratp b)) (math-float b) b)
-	  (calc-extensions)
+	  (require 'calc-ext)
 	  (math-mul-zero b a)))
    (and (Math-objvecp a) (Math-objvecp b)
 	(or
@@ -2745,7 +2704,7 @@
 			     (math-mul-bignum-digit (cdr a) (nth 1 b) 0))
 			 (math-mul-bignum-digit (cdr b) (nth 1 a) 0))))))
 	 (and (Math-ratp a) (Math-ratp b)
-	      (calc-extensions)
+	      (require 'calc-ext)
 	      (calc-mul-fractions a b))
 	 (and (Math-realp a) (Math-realp b)
 	      (progn
@@ -2755,9 +2714,9 @@
 		    (setq b (math-float b)))
 		(math-make-float (math-mul (nth 1 a) (nth 1 b))
 				 (+ (nth 2 a) (nth 2 b)))))
-	 (and (calc-extensions)
+	 (and (require 'calc-ext)
 	      (math-mul-objects-fancy a b))))
-   (and (calc-extensions)
+   (and (require 'calc-ext)
 	(math-mul-symb-fancy a b))))
 
 (defun math-infinitep (a &optional undir)
@@ -2913,12 +2872,12 @@
 (defun math-div (a b)
   (or
    (and (Math-zerop b)
-	(calc-extensions)
+	(require 'calc-ext)
 	(math-div-by-zero a b))
    (and (Math-zerop a) (not (eq (car-safe b) 'mod))
 	(if (Math-scalarp b)
 	    (if (and (math-floatp b) (Math-ratp a)) (math-float a) a)
-	  (calc-extensions)
+	  (require 'calc-ext)
 	  (math-div-zero a b)))
    (and (Math-objvecp a) (Math-objvecp b)
 	(or
@@ -2928,12 +2887,12 @@
 		    (car q)
 		  (if calc-prefer-frac
 		      (progn
-			(calc-extensions)
+			(require 'calc-ext)
 			(math-make-frac a b))
 		    (math-div-float (math-make-float a 0)
 				    (math-make-float b 0))))))
 	 (and (Math-ratp a) (Math-ratp b)
-	      (calc-extensions)
+	      (require 'calc-ext)
 	      (calc-div-fractions a b))
 	 (and (Math-realp a) (Math-realp b)
 	      (progn
@@ -2942,9 +2901,9 @@
 		(or (and (consp b) (eq (car b) 'float))
 		    (setq b (math-float b)))
 		(math-div-float a b)))
-	 (and (calc-extensions)
+	 (and (require 'calc-ext)
 	      (math-div-objects-fancy a b))))
-   (and (calc-extensions)
+   (and (require 'calc-ext)
 	(math-div-symb-fancy a b))))
 
 (defun math-div-float (a b)   ; [F F F]
@@ -2973,7 +2932,7 @@
 			(memq calc-language '(nil flat unform))
 			(null math-comp-selected))
 		   (math-format-number a))
-		  (t (calc-extensions)
+		  (t (require 'calc-ext)
 		     (math-compose-expr a 0))))
 	 (off (math-stack-value-offset c))
 	 s w)
@@ -2996,7 +2955,7 @@
 				c)))
     (unless (or (equal calc-right-label "")
 		(eq a 'top-of-stack))
-      (calc-extensions)
+      (require 'calc-ext)
       (setq c (list 'horiz c
 		    (make-string (max (- w (math-comp-width c)
 					 (length calc-right-label)) 0) ? )
@@ -3016,19 +2975,23 @@
     (setcar (cdr entry) (calc-count-lines s))
     s))
 
-(defun math-stack-value-offset (c)
+;; The variables math-svo-c, math-svo-wid and math-svo-off are local
+;; to math-stack-value-offset, but are used by math-stack-value-offset-fancy
+;; in calccomp.el.
+
+(defun math-stack-value-offset (math-svo-c)
   (let* ((num (if calc-line-numbering 4 0))
-	 (wid (calc-window-width))
-	 off)
+	 (math-svo-wid (calc-window-width))
+	 math-svo-off)
     (if calc-display-just
 	(progn
-	  (calc-extensions)
+	  (require 'calc-ext)
 	  (math-stack-value-offset-fancy))
-      (setq off (or calc-display-origin 0))
+      (setq math-svo-off (or calc-display-origin 0))
       (when (integerp calc-line-breaking)
-	(setq wid calc-line-breaking)))
-    (cons (max (- off (length calc-left-label)) 0)
-	  (+ wid num))))
+	(setq math-svo-wid calc-line-breaking)))
+    (cons (max (- math-svo-off (length calc-left-label)) 0)
+	  (+ math-svo-wid num))))
 
 (defun calc-count-lines (s)
   (let ((pos 0)
@@ -3042,7 +3005,7 @@
   (if (and (Math-scalarp a)
 	   (memq calc-language '(nil flat unform)))
       (math-format-number a)
-    (calc-extensions)
+    (require 'calc-ext)
     (let ((calc-line-breaking nil))
       (math-composition-to-string (math-compose-expr a 0) w))))
 
@@ -3078,7 +3041,7 @@
 	  (calc-language nil))
       (math-format-number a)))
    (t
-    (calc-extensions)
+    (require 'calc-ext)
     (math-format-flat-expr-fancy a prec))))
 
 
@@ -3088,7 +3051,7 @@
   (cond
    ((eq calc-display-raw t) (format "%s" a))
    ((and (nth 1 calc-frac-format) (Math-integerp a))
-    (calc-extensions)
+    (require 'calc-ext)
     (math-format-number (math-adjust-fraction a)))
    ((integerp a)
     (if (not (or calc-group-digits calc-leading-zeros))
@@ -3096,7 +3059,7 @@
 	    (int-to-string a)
 	  (if (< a 0)
 	      (concat "-" (math-format-number (- a)))
-	    (calc-extensions)
+	    (require 'calc-ext)
 	    (if math-radix-explicit-format
 		(if calc-radix-formatter
 		    (funcall calc-radix-formatter
@@ -3191,7 +3154,7 @@
 				  str (- eadj scale)))))))
 	str)))
    (t
-    (calc-extensions)
+    (require 'calc-ext)
     (math-format-number-fancy a prec))))
 
 (defun math-format-bignum (a)   ; [X L]
@@ -3199,7 +3162,7 @@
 	   (not calc-leading-zeros)
 	   (not calc-group-digits))
       (math-format-bignum-decimal a)
-    (calc-extensions)
+    (require 'calc-ext)
     (math-format-bignum-fancy a)))
 
 (defun math-format-bignum-decimal (a)   ; [X L]
@@ -3241,7 +3204,7 @@
 
     ;; Forms that require extensions module
     ((string-match "[^-+0-9eE.]" s)
-     (calc-extensions)
+     (require 'calc-ext)
      (math-read-number-fancy s))
 
     ;; Decimal point
@@ -3350,26 +3313,26 @@
 (defun calc-grab-region (top bot arg)
   "Parse the region as a vector of numbers and push it on the Calculator stack."
   (interactive "r\nP")
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-do-grab-region top bot arg))
 
 ;;;###autoload
 (defun calc-grab-rectangle (top bot arg)
   "Parse a rectangle as a matrix of numbers and push it on the Calculator stack."
   (interactive "r\nP")
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-do-grab-rectangle top bot arg))
 
 (defun calc-grab-sum-down (top bot arg)
   "Parse a rectangle as a matrix of numbers and sum its columns."
   (interactive "r\nP")
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-do-grab-rectangle top bot arg 'calcFunc-reduced))
 
 (defun calc-grab-sum-across (top bot arg)
   "Parse a rectangle as a matrix of numbers and sum its rows."
   (interactive "r\nP")
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-do-grab-rectangle top bot arg 'calcFunc-reducea))
 
 
@@ -3377,7 +3340,7 @@
 (defun calc-embedded (arg &optional end obeg oend)
   "Start Calc Embedded mode on the formula surrounding point."
   (interactive "P")
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-do-embedded arg end obeg oend))
 
 ;;;###autoload
@@ -3397,7 +3360,7 @@
 
 ;;;###autoload
 (defmacro defmath (func args &rest body)   ;  [Public]
-  (calc-extensions)
+  (require 'calc-ext)
   (math-do-defmath func args body))
 
 ;;; Functions needed for Lucid Emacs support.
@@ -3425,11 +3388,13 @@
     (setq unread-command-events nil)))
 
 (when calc-always-load-extensions
-  (calc-extensions)
+  (require 'calc-ext)
   (calc-load-everything))
 
 
 (run-hooks 'calc-load-hook)
 
+(provide 'calc)
+
 ;;; arch-tag: 0c3b170c-4ce6-4eaf-8d9b-5834d1fe938f
 ;;; calc.el ends here
--- a/lisp/calc/calcalg2.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calcalg2.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-alg-2 () nil)
-
-
 (defun calc-derivative (var num)
   (interactive "sDifferentiate with respect to: \np")
   (calc-slow-wrapper
@@ -1319,6 +1315,7 @@
 
 ;; The variable math-expr-parts is local to math-expr-rational-in,
 ;; but is used by math-expr-rational-in-rec
+(defvar math-expr-parts)
 
 (defun math-expr-rational-in (expr)
   (let ((math-expr-parts nil))
@@ -2279,6 +2276,7 @@
 ;; math-decompose-poly, but used by math-solve-poly-funny-powers.)
 (defvar math-solve-lhs)
 (defvar math-solve-rhs)
+(defvar math-try-solve-sign)
 
 (defun math-try-solve-for 
   (math-solve-lhs math-solve-rhs &optional math-try-solve-sign no-poly)
@@ -2565,6 +2563,7 @@
 ;;; This deals with negative, fractional, and symbolic powers of "x".
 ;; The variable math-solve-b is local to math-decompose-poly,
 ;; but is used by math-solve-poly-funny-powers.
+(defvar math-solve-b)
 
 (defun math-solve-poly-funny-powers (sub-rhs)    ; uses "t1", "t2"
   (setq math-t1 math-solve-lhs)
@@ -2798,6 +2797,8 @@
 ;; The variables math-int-scale, math-int-factors and math-double-roots
 ;; are local to math-poly-all-roots, but are used by math-poly-integer-root.
 (defvar math-int-scale)
+(defvar math-int-factors)
+(defvar math-double-roots)
 
 (defun math-poly-all-roots (var p &optional math-factoring)
   (catch 'ouch
@@ -3136,6 +3137,7 @@
 
 ;; The variable math-solve-simplifying is local to math-solve-system
 ;; and math-solve-system-rec, but is used by math-solve-system-subst.
+(defvar math-solve-simplifying)
 
 (defun math-solve-system (exprs math-solve-vars math-solve-full)
   (setq exprs (mapcar 'list (if (Math-vectorp exprs)
@@ -3578,5 +3580,7 @@
 		    (math-normalize accum))))
 	(list 'calcFunc-taylor expr var num))))
 
+(provide 'calcalg2)
+
 ;;; arch-tag: f2932ec8-dd63-418b-a542-11a644b9d4c4
 ;;; calcalg2.el ends here
--- a/lisp/calc/calcalg3.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calcalg3.el	Wed Dec 08 22:20:27 2004 +0000
@@ -27,13 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-alg-3 () nil)
-
-
 (defun calc-find-root (var)
   (interactive "sVariable(s) to solve for: ")
   (calc-slow-wrapper
@@ -1826,5 +1823,7 @@
     (while (setq expr (cdr expr))
       (math-all-vars-rec (car expr)))))
 
+(provide 'calcalg3)
+
 ;;; arch-tag: ff9f2920-8111-48b5-b3fa-b0682c3e44a6
 ;;; calcalg3.el ends here
--- a/lisp/calc/calccomp.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calccomp.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,12 +27,10 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-comp () nil)
-
 (defconst math-eqn-special-funcs
   '( calcFunc-log
      calcFunc-ln calcFunc-exp
@@ -62,6 +59,25 @@
 ;;;
 ;;;    (tag X C)             Composition C corresponds to sub-expression X
 
+;; math-comp-just and math-comp-comma-spc are local to 
+;; math-compose-expr, but are used by math-compose-matrix, which is 
+;; called by math-compose-expr
+(defvar math-comp-just)
+(defvar math-comp-comma-spc)
+
+;; math-comp-vector-prec is local to math-compose-expr, but is used by 
+;; math-compose-matrix and math-compose-rows, which are called by 
+;; math-compose-expr.
+(defvar math-comp-vector-prec)
+
+;; math-comp-left-bracket, math-comp-right-bracket and math-comp-comma are 
+;; local to math-compose-expr, but are used by math-compose-rows, which is 
+;; called by math-compose-expr.
+(defvar math-comp-left-bracket)
+(defvar math-comp-right-bracket)
+(defvar math-comp-comma)
+
+
 (defun math-compose-expr (a prec)
   (let ((math-compose-level (1+ math-compose-level)))
     (cond
@@ -154,21 +170,21 @@
 			  (and (setq temp2 (assq nil (cdr temp)))
 			       (funcall (cdr temp2) a))))))))
      ((eq (car a) 'vec)
-      (let* ((left-bracket (if calc-vector-brackets
+      (let* ((math-comp-left-bracket (if calc-vector-brackets
 			       (substring calc-vector-brackets 0 1) ""))
-	     (right-bracket (if calc-vector-brackets
+	     (math-comp-right-bracket (if calc-vector-brackets
 				(substring calc-vector-brackets 1 2) ""))
 	     (inner-brackets (memq 'R calc-matrix-brackets))
 	     (outer-brackets (memq 'O calc-matrix-brackets))
 	     (row-commas (memq 'C calc-matrix-brackets))
-	     (comma-spc (or calc-vector-commas " "))
-	     (comma (or calc-vector-commas ""))
-	     (vector-prec (if (or (and calc-vector-commas
+	     (math-comp-comma-spc (or calc-vector-commas " "))
+	     (math-comp-comma (or calc-vector-commas ""))
+	     (math-comp-vector-prec (if (or (and calc-vector-commas
 				       (math-vector-no-parens a))
 				  (memq 'P calc-matrix-brackets)) 0 1000))
-	     (just (cond ((eq calc-matrix-just 'right) 'vright)
-			 ((eq calc-matrix-just 'center) 'vcent)
-			 (t 'vleft)))
+	     (math-comp-just (cond ((eq calc-matrix-just 'right) 'vright)
+                                      ((eq calc-matrix-just 'center) 'vcent)
+                                      (t 'vleft)))
 	     (break calc-break-vectors))
 	(if (and (memq calc-language '(nil big))
 		 (not calc-break-vectors)
@@ -177,17 +193,17 @@
 		     (and (< (length a) 7) (< (length (nth 1 a)) 7))
 		     (progn (setq break t) nil)))
 	    (if (progn
-		  (setq vector-prec (if (or (and calc-vector-commas
-						 (math-vector-no-parens
-						  (nth 1 a)))
-					    (memq 'P calc-matrix-brackets))
-					0 1000))
+		  (setq math-comp-vector-prec (if (or (and calc-vector-commas
+                                                           (math-vector-no-parens
+                                                            (nth 1 a)))
+                                                      (memq 'P calc-matrix-brackets))
+                                                  0 1000))
 		  (= (length a) 2))
 		(list 'horiz
-		      (concat left-bracket left-bracket " ")
-		      (math-compose-vector (cdr (nth 1 a)) (concat comma " ")
-					   vector-prec)
-		      (concat " " right-bracket right-bracket))
+		      (concat math-comp-left-bracket math-comp-left-bracket " ")
+		      (math-compose-vector (cdr (nth 1 a)) (concat math-comp-comma " ")
+					   math-comp-vector-prec)
+		      (concat " " math-comp-right-bracket math-comp-right-bracket))
 	      (let* ((rows (1- (length a)))
 		     (cols (1- (length (nth 1 a))))
 		     (base (/ (1- rows) 2))
@@ -196,17 +212,17 @@
 			(list (append '(vleft)
 				      (list base)
 				      (list (concat (and outer-brackets
-							 (concat left-bracket
+							 (concat math-comp-left-bracket
 								 " "))
 						    (and inner-brackets
-							 (concat left-bracket
+							 (concat math-comp-left-bracket
 								 " "))))
 				      (make-list (1- rows)
 						 (concat (and outer-brackets
 							      "  ")
 							 (and inner-brackets
 							      (concat
-							       left-bracket
+							       math-comp-left-bracket
 							       " "))))))
 			(math-compose-matrix (cdr a) 1 cols base)
 			(list (append '(vleft)
@@ -214,20 +230,20 @@
 				      (make-list (1- rows)
 						 (if inner-brackets
 						     (concat " "
-							     right-bracket
+							     math-comp-right-bracket
 							     (and row-commas
-								  comma))
+								  math-comp-comma))
 						   (if (and outer-brackets
 							    row-commas)
 						       ";" "")))
 				      (list (concat
 					     (and inner-brackets
 						  (concat " "
-							  right-bracket))
+							  math-comp-right-bracket))
 					     (and outer-brackets
 						  (concat
 						   " "
-						   right-bracket)))))))))
+						   math-comp-right-bracket)))))))))
 	  (if (and calc-display-strings
 		   (cdr a)
 		   (math-vector-is-string a))
@@ -237,7 +253,6 @@
 		(let* ((full (or calc-full-vectors (< (length a) 7)))
 		       (rows (if full (1- (length a)) 5))
 		       (base (/ (1- rows) 2))
-		       (just 'vleft)
 		       (calc-break-vectors nil))
 		  (list 'horiz
 			(cons 'vleft (cons base
@@ -260,26 +275,29 @@
 			       (math-matrixp a))
 			  (list 'horiz
 				"matrix("
-				left-bracket
-				(math-compose-vector (cdr a) (concat comma " ")
-						     vector-prec)
-				right-bracket
+				math-comp-left-bracket
+				(math-compose-vector (cdr a) 
+                                                     (concat math-comp-comma " ")
+						     math-comp-vector-prec)
+				math-comp-right-bracket
 				")")
 			(list 'horiz
-			      left-bracket
-			      (math-compose-vector (cdr a) (concat comma " ")
-						   vector-prec)
-			      right-bracket))))
+			      math-comp-left-bracket
+			      (math-compose-vector (cdr a) 
+                                                   (concat math-comp-comma " ")
+						   math-comp-vector-prec)
+			      math-comp-right-bracket))))
 		(list 'horiz
-		      left-bracket
+		      math-comp-left-bracket
 		      (math-compose-vector (list (nth 1 a) (nth 2 a) (nth 3 a))
-					   (concat comma " ") vector-prec)
-		      comma (if (eq calc-language 'tex) " \\ldots" " ...")
-		      comma " "
+					   (concat math-comp-comma " ") 
+                                           math-comp-vector-prec)
+		      math-comp-comma (if (eq calc-language 'tex) " \\ldots" " ...")
+		      math-comp-comma " "
 		      (list 'break math-compose-level)
 		      (math-compose-expr (nth (1- (length a)) a)
-					 (if (equal comma "") 1000 0))
-		      right-bracket)))))))
+					 (if (equal math-comp-comma "") 1000 0))
+		      math-comp-right-bracket)))))))
      ((eq (car a) 'incomplete)
       (if (cdr (cdr a))
 	  (cond ((eq (nth 1 a) 'vec)
@@ -929,17 +947,18 @@
   (let ((col 0)
 	(res nil))
     (while (<= (setq col (1+ col)) cols)
-      (setq res (cons (cons just
+      (setq res (cons (cons math-comp-just
 			    (cons base
 				  (mapcar (function
 					   (lambda (r)
 					     (list 'horiz
 						   (math-compose-expr
 						    (nth col r)
-						    vector-prec)
+						    math-comp-vector-prec)
 						   (if (= col cols)
 						       ""
-						     (concat comma-spc " ")))))
+						     (concat 
+                                                      math-comp-comma-spc " ")))))
 					  a)))
 		      res)))
     (nreverse res)))
@@ -950,17 +969,17 @@
 	  (if (< count 0)
 	      (math-compose-rows (cdr a) -1 nil)
 	    (cons (concat (if (eq calc-language 'tex) "  \\ldots" "  ...")
-			  comma)
+			  math-comp-comma)
 		  (math-compose-rows (cdr a) -1 nil)))
 	(cons (list 'horiz
-		    (if first (concat left-bracket " ") "  ")
-		    (math-compose-expr (car a) vector-prec)
-		    comma)
+		    (if first (concat math-comp-left-bracket " ") "  ")
+		    (math-compose-expr (car a) math-comp-vector-prec)
+		    math-comp-comma)
 	      (math-compose-rows (cdr a) (1- count) nil)))
     (list (list 'horiz
-		(if first (concat left-bracket " ") "  ")
-		(math-compose-expr (car a) vector-prec)
-		(concat " " right-bracket)))))
+		(if first (concat math-comp-left-bracket " ") "  ")
+		(math-compose-expr (car a) math-comp-vector-prec)
+		(concat " " math-comp-right-bracket)))))
 
 (defun math-compose-tex-matrix (a)
   (if (cdr a)
@@ -1202,15 +1221,21 @@
 	       expr
 	       (if (memq prec '(196 201)) ")" "")))))
 
+;; The variables math-svo-c, math-svo-wid and math-svo-off are local
+;; to math-stack-value-offset in calc.el, but are used by 
+;; math-stack-value-offset-fancy, which is called by math-stack-value-offset..
+(defvar math-svo-c)
+(defvar math-svo-wid)
+(defvar math-svo-off)
 
 (defun math-stack-value-offset-fancy ()
-  (let ((cwid (+ (math-comp-width c))))
+  (let ((cwid (+ (math-comp-width math-svo-c))))
     (cond ((eq calc-display-just 'right)
 	   (if calc-display-origin
-	       (setq wid (max calc-display-origin 5))
+	       (setq math-svo-wid (max calc-display-origin 5))
 	     (if (integerp calc-line-breaking)
-		 (setq wid calc-line-breaking)))
-	   (setq off (- wid cwid
+		 (setq math-svo-wid calc-line-breaking)))
+	   (setq math-svo-off (- math-svo-wid cwid
 			(max (- (length calc-right-label)
 				(if (and (integerp calc-line-breaking)
 					 calc-display-origin)
@@ -1222,21 +1247,20 @@
 	  (t
 	   (if calc-display-origin
 	       (progn
-		 (setq off (- calc-display-origin (/ cwid 2)))
+		 (setq math-svo-off (- calc-display-origin (/ cwid 2)))
 		 (if (integerp calc-line-breaking)
-		     (setq off (min off (- calc-line-breaking cwid
+		     (setq math-svo-off (min math-svo-off (- calc-line-breaking cwid
 					   (length calc-right-label)))))
-		 (if (>= off 0)
-		     (setq wid (max wid (+ off cwid)))))
+		 (if (>= math-svo-off 0)
+		     (setq math-svo-wid (max math-svo-wid (+ math-svo-off cwid)))))
 	     (if (integerp calc-line-breaking)
-		 (setq wid calc-line-breaking))
-	     (setq off (/ (- wid cwid) 2)))))
+		 (setq math-svo-wid calc-line-breaking))
+	     (setq math-svo-off (/ (- math-svo-wid cwid) 2)))))
     (and (integerp calc-line-breaking)
-	 (or (< off 0)
+	 (or (< math-svo-off 0)
 	     (and calc-display-origin
 		  (> calc-line-breaking calc-display-origin)))
-	 (setq wid calc-line-breaking))))
-
+	 (setq math-svo-wid calc-line-breaking))))
 
 
 ;;; Convert a composition to string form, with embedded \n's if necessary.
@@ -1273,40 +1297,59 @@
 ;;; lines if necessary, choosing break points according to the structure
 ;;; of the formula.
 
-(defun math-comp-to-string-flat (c full-width)
+;; The variables math-comp-full-width, math-comp-highlight, math-comp-word,
+;; math-comp-level, math-comp-margin and math-comp-buf are local to 
+;; math-comp-to-string-flat, but are used by math-comp-to-string-flat-term, 
+;; which is called by math-comp-to-string-flat.
+;; math-comp-highlight and math-comp-buf are also local to 
+;; math-comp-simplify-term and math-comp-simplify respectively, but are used 
+;; by math-comp-add-string.
+(defvar math-comp-full-width)
+(defvar math-comp-highlight)
+(defvar math-comp-word)
+(defvar math-comp-level)
+(defvar math-comp-margin)
+(defvar math-comp-buf)
+;; The variable math-comp-pos is local to math-comp-to-string-flat, but
+;; is used by math-comp-to-string-flat-term and math-comp-sel-first-term,
+;; which are called by math-comp-to-string-flat.
+(defvar math-comp-pos)
+
+(defun math-comp-to-string-flat (c math-comp-full-width)
   (if math-comp-sel-hpos
-      (let ((comp-pos 0))
+      (let ((math-comp-pos 0))
 	(math-comp-sel-flat-term c))
-    (let ((comp-buf "")
-	  (comp-word "")
-	  (comp-pos 0)
-	  (comp-margin 0)
-	  (comp-highlight (and math-comp-selected calc-show-selections))
-	  (comp-level -1))
+    (let ((math-comp-buf "")
+	  (math-comp-word "")
+	  (math-comp-pos 0)
+	  (math-comp-margin 0)
+	  (math-comp-highlight (and math-comp-selected calc-show-selections))
+	  (math-comp-level -1))
       (math-comp-to-string-flat-term '(set -1 0))
       (math-comp-to-string-flat-term c)
       (math-comp-to-string-flat-term '(break -1))
       (let ((str (aref math-comp-buf-string 0))
 	    (prefix ""))
 	(and (> (length str) 0) (= (aref str 0) ? )
-	     (> (length comp-buf) 0)
-	     (let ((k (length comp-buf)))
-	       (while (not (= (aref comp-buf (setq k (1- k))) ?\n)))
-	       (aset comp-buf k ? )
-	       (if (and (< (1+ k) (length comp-buf))
-			(= (aref comp-buf (1+ k)) ? ))
+	     (> (length math-comp-buf) 0)
+	     (let ((k (length math-comp-buf)))
+	       (while (not (= (aref math-comp-buf (setq k (1- k))) ?\n)))
+	       (aset math-comp-buf k ? )
+	       (if (and (< (1+ k) (length math-comp-buf))
+			(= (aref math-comp-buf (1+ k)) ? ))
 		   (progn
-		     (aset comp-buf (1+ k) ?\n)
+		     (aset math-comp-buf (1+ k) ?\n)
 		     (setq prefix " "))
 		 (setq prefix "\n"))))
-	(concat comp-buf prefix str)))))
+	(concat math-comp-buf prefix str)))))
 
 (defun math-comp-to-string-flat-term (c)
   (cond ((not (consp c))
-	 (if comp-highlight
+	 (if math-comp-highlight
 	     (setq c (math-comp-highlight-string c)))
-	 (setq comp-word (if (= (length comp-word) 0) c (concat comp-word c))
-	       comp-pos (+ comp-pos (length c))))
+	 (setq math-comp-word (if (= (length math-comp-word) 0) c 
+                                (concat math-comp-word c))
+	       math-comp-pos (+ math-comp-pos (length c))))
 
 	((eq (car c) 'horiz)
 	 (while (setq c (cdr c))
@@ -1315,83 +1358,83 @@
 	((eq (car c) 'set)
 	 (if (nth 1 c)
 	     (progn
-	       (setq comp-level (1+ comp-level))
-	       (if (>= comp-level (length math-comp-buf-string))
+	       (setq math-comp-level (1+ math-comp-level))
+	       (if (>= math-comp-level (length math-comp-buf-string))
 		   (setq math-comp-buf-string (vconcat math-comp-buf-string
 						       math-comp-buf-string)
 			 math-comp-buf-margin (vconcat math-comp-buf-margin
 						       math-comp-buf-margin)
 			 math-comp-buf-level (vconcat math-comp-buf-level
 						      math-comp-buf-level)))
-	       (aset math-comp-buf-string comp-level "")
-	       (aset math-comp-buf-margin comp-level (+ comp-pos
+	       (aset math-comp-buf-string math-comp-level "")
+	       (aset math-comp-buf-margin math-comp-level (+ math-comp-pos
 							(or (nth 2 c) 0)))
-	       (aset math-comp-buf-level comp-level (nth 1 c)))))
+	       (aset math-comp-buf-level math-comp-level (nth 1 c)))))
 
 	((eq (car c) 'break)
 	 (if (not calc-line-breaking)
-	     (setq comp-buf (concat comp-buf comp-word)
-		   comp-word "")
+	     (setq math-comp-buf (concat math-comp-buf math-comp-word)
+		   math-comp-word "")
 	   (let ((i 0) str)
-	     (if (and (> comp-pos full-width)
+	     (if (and (> math-comp-pos math-comp-full-width)
 		      (progn
 			(while (progn
 				 (setq str (aref math-comp-buf-string i))
-				 (and (= (length str) 0) (< i comp-level)))
+				 (and (= (length str) 0) (< i math-comp-level)))
 			  (setq i (1+ i)))
-			(or (> (length str) 0) (> (length comp-buf) 0))))
+			(or (> (length str) 0) (> (length math-comp-buf) 0))))
 		 (let ((prefix "") mrg wid)
 		   (setq mrg (aref math-comp-buf-margin i))
 		   (if (> mrg 12)  ; indenting too far, go back to far left
 		       (let ((j i) (new (if calc-line-numbering 5 1)))
-			 '(while (<= j comp-level)
+			 '(while (<= j math-comp-level)
 			   (aset math-comp-buf-margin j
 				 (+ (aref math-comp-buf-margin j) (- new mrg)))
 			   (setq j (1+ j)))
 			 (setq mrg new)))
-		   (setq wid (+ (length str) comp-margin))
+		   (setq wid (+ (length str) math-comp-margin))
 		   (and (> (length str) 0) (= (aref str 0) ? )
-			(> (length comp-buf) 0)
-			(let ((k (length comp-buf)))
-			  (while (not (= (aref comp-buf (setq k (1- k))) ?\n)))
-			  (aset comp-buf k ? )
-			  (if (and (< (1+ k) (length comp-buf))
-				   (= (aref comp-buf (1+ k)) ? ))
+			(> (length math-comp-buf) 0)
+			(let ((k (length math-comp-buf)))
+			  (while (not (= (aref math-comp-buf (setq k (1- k))) ?\n)))
+			  (aset math-comp-buf k ? )
+			  (if (and (< (1+ k) (length math-comp-buf))
+				   (= (aref math-comp-buf (1+ k)) ? ))
 			      (progn
-				(aset comp-buf (1+ k) ?\n)
+				(aset math-comp-buf (1+ k) ?\n)
 				(setq prefix " "))
 			    (setq prefix "\n"))))
-		   (setq comp-buf (concat comp-buf prefix str "\n"
+		   (setq math-comp-buf (concat math-comp-buf prefix str "\n"
 					  (make-string mrg ? ))
-			 comp-pos (+ comp-pos (- mrg wid))
-			 comp-margin mrg)
+			 math-comp-pos (+ math-comp-pos (- mrg wid))
+			 math-comp-margin mrg)
 		   (aset math-comp-buf-string i "")
-		   (while (<= (setq i (1+ i)) comp-level)
+		   (while (<= (setq i (1+ i)) math-comp-level)
 		     (if (> (aref math-comp-buf-margin i) wid)
 			 (aset math-comp-buf-margin i
 			       (+ (aref math-comp-buf-margin i)
 				  (- mrg wid))))))))
-	   (if (and (= (nth 1 c) (aref math-comp-buf-level comp-level))
-		    (< comp-pos (+ (aref math-comp-buf-margin comp-level) 2)))
+	   (if (and (= (nth 1 c) (aref math-comp-buf-level math-comp-level))
+		    (< math-comp-pos (+ (aref math-comp-buf-margin math-comp-level) 2)))
 	       ()  ; avoid stupid breaks, e.g., "1 +\n really_long_expr"
-	     (let ((str (aref math-comp-buf-string comp-level)))
+	     (let ((str (aref math-comp-buf-string math-comp-level)))
 	       (setq str (if (= (length str) 0)
-			     comp-word
-			   (concat str comp-word))
-		     comp-word "")
-	       (while (< (nth 1 c) (aref math-comp-buf-level comp-level))
-		 (setq comp-level (1- comp-level))
-		 (or (= (length (aref math-comp-buf-string comp-level)) 0)
-		     (setq str (concat (aref math-comp-buf-string comp-level)
+			     math-comp-word
+			   (concat str math-comp-word))
+		     math-comp-word "")
+	       (while (< (nth 1 c) (aref math-comp-buf-level math-comp-level))
+		 (setq math-comp-level (1- math-comp-level))
+		 (or (= (length (aref math-comp-buf-string math-comp-level)) 0)
+		     (setq str (concat (aref math-comp-buf-string math-comp-level)
 				       str))))
-	       (aset math-comp-buf-string comp-level str)))))
+	       (aset math-comp-buf-string math-comp-level str)))))
 
 	((eq (car c) 'tag)
 	 (cond ((eq (nth 1 c) math-comp-selected)
-		(let ((comp-highlight (not calc-show-selections)))
+		(let ((math-comp-highlight (not calc-show-selections)))
 		  (math-comp-to-string-flat-term (nth 2 c))))
 	       ((eq (nth 1 c) t)
-		(let ((comp-highlight nil))
+		(let ((math-comp-highlight nil))
 		  (math-comp-to-string-flat-term (nth 2 c))))
 	       (t (math-comp-to-string-flat-term (nth 2 c)))))
 
@@ -1405,18 +1448,25 @@
 	  (aset s i (if calc-show-selections ?\. ?\#)))))
   s)
 
+
+;; The variable math-comp-sel-tag is local to calc-find-selected-part
+;; in calc-sel.el, but is used by math-comp-sel-flat-term and 
+;; math-comp-add-string-sel, which are called (indirectly) by 
+;; calc-find-selected-part.
+(defvar math-comp-sel-tag)
+
 (defun math-comp-sel-flat-term (c)
   (cond ((not (consp c))
-	 (setq comp-pos (+ comp-pos (length c))))
+	 (setq math-comp-pos (+ math-comp-pos (length c))))
 	((memq (car c) '(set break)))
 	((eq (car c) 'horiz)
 	 (while (and (setq c (cdr c)) (< math-comp-sel-cpos 1000000))
 	   (math-comp-sel-flat-term (car c))))
 	((eq (car c) 'tag)
-	 (if (<= comp-pos math-comp-sel-cpos)
+	 (if (<= math-comp-pos math-comp-sel-cpos)
 	     (progn
 	       (math-comp-sel-flat-term (nth 2 c))
-	       (if (> comp-pos math-comp-sel-cpos)
+	       (if (> math-comp-pos math-comp-sel-cpos)
 		   (setq math-comp-sel-tag c
 			 math-comp-sel-cpos 1000000)))
 	   (math-comp-sel-flat-term (nth 2 c))))
@@ -1427,35 +1477,47 @@
 ;;;   (vleft n "string" "string" "string" ...)
 ;;; where 0 <= n < number-of-strings.
 
+;; The variables math-comp-base, math-comp-hgt, math-comp-tag,
+;; math-comp-hpos and math-comp-vpos are local to math-comp-simplify,
+;; but are used by math-comp-add-string (math-comp-base, math-comp-hgt),
+;; math-comp-add-string-sel (math-comp-tag) and math-comp-simplify-term
+;; (math-comp-tag, math-comp-vpos, math-comp-hpos), which are called by
+;; math-comp-simplify.
+(defvar math-comp-base)
+(defvar math-comp-hgt)
+(defvar math-comp-tag)
+(defvar math-comp-hpos)
+(defvar math-comp-vpos)
+
 (defun math-comp-simplify (c full-width)
-  (let ((comp-buf (list ""))
-	(comp-base 0)
-	(comp-height 1)
-	(comp-hpos 0)
-	(comp-vpos 0)
-	(comp-highlight (and math-comp-selected calc-show-selections))
-	(comp-tag nil))
+  (let ((math-comp-buf (list ""))
+	(math-comp-base 0)
+	(math-comp-hgt 1)
+	(math-comp-hpos 0)
+	(math-comp-vpos 0)
+	(math-comp-highlight (and math-comp-selected calc-show-selections))
+	(math-comp-tag nil))
     (math-comp-simplify-term c)
-    (cons 'vleft (cons comp-base comp-buf))))
+    (cons 'vleft (cons math-comp-base math-comp-buf))))
 
 (defun math-comp-add-string (s h v)
   (and (> (length s) 0)
-       (let ((vv (+ v comp-base)))
+       (let ((vv (+ v math-comp-base)))
 	 (if math-comp-sel-hpos
 	     (math-comp-add-string-sel h vv (length s) 1)
 	   (if (< vv 0)
-	       (setq comp-buf (nconc (make-list (- vv) "") comp-buf)
-		     comp-base (- v)
-		     comp-height (- comp-height vv)
+	       (setq math-comp-buf (nconc (make-list (- vv) "") math-comp-buf)
+		     math-comp-base (- v)
+		     math-comp-hgt (- math-comp-hgt vv)
 		     vv 0)
-	     (if (>= vv comp-height)
-		 (setq comp-buf (nconc comp-buf
-				       (make-list (1+ (- vv comp-height)) ""))
-		       comp-height (1+ vv))))
-	   (let ((str (nthcdr vv comp-buf)))
+	     (if (>= vv math-comp-hgt)
+		 (setq math-comp-buf (nconc math-comp-buf
+				       (make-list (1+ (- vv math-comp-hgt)) ""))
+		       math-comp-hgt (1+ vv))))
+	   (let ((str (nthcdr vv math-comp-buf)))
 	     (setcar str (concat (car str)
 				 (make-string (- h (length (car str))) 32)
-				 (if comp-highlight
+				 (if math-comp-highlight
 				     (math-comp-highlight-string s)
 				   s))))))))
 
@@ -1464,20 +1526,20 @@
 	   (> (+ y h) math-comp-sel-vpos)
 	   (<= x math-comp-sel-hpos)
 	   (> (+ x w) math-comp-sel-hpos))
-      (setq math-comp-sel-tag comp-tag
+      (setq math-comp-sel-tag math-comp-tag
 	    math-comp-sel-vpos 10000)))
 
 (defun math-comp-simplify-term (c)
   (cond ((stringp c)
-	 (math-comp-add-string c comp-hpos comp-vpos)
-	 (setq comp-hpos (+ comp-hpos (length c))))
+	 (math-comp-add-string c math-comp-hpos math-comp-vpos)
+	 (setq math-comp-hpos (+ math-comp-hpos (length c))))
 	((memq (car c) '(set break))
 	 nil)
 	((eq (car c) 'horiz)
 	 (while (setq c (cdr c))
 	   (math-comp-simplify-term (car c))))
 	((memq (car c) '(vleft vcent vright))
-	 (let* ((comp-vpos (+ (- comp-vpos (nth 1 c))
+	 (let* ((math-comp-vpos (+ (- math-comp-vpos (nth 1 c))
 			      (1- (math-comp-ascent (nth 2 c)))))
 		(widths (mapcar 'math-comp-width (cdr (cdr c))))
 		(maxwid (apply 'max widths))
@@ -1488,53 +1550,53 @@
 	   (while (setq c (cdr c))
 	     (if (eq (car-safe (car c)) 'rule)
 		 (math-comp-add-string (make-string maxwid (nth 1 (car c)))
-				       comp-hpos comp-vpos)
-	       (let ((comp-hpos (+ comp-hpos (/ (* bias (- maxwid
+				       math-comp-hpos math-comp-vpos)
+	       (let ((math-comp-hpos (+ math-comp-hpos (/ (* bias (- maxwid
 							   (car widths)))
 						2))))
 		 (math-comp-simplify-term (car c))))
 	     (and (cdr c)
-		  (setq comp-vpos (+ comp-vpos
+		  (setq math-comp-vpos (+ math-comp-vpos
 				     (+ (math-comp-descent (car c))
 					(math-comp-ascent (nth 1 c))))
 			widths (cdr widths))))
-	   (setq comp-hpos (+ comp-hpos maxwid))))
+	   (setq math-comp-hpos (+ math-comp-hpos maxwid))))
 	((eq (car c) 'supscr)
 	 (let* ((asc (or 1 (math-comp-ascent (nth 1 c))))
 		(desc (math-comp-descent (nth 2 c)))
 		(oldh (prog1
-			  comp-hpos
+			  math-comp-hpos
 			(math-comp-simplify-term (nth 1 c))))
-		(comp-vpos (- comp-vpos (+ asc desc))))
+		(math-comp-vpos (- math-comp-vpos (+ asc desc))))
 	   (math-comp-simplify-term (nth 2 c))
 	   (if math-comp-sel-hpos
 	       (math-comp-add-string-sel oldh
-					 (- comp-vpos
+					 (- math-comp-vpos
 					    -1
 					    (math-comp-ascent (nth 2 c)))
-					 (- comp-hpos oldh)
+					 (- math-comp-hpos oldh)
 					 (math-comp-height c)))))
 	((eq (car c) 'subscr)
 	 (let* ((asc (math-comp-ascent (nth 2 c)))
 		(desc (math-comp-descent (nth 1 c)))
-		(oldv comp-vpos)
+		(oldv math-comp-vpos)
 		(oldh (prog1
-			  comp-hpos
+			  math-comp-hpos
 			(math-comp-simplify-term (nth 1 c))))
-		(comp-vpos (+ comp-vpos (+ asc desc))))
+		(math-comp-vpos (+ math-comp-vpos (+ asc desc))))
 	   (math-comp-simplify-term (nth 2 c))
 	   (if math-comp-sel-hpos
 	       (math-comp-add-string-sel oldh oldv
-					 (- comp-hpos oldh)
+					 (- math-comp-hpos oldh)
 					 (math-comp-height c)))))
 	((eq (car c) 'tag)
 	 (cond ((eq (nth 1 c) math-comp-selected)
-		(let ((comp-highlight (not calc-show-selections)))
+		(let ((math-comp-highlight (not calc-show-selections)))
 		  (math-comp-simplify-term (nth 2 c))))
 	       ((eq (nth 1 c) t)
-		(let ((comp-highlight nil))
+		(let ((math-comp-highlight nil))
 		  (math-comp-simplify-term (nth 2 c))))
-	       (t (let ((comp-tag c))
+	       (t (let ((math-comp-tag c))
 		    (math-comp-simplify-term (nth 2 c))))))))
 
 
@@ -1707,5 +1769,7 @@
 	      (math-comp-to-string-raw-step (cdr cl) indent))
     ""))
 
+(provide 'calccomp)
+
 ;;; arch-tag: 7c45d10a-a286-4dab-af49-7ae8989fbf78
 ;;; calccomp.el ends here
--- a/lisp/calc/calcsel2.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calc/calcsel2.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3,8 +3,7 @@
 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;;              Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <belanger@truman.edu>
 
 ;; This file is part of GNU Emacs.
 
@@ -28,12 +27,12 @@
 ;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
+
 (require 'calc-ext)
-
 (require 'calc-macs)
 
-(defun calc-Need-calc-sel-2 () nil)
-
+;; The variable calc-keep-selection is declared and set in calc-sel.el.
+(defvar calc-keep-selection)
 
 (defun calc-commute-left (arg)
   (interactive "p")
@@ -296,5 +295,7 @@
   (interactive "P")
   (calc-rewrite-selection "InvertRules" many "jinv"))
 
+(provide 'calcsel2)
+
 ;;; arch-tag: 7c5b8d65-b8f0-45d9-820d-9930f8ee114b
 ;;; calcsel2.el ends here
--- a/lisp/calendar/holidays.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/calendar/holidays.el	Wed Dec 08 22:20:27 2004 +0000
@@ -400,46 +400,88 @@
              (string (if date (eval string))))
         (list (list date string)))))))
 
-(defun holiday-advent (n string)
-  "Date of Nth day after advent (named STRING), if visible in calendar window."
-  (let ((year displayed-year)
-        (month displayed-month))
-    (increment-calendar-month month year -1)
-    (let ((advent (calendar-gregorian-from-absolute
-                   (+ n
-                      (calendar-dayname-on-or-before
-                       0
-                       (calendar-absolute-from-gregorian
-                        (list 12 3 year)))))))
-      (if (calendar-date-is-visible-p advent)
-          (list (list advent string))))))
+(defun holiday-advent (&optional n string)
+  "Date of Nth day after advent (named STRING), if visible in calendar window.
+Negative values of N are interpreted as days before advent.
+STRING is used purely for display purposes.  The return value has
+the form ((MONTH DAY YEAR) STRING), where the date is that of the
+Nth day before or after advent.
+
+For backwards compatibility, if this function is called with no
+arguments, then it returns the value appropriate for advent itself."
+  ;; Backwards compatibility layer.
+  (if (not n)
+      (holiday-advent 0 "Advent")
+    (let ((year displayed-year)
+          (month displayed-month))
+      (increment-calendar-month month year -1)
+      (let ((advent (calendar-gregorian-from-absolute
+                     (+ n
+                        (calendar-dayname-on-or-before
+                         0
+                         (calendar-absolute-from-gregorian
+                          (list 12 3 year)))))))
+        (if (calendar-date-is-visible-p advent)
+            (list (list advent string)))))))
+
+(defun holiday-easter-etc (&optional n string)
+  "Date of Nth day after Easter (named STRING), if visible in calendar window.
+Negative values of N are interpreted as days before Easter.
+STRING is used purely for display purposes.  The return value has
+the form ((MONTH DAY YEAR) STRING), where the date is that of the
+Nth day before or after Easter.
 
-(defun holiday-easter-etc (n string)
-  "Date of Nth day after Easter (named STRING), if visible in calendar window."
-  (let* ((century (1+ (/ displayed-year 100)))
-         (shifted-epact        ;; Age of moon for April 5...
-          (% (+ 14 (* 11 (% displayed-year 19));;     ...by Nicaean rule
-                (-           ;; ...corrected for the Gregorian century rule
-                 (/ (* 3 century) 4))
-                (/    ;; ...corrected for Metonic cycle inaccuracy.
-                 (+ 5 (* 8 century)) 25)
-                (* 30 century));;              Keeps value positive.
-             30))
-         (adjusted-epact       ;;  Adjust for 29.5 day month.
-          (if (or (= shifted-epact 0)
-                  (and (= shifted-epact 1) (< 10 (% displayed-year 19))))
-              (1+ shifted-epact)
-            shifted-epact))
-         (paschal-moon       ;; Day after the full moon on or after March 21.
-          (- (calendar-absolute-from-gregorian (list 4 19 displayed-year))
-             adjusted-epact))
-         (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
-         (mandatory
-           (list
-            (list (calendar-gregorian-from-absolute (+ abs-easter n))
-                  string)))
-         (output-list (filter-visible-calendar-holidays mandatory)))
-    output-list))
+For backwards compatibility, if this function is called with no
+arguments, then it returns a list of \"standard\" Easter-related
+holidays (with more entries if `all-christian-calendar-holidays'
+is non-nil)."
+  ;; Backwards compatibility layer.
+  (if (not n)
+      (let (res-list res)
+        (dolist (elem (append
+                       (if all-christian-calendar-holidays
+                           '((-63 . "Septuagesima Sunday")
+                             (-56 . "Sexagesima Sunday")
+                             (-49 . "Shrove Sunday")
+                             (-48 . "Shrove Monday")
+                             (-47 . "Shrove Tuesday")
+                             (-14 . "Passion Sunday")
+                             (-7 . "Palm Sunday")
+                             (-3 . "Maundy Thursday")
+                             (35 . "Rogation Sunday")
+                             (39 . "Ascension Day")
+                             (49 . "Pentecost (Whitsunday)")
+                             (50 . "Whitmonday")
+                             (56 . "Trinity Sunday")
+                             (60 . "Corpus Christi")))
+                       '((0 . "Easter Sunday")
+                         (-2 . "Good Friday")
+                         (-46 . "Ash Wednesday")))
+                      res-list)
+          ;; Filter out nil (not visible) values.
+          (if (setq res (holiday-easter-etc (car elem) (cdr elem)))
+              (setq res-list (append res res-list)))))
+    (let* ((century (1+ (/ displayed-year 100)))
+           (shifted-epact ;; Age of moon for April 5...
+            (% (+ 14 (* 11 (% displayed-year 19)) ;;     ...by Nicaean rule
+                  (- ;; ...corrected for the Gregorian century rule
+                   (/ (* 3 century) 4))
+                  (/ ;; ...corrected for Metonic cycle inaccuracy.
+                   (+ 5 (* 8 century)) 25)
+                  (* 30 century)) ;;              Keeps value positive.
+               30))
+           (adjusted-epact ;;  Adjust for 29.5 day month.
+            (if (or (zerop shifted-epact)
+                    (and (= shifted-epact 1) (< 10 (% displayed-year 19))))
+                (1+ shifted-epact)
+              shifted-epact))
+           (paschal-moon ;; Day after the full moon on or after March 21.
+            (- (calendar-absolute-from-gregorian (list 4 19 displayed-year))
+               adjusted-epact))
+           (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7))))
+      (filter-visible-calendar-holidays
+       (list (list (calendar-gregorian-from-absolute (+ abs-easter n))
+                   string))))))
 
 (defun holiday-greek-orthodox-easter ()
   "Date of Easter according to the rule of the Council of Nicaea."
--- a/lisp/comint.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/comint.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1899,6 +1899,10 @@
       (forward-line 0)
     (goto-char (comint-line-beginning-position))))
 
+;; For compatibility.
+(defun comint-read-noecho (prompt &optional ignore)
+  (read-passwd prompt))
+
 ;; These three functions are for entering text you don't want echoed or
 ;; saved -- typically passwords to ftp, telnet, or somesuch.
 ;; Just enter m-x send-invisible and type in your line.
--- a/lisp/compare-w.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/compare-w.el	Wed Dec 08 22:20:27 2004 +0000
@@ -283,7 +283,8 @@
 ;; to be used when this function is called on second window.
 (defun compare-windows-sync-default-function ()
   (if (not compare-windows-sync-point)
-      (let* ((w2 (next-window (selected-window)))
+      (let* ((w1 (selected-window))
+             (w2 (next-window w1))
              (b2 (window-buffer w2))
              (point-max2 (with-current-buffer b2 (point-max)))
              (op2 (window-point w2))
@@ -326,7 +327,8 @@
           ;; use closest matching points (i.e. points with minimal sum)
           (setq p12 (cdr (assq (apply 'min (mapcar 'car p12s)) p12s)))
           (goto-char (car p12))
-          (compare-windows-highlight op1 (car p12) op2 (cadr p12) b2))
+          (compare-windows-highlight op1 (car p12) (current-buffer) w1
+                                     op2 (cadr p12) b2 w2))
         (setq compare-windows-sync-point (or (cadr p12) t)))
     ;; else set point in the second window to the pre-calculated value
     (if (numberp compare-windows-sync-point)
@@ -334,18 +336,20 @@
     (setq compare-windows-sync-point nil)))
 
 ;; Highlight differences
-(defun compare-windows-highlight (beg1 end1 beg2 end2 buf2)
+(defun compare-windows-highlight (beg1 end1 b1 w1 beg2 end2 b2 w2)
   (when compare-windows-highlight
     (if compare-windows-overlay1
-        (move-overlay compare-windows-overlay1 beg1 end1 (current-buffer))
-      (setq compare-windows-overlay1 (make-overlay beg1 end1 (current-buffer)))
+        (move-overlay compare-windows-overlay1 beg1 end1 b1)
+      (setq compare-windows-overlay1 (make-overlay beg1 end1 b1))
       (overlay-put compare-windows-overlay1 'face 'compare-windows-face)
       (overlay-put compare-windows-overlay1 'priority 1))
+    (overlay-put compare-windows-overlay1 'window w1)
     (if compare-windows-overlay2
-        (move-overlay compare-windows-overlay2 beg2 end2 buf2)
-      (setq compare-windows-overlay2 (make-overlay beg2 end2 buf2))
+        (move-overlay compare-windows-overlay2 beg2 end2 b2)
+      (setq compare-windows-overlay2 (make-overlay beg2 end2 b2))
       (overlay-put compare-windows-overlay2 'face 'compare-windows-face)
       (overlay-put compare-windows-overlay2 'priority 1))
+    (overlay-put compare-windows-overlay2 'window w2)
     ;; Remove highlighting before next command is executed
     (add-hook 'pre-command-hook 'compare-windows-dehighlight)))
 
--- a/lisp/cus-edit.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/cus-edit.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3678,8 +3678,13 @@
 (defcustom custom-file nil
   "File used for storing customization information.
 The default is nil, which means to use your init file
-as specified by `user-init-file'.  If you specify some other file,
-you need to explicitly load that file for the settings to take effect.
+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 ...)'
--- a/lisp/cus-start.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/cus-start.el	Wed Dec 08 22:20:27 2004 +0000
@@ -272,6 +272,7 @@
 	     ;; xfns.c
 	     (x-bitmap-file-path installation
 				 (repeat (directory :format "%v")))
+	     (x-use-old-gtk-file-dialog menu boolean "21.4")
 	     ;; xterm.c
              (mouse-autoselect-window display boolean "21.3")
 	     (x-use-underline-position-properties display boolean "21.3")
--- a/lisp/descr-text.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/descr-text.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,7 @@
 ;;; descr-text.el --- describe text mode
 
-;; Copyright (c) 1994, 95, 96, 2001, 02, 03, 04 Free Software Foundation, Inc.
+;; Copyright (c) 1994, 1995, 1996, 2001, 2002, 2003, 2004
+;;           Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <boris@gnu.org>
 ;; Keywords: faces
@@ -507,10 +508,7 @@
 		    (format "%d" (nth 1 split))
 		  (format "%d %d" (nth 1 split) (nth 2 split)))))
 	    ("syntax"
-	     ,(let* ((st (if parse-sexp-lookup-properties
-			     (get-char-property pos 'syntax-table)))
-		     (syntax (if (consp st) st
-			       (aref (or st (syntax-table)) (char-after pos)))))
+	     ,(let ((syntax (syntax-after pos)))
 		(with-temp-buffer
 		  (internal-describe-syntax-value syntax)
 		  (buffer-string))))
@@ -687,5 +685,5 @@
 
 (provide 'descr-text)
 
-;;; arch-tag: fc55a498-f3e9-4312-b5bd-98cc02480af1
+;; arch-tag: fc55a498-f3e9-4312-b5bd-98cc02480af1
 ;;; descr-text.el ends here
--- a/lisp/desktop.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/desktop.el	Wed Dec 08 22:20:27 2004 +0000
@@ -711,8 +711,8 @@
         ;; `desktop-create-buffer' puts buffers at end of the buffer list.
         ;; We want buffers existing prior to evaluating the desktop (and not reused)
         ;; to be placed at the end of the buffer list, so we move them here.
-        (mapcar 'bury-buffer
-                (nreverse (cdr (memq desktop-first-buffer (nreverse (buffer-list))))))
+        (mapc 'bury-buffer
+              (nreverse (cdr (memq desktop-first-buffer (nreverse (buffer-list))))))
         (switch-to-buffer (car (buffer-list)))
         (run-hooks 'desktop-delay-hook)
         (setq desktop-delay-hook nil)
@@ -855,11 +855,10 @@
           (setq desktop-buffer-ok-count (1+ desktop-buffer-ok-count))
         (setq desktop-buffer-fail-count (1+ desktop-buffer-fail-count))
         (setq result nil))
-      (unless (bufferp result) (setq result nil))
       ;; Restore buffer list order with new buffer at end. Don't change
       ;; the order for old desktop files (old desktop module behaviour).
       (unless (< desktop-file-version 206)
-        (mapcar 'bury-buffer buffer-list)
+        (mapc 'bury-buffer buffer-list)
         (when result (bury-buffer result)))
       (when result
         (unless (or desktop-first-buffer (< desktop-file-version 206))
--- a/lisp/dired-aux.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/dired-aux.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1093,19 +1093,6 @@
 
 ;;; Copy, move/rename, making hard and symbolic links
 
-(defcustom dired-recursive-copies nil
-  "*Decide whether recursive copies are allowed.
-nil means no recursive copies.
-`always' means copy recursively without asking.
-`top' means ask for each directory at top level.
-Anything else means ask for each directory."
-  :type '(choice :tag "Copy directories"
-		 (const :tag "No recursive copies" nil)
-		 (const :tag "Ask for each directory" t)
-		 (const :tag "Ask for each top directory only" top)
-		 (const :tag "Copy directories without asking" always))
-  :group 'dired)
-
 (defcustom dired-backup-overwrite nil
   "*Non-nil if Dired should ask about making backups before overwriting files.
 Special value `always' suppresses confirmation."
--- a/lisp/dired.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/dired.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,7 +1,7 @@
 ;;; dired.el --- directory-browsing commands
 
-;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97, 2000, 01, 03, 2004
-;;  Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995, 1996, 1997, 2000,
+;;   2001, 2003, 2004  Free Software Foundation, Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
 ;; Maintainer: FSF
@@ -741,7 +741,7 @@
 
 (defun dired-readin ()
   "Read in a new dired buffer.
-Differs from dired-insert-subdir in that it accepts
+Differs from `dired-insert-subdir' in that it accepts
 wildcards, erases the buffer, and builds the subdir-alist anew
 \(including making it buffer-local and clearing it first)."
 
@@ -858,10 +858,8 @@
 	(setq file (copy-marker file))
 	;; Main loop.
 	(goto-char beg)
+	(skip-chars-forward " ")	;Skip to the first field.
 	(while (and (> other-col file-col)
-		    (skip-chars-forward "^ ")
-		    ;; Skip the spaces, and make sure there's at least one.
-		    (> (skip-chars-forward " ") 0)
 		    ;; Don't touch anything just before (and after) the
 		    ;; beginning of the filename.
 		    (> file (point)))
@@ -904,11 +902,13 @@
 	      (insert-char ?\s spaces)
 	      ;; Let's just make really sure we did not mess up.
 	      (unless (save-excursion
-			(equal (dired-move-to-filename) (marker-position file)))
+			(eq (dired-move-to-filename) (marker-position file)))
 		;; Damn!  We messed up: let's revert the change.
-		(delete-char (- spaces))))))
+		(delete-char (- spaces)))))
+	  ;; Now skip to next field.
+	  (skip-chars-forward "^ ") (skip-chars-forward " "))
 	(set-marker file nil)))))
-			 
+
 
 (defun dired-insert-directory (dir switches &optional file-list wildcard hdr)
   "Insert a directory listing of DIR, Dired style.
@@ -1482,22 +1482,22 @@
 Customization variables (rename this buffer and type \\[describe-variable] on each line
 for more info):
 
-  dired-listing-switches
-  dired-trivial-filenames
-  dired-shrink-to-fit
-  dired-marker-char
-  dired-del-marker
-  dired-keep-marker-rename
-  dired-keep-marker-copy
-  dired-keep-marker-hardlink
-  dired-keep-marker-symlink
+  `dired-listing-switches'
+  `dired-trivial-filenames'
+  `dired-shrink-to-fit'
+  `dired-marker-char'
+  `dired-del-marker'
+  `dired-keep-marker-rename'
+  `dired-keep-marker-copy'
+  `dired-keep-marker-hardlink'
+  `dired-keep-marker-symlink'
 
 Hooks (use \\[describe-variable] to see their documentation):
 
-  dired-before-readin-hook
-  dired-after-readin-hook
-  dired-mode-hook
-  dired-load-hook
+  `dired-before-readin-hook'
+  `dired-after-readin-hook'
+  `dired-mode-hook'
+  `dired-load-hook'
 
 Keybindings:
 \\{dired-mode-map}"
@@ -1508,7 +1508,7 @@
   (dired-advertise)			; default-directory is already set
   (setq major-mode 'dired-mode
 	mode-name "Dired"
-;;	case-fold-search nil
+	;; case-fold-search nil
 	buffer-read-only t
 	selective-display t		; for subdirectory hiding
 	mode-line-buffer-identification
@@ -3021,7 +3021,7 @@
 ;; So anything that does not contain these is sort "by name".
 
 (defvar dired-ls-sorting-switches "SXU"
-  "String of `ls' switches \(single letters\) except `t' that influence sorting.
+  "String of `ls' switches \(single letters\) except \"t\" that influence sorting.
 
 This indicates to Dired which option switches to watch out for because they
 will change the sorting order behavior of `ls'.
@@ -3153,6 +3153,19 @@
 
 ;;;;  Drag and drop support
 
+(defcustom dired-recursive-copies nil
+  "*Decide whether recursive copies are allowed.
+nil means no recursive copies.
+`always' means copy recursively without asking.
+`top' means ask for each directory at top level.
+Anything else means ask for each directory."
+  :type '(choice :tag "Copy directories"
+		 (const :tag "No recursive copies" nil)
+		 (const :tag "Ask for each directory" t)
+		 (const :tag "Ask for each top directory only" top)
+		 (const :tag "Copy directories without asking" always))
+  :group 'dired)
+
 (defun dired-dnd-test-function (window action types)
   "The test function for drag and drop into dired buffers.
 WINDOW is where the mouse is when this function is called.  It may be a frame
@@ -3286,5 +3299,5 @@
 
 (run-hooks 'dired-load-hook)		; for your customizations
 
-;;; arch-tag: e1af7a8f-691c-41a0-aac1-ddd4d3c87517
+;; arch-tag: e1af7a8f-691c-41a0-aac1-ddd4d3c87517
 ;;; dired.el ends here
--- a/lisp/emacs-lisp/byte-opt.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/emacs-lisp/byte-opt.el	Wed Dec 08 22:20:27 2004 +0000
@@ -520,7 +520,8 @@
 		(symbolp (car-safe form))
 		(get (car-safe form) 'cl-compiler-macro)
 	        (not (eq form
-		         (setq form (compiler-macroexpand form)))))
+			 (with-no-warnings
+			  (setq form (compiler-macroexpand form))))))
 	   (byte-optimize-form form for-effect))
 
 	  ((not (symbolp fn))
--- a/lisp/emacs-lisp/cl-macs.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/emacs-lisp/cl-macs.el	Wed Dec 08 22:20:27 2004 +0000
@@ -715,7 +715,10 @@
       (let ((loop-for-bindings nil) (loop-for-sets nil) (loop-for-steps nil)
 	    (ands nil))
 	(while
-	    (let ((var (or (pop args) (make-symbol "--cl-var--"))))
+	    ;; Use `gensym' rather than `make-symbol'.  It's important that
+	    ;; (not (eq (symbol-name var1) (symbol-name var2))) because
+	    ;; these vars get added to the cl-macro-environment.
+	    (let ((var (or (pop args) (gensym "--cl-var--"))))
 	      (setq word (pop args))
 	      (if (eq word 'being) (setq word (pop args)))
 	      (if (memq word '(the each)) (setq word (pop args)))
@@ -1314,7 +1317,10 @@
 \(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
   (let ((vars nil) (sets nil) (cl-macro-environment cl-macro-environment))
     (while bindings
-      (let ((var (make-symbol "--cl-var--")))
+      ;; Use `gensym' rather than `make-symbol'.  It's important that
+      ;; (not (eq (symbol-name var1) (symbol-name var2))) because these
+      ;; vars get added to the cl-macro-environment.
+      (let ((var (gensym "--cl-var--")))
 	(push var vars)
 	(push (list 'function* (cons 'lambda (cdar bindings))) sets)
 	(push var sets)
--- a/lisp/emacs-lisp/edebug.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/emacs-lisp/edebug.el	Wed Dec 08 22:20:27 2004 +0000
@@ -3240,9 +3240,15 @@
 
 
 (defun edebug-set-global-break-condition (expression)
-  (interactive (list (read-minibuffer
-		      "Global Condition: "
-		      (format "%s" edebug-global-break-condition))))
+  (interactive
+   (list
+    (let ((initial (and edebug-global-break-condition
+			(format "%s" edebug-global-break-condition))))
+      (read-from-minibuffer
+       "Global Condition: " initial read-expression-map t
+       (if (equal (car read-expression-history) initial)
+	   '(read-expression-history . 1)
+	 'read-expression-history)))))
   (setq edebug-global-break-condition expression))
 
 
@@ -4315,9 +4321,8 @@
 
 (defalias 'edebug-window-live-p 'window-live-p)
 
-;; Mark takes an argument in Emacs 19.
 (defun edebug-mark ()
-  (mark t))	;; Does this work for lemacs too?
+  (mark t))
 
 (defun edebug-set-conditional-breakpoint (arg condition)
   "Set a conditional breakpoint at nearest sexp.
@@ -4327,7 +4332,7 @@
   (interactive
    (list
     current-prefix-arg
-;; Read condition as follows; getting previous condition is cumbersome:
+    ;; Read condition as follows; getting previous condition is cumbersome:
     (let ((edebug-stop-point (edebug-find-stop-point)))
       (if edebug-stop-point
 	  (let* ((edebug-def-name (car edebug-stop-point))
@@ -4336,23 +4341,15 @@
 		 (edebug-breakpoints (car (cdr edebug-data)))
 		 (edebug-break-data (assq index edebug-breakpoints))
 		 (edebug-break-condition (car (cdr edebug-break-data)))
-		 (edebug-expression-history
-		  ;; Prepend the current condition, if any.
-		  (if edebug-break-condition
-		      (cons edebug-break-condition read-expression-history)
-		    read-expression-history)))
-	    (prog1
-		(read-from-minibuffer
-		 "Condition: " nil read-expression-map t
-		 'edebug-expression-history)
-	      (setq read-expression-history edebug-expression-history)
-	      ))))))
+		 (initial (and edebug-break-condition
+			       (format "%s" edebug-break-condition))))
+	    (read-from-minibuffer
+	     "Condition: " initial read-expression-map t
+	     (if (equal (car read-expression-history) initial)
+		 '(read-expression-history . 1)
+	       'read-expression-history)))))))
   (edebug-modify-breakpoint t condition arg))
 
-;;; The default for all above is Emacs.
-
-;; Epoch specific code was in a separate file: edebug-epoch.el.
-
 (easy-menu-define edebug-menu edebug-mode-map "Edebug menus" edebug-mode-menus)
 
 ;;; Byte-compiler
--- a/lisp/emacs-lisp/elint.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/emacs-lisp/elint.el	Wed Dec 08 22:20:27 2004 +0000
@@ -730,18 +730,21 @@
 
 (defconst elint-standard-variables
   '(abbrev-mode auto-fill-function buffer-auto-save-file-name
-     buffer-backed-up buffer-display-table buffer-file-format
+     buffer-backed-up buffer-display-count buffer-display-table buffer-display-time buffer-file-coding-system buffer-file-format
      buffer-file-name buffer-file-number buffer-file-truename
      buffer-file-type buffer-invisibility-spec buffer-offer-save
      buffer-read-only buffer-saved-size buffer-undo-list
-     cache-long-line-scans case-fold-search ctl-arrow comment-column
-     default-directory defun-prompt-regexp fill-column goal-column
-     left-margin local-abbrev-table local-write-file-hooks major-mode
-     mark-active mark-ring minor-modes mode-line-buffer-identification
+     cache-long-line-scans case-fold-search ctl-arrow cursor-type comment-column
+     default-directory defun-prompt-regexp desktop-save-buffer enable-multibyte-characters fill-column fringes-outside-margins goal-column
+     header-line-format indicate-buffer-boundaries indicate-empty-lines
+     left-fringe-width
+     left-margin left-margin-width line-spacing local-abbrev-table local-write-file-hooks major-mode
+     mark-active mark-ring mode-line-buffer-identification
      mode-line-format mode-line-modified mode-line-process mode-name
-     overwrite-mode paragraph-separate paragraph-start
-     point-before-scroll require-final-newline selective-display
-     selective-display-ellipses tab-width truncate-lines vc-mode)
+     overwrite-mode 
+     point-before-scroll right-fringe-width right-margin-width
+     scroll-bar-width scroll-down-aggressively scroll-up-aggressively selective-display
+     selective-display-ellipses tab-width truncate-lines vc-mode vertical-scroll-bar)
   "Standard buffer local vars.")
 
 (defconst elint-unknown-builtin-args
--- a/lisp/emacs-lisp/regexp-opt.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/emacs-lisp/regexp-opt.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,7 @@
 ;;; regexp-opt.el --- generate efficient regexps to match strings
 
-;; Copyright (C) 1994,95,96,97,98,99,2000 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2004
+;;           Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <simon@gnu.org>
 ;; Maintainer: FSF
@@ -106,44 +107,29 @@
 	   (completion-regexp-list nil)
 	   (words (eq paren 'words))
 	   (open (cond ((stringp paren) paren) (paren "\\(")))
-	   (sorted-strings (sort (copy-sequence strings) 'string-lessp))
+	   (sorted-strings (delete-dups
+			    (sort (copy-sequence strings) 'string-lessp)))
 	   (re (regexp-opt-group sorted-strings open)))
       (if words (concat "\\<" re "\\>") re))))
 
-(defconst regexp-opt-not-groupie*-re
-  (let* ((harmless-ch "[^\\\\[]")
-         (esc-pair-not-lp "\\\\[^(]")
-         (class-harmless-ch "[^][]")
-         (class-lb-harmless "[^]:]")
-         (class-lb-colon-maybe-charclass ":\\([a-z]+:]\\)?")
-         (class-lb (concat "\\[\\(" class-lb-harmless
-                           "\\|" class-lb-colon-maybe-charclass "\\)"))
-         (class
-          (concat "\\[^?]?"
-                  "\\(" class-harmless-ch
-                  "\\|" class-lb "\\)*"
-                  "\\[?]"))         ; special handling for bare [ at end of re
-         (shy-lp "\\\\(\\?:"))
-    (concat "\\(" harmless-ch "\\|" esc-pair-not-lp
-            "\\|" class "\\|" shy-lp "\\)*"))
-  "Matches any part of a regular expression EXCEPT for non-shy \"\\\\(\"s")
-
 ;;;###autoload
 (defun regexp-opt-depth (regexp)
   "Return the depth of REGEXP.
-This means the number of regexp grouping constructs (parenthesised expressions)
-in REGEXP."
+This means the number of non-shy regexp grouping constructs
+\(parenthesised expressions) in REGEXP."
   (save-match-data
     ;; Hack to signal an error if REGEXP does not have balanced parentheses.
     (string-match regexp "")
     ;; Count the number of open parentheses in REGEXP.
-    (let ((count 0) start)
-      (while
-          (progn
-            (string-match regexp-opt-not-groupie*-re regexp start)
-            (setq start ( + (match-end 0) 2))  ; +2 for "\\(" after match-end.
-            (<= start (length regexp)))
-        (setq count (1+ count)))
+    (let ((count 0) start last)
+      (while (string-match "\\\\(\\(\\?:\\)?" regexp start)
+	(setq start (match-end 0))	      ; Start of next search.
+	(when (and (not (match-beginning 1))
+		   (subregexp-context-p regexp (match-beginning 0) last))
+	  ;; It's not a shy group and it's not inside brackets or after
+	  ;; a backslash: it's really a group-open marker.
+	  (setq last start)	    ; Speed up next regexp-opt-re-context-p.
+	  (setq count (1+ count))))
       count)))
 
 ;;; Workhorse functions.
@@ -299,5 +285,5 @@
 
 (provide 'regexp-opt)
 
-;;; arch-tag: 6c5a66f4-29af-4fd6-8c3b-4b554d5b4370
+;; arch-tag: 6c5a66f4-29af-4fd6-8c3b-4b554d5b4370
 ;;; regexp-opt.el ends here
--- a/lisp/emulation/tpu-edt.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/emulation/tpu-edt.el	Wed Dec 08 22:20:27 2004 +0000
@@ -844,7 +844,7 @@
 ;;;
 ;;;  Help
 ;;;
-(defconst tpu-help-keypad-map "\f
+(defvar tpu-help-keypad-map "\f
           _______________________    _______________________________
          | HELP  |      Do       |  |       |       |       |       |
          |KeyDefs|               |  |       |       |       |       |
@@ -867,7 +867,7 @@
                                     |_______________|_______|_______|
 ")
 
-(defconst tpu-help-text "
+(defvar tpu-help-text "
 \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\f
 
       Control Characters
@@ -1706,9 +1706,9 @@
 ;;;
 ;;;  Movement by word
 ;;;
-(defconst tpu-word-separator-list '()
+(defvar tpu-word-separator-list '()
   "List of additional word separators.")
-(defconst tpu-skip-chars "^ \t"
+(defvar tpu-skip-chars "^ \t"
   "Characters to skip when moving by word.
 Additional word separators are added to this string.")
 
--- a/lisp/faces.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/faces.el	Wed Dec 08 22:20:27 2004 +0000
@@ -2052,6 +2052,31 @@
   :group 'basic-faces)
 
 
+;; Make escape characters stand out in display
+
+(defface escape-glyph
+  '((t :inherit secondary-selection))
+  "Basic face for displaying \\ and ^ in multichar glyphs.
+It is also used for ... in ellipses."
+  :group 'basic-faces)
+
+(put 'display-table 'char-table-extra-slots 6)
+
+(or standard-display-table
+    ;; avoid using autoloaded make-display-table here
+    (setq standard-display-table (make-char-table 'display-table nil)))
+
+(let* ((face (lsh (face-id 'escape-glyph) 19))
+       (backslash (+ face ?\\))
+       (dot (+ face ?.)))
+  (set-char-table-extra-slot standard-display-table 2 backslash)
+  (aset standard-display-table 2208 (vector backslash ?\s))
+  (aset standard-display-table 2221 (vector backslash ?-))
+  (set-char-table-extra-slot standard-display-table 3 (+ face ?^))
+  (set-char-table-extra-slot standard-display-table 4 (vector dot dot dot)))
+
+
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Manipulating font names.
--- a/lisp/files.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/files.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1761,12 +1761,13 @@
      ;; Windows candidates may be opened case sensitively on Unix
      ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-mode)
      ("\\.\\(?:desktop\\|la\\)\\'" . conf-unix-mode)
+     ("\\.ppd\\'" . conf-ppd-mode)
      ("java.+\\.conf\\'" . conf-javaprop-mode)
      ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode)
      ;; *.cf, *.cfg, *.conf, *.config[.local|.de_DE.UTF8|...], */config
      ("[/.]c\\(?:on\\)?f\\(?:i?g\\)?\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-mode)
      ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
-     ("\\`/etc/\\(?:default/.*\\|aliases\\|group-?\\|hosts\\..+\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\)\\'" . conf-mode)
+     ("\\`/etc/\\(?:acpid?/.+\\|aliases\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\)\\'" . conf-mode)
      ;; either user's dot-files or under /etc or some such
      ("/\\.?\\(?:gnokiirc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode)
      ;; alas not all ~/.*rc files are like this
--- a/lisp/font-lock.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/font-lock.el	Wed Dec 08 22:20:27 2004 +0000
@@ -958,7 +958,8 @@
   (funcall font-lock-fontify-region-function beg end loudly))
 
 (defun font-lock-unfontify-region (beg end)
-  (funcall font-lock-unfontify-region-function beg end))
+  (save-buffer-state nil
+    (funcall font-lock-unfontify-region-function beg end)))
 
 (defun font-lock-default-fontify-buffer ()
   (let ((verbose (if (numberp font-lock-verbose)
@@ -1046,13 +1047,12 @@
 what properties to clear before refontifying a region.")
 
 (defun font-lock-default-unfontify-region (beg end)
-  (save-buffer-state nil
-    (remove-list-of-text-properties
-     beg end (append
-	      font-lock-extra-managed-props
-	      (if font-lock-syntactic-keywords
-		  '(syntax-table face font-lock-multiline)
-		'(face font-lock-multiline))))))
+  (remove-list-of-text-properties
+   beg end (append
+	    font-lock-extra-managed-props
+	    (if font-lock-syntactic-keywords
+		'(syntax-table face font-lock-multiline)
+	      '(face font-lock-multiline)))))
 
 ;; Called when any modification is made to buffer text.
 (defun font-lock-after-change-function (beg end old-len)
@@ -1456,7 +1456,7 @@
 		       (concat "^\\(?:" defun-prompt-regexp "\\)?\\s(")
 		     "^\\s(")
 		  (0
-		   (if (memq (get-text-property (1- (point)) 'face)
+		   (if (memq (get-text-property (match-beginning 0) 'face)
 			     '(font-lock-string-face font-lock-doc-face
 			       font-lock-comment-face))
 		       font-lock-warning-face)
--- a/lisp/fringe.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/fringe.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,6 @@
 ;;; fringe.el --- change fringes appearance in various ways
 
-;; Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Maintainer: FSF
@@ -35,6 +35,11 @@
 
 ;;; Code:
 
+(defgroup fringe nil
+  "Window fringes."
+  :version "21.4"
+  :group 'frames)
+
 ;; Standard fringe bitmaps
 
 (defmacro fringe-bitmap-p (symbol)
@@ -156,7 +161,7 @@
 		 (cons :tag "Different left/right sizes"
 		       (integer :tag "Left width")
 		       (integer :tag "Right width")))
-  :group 'frames
+  :group 'fringe
   :require 'fringe
   :initialize 'fringe-mode-initialize
   :set 'set-fringe-mode-1)
@@ -252,6 +257,43 @@
 	       0)
            (float (frame-char-width))))
 
+;; Fake defvar.  Real definition using defcustom is below.  The fake
+;; defvar is necessary because `fringe-indicators' and
+;; `set-fringe-indicators-1' mutually use each other.
+(defvar fringe-indicators)
+
+(defun set-fringe-indicators-1 (ignore value)
+  "Set fringe indicators according to VALUE.
+This is usually invoked when setting `fringe-indicators' via customize."
+  (setq fringe-indicators value)
+  (setq default-indicate-empty-lines nil)
+  (setq default-indicate-buffer-boundaries
+	(cond
+	 ((memq value '(left right t))
+	  value)
+	 ((eq value 'box)
+	  '((top . left) (bottom . right)))
+	 ((eq value 'mixed)
+	  '((top . left) (t . right)))
+	 ((eq value 'empty)
+	  (setq default-indicate-empty-lines t)
+	  nil)
+	 (t nil))))
+
+;;;###autoload
+(defcustom fringe-indicators nil
+  "Visually indicate buffer boundaries and scrolling.
+Setting this variable, changes `default-indicate-buffer-boundaries'."
+  :type '(choice (const :tag "No indicators" nil)
+		 (const :tag "On left" left)
+		 (const :tag "On right" right)
+		 (const :tag "Opposite, no arrows" box)
+		 (const :tag "Opposite, arrows right" mixed)
+		 (const :tag "Empty lines" empty))
+  :group 'fringe
+  :require 'fringe
+  :set 'set-fringe-indicators-1)
+
 (provide 'fringe)
 
 ;;; arch-tag: 6611ef60-0869-47ed-8b93-587ee7d3ff5d
--- a/lisp/generic.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/generic.el	Wed Dec 08 22:20:27 2004 +0000
@@ -197,6 +197,7 @@
 or a one-character string, it is added to the mode's syntax table with
 `comment-start' syntax.  If the entry is a cons pair, the elements of the
 pair are considered to be `comment-start' and `comment-end' respectively.
+\(The latter should be nil if you want comments to end at end of line.)
 Note that Emacs has limitations regarding comment characters.
 
 KEYWORD-LIST is a list of keywords to highlight with `font-lock-keyword-face'.
@@ -289,13 +290,15 @@
 
     ;; Go through all the comments
     (dolist (start comment-list)
-      (let ((end ?\n) (comstyle ""))
+      (let ((end nil) (comstyle ""))
 	;; Normalize
 	(when (consp start)
 	  (setq end (or (cdr start) end))
 	  (setq start (car start)))
 	(when (char-valid-p start) (setq start (char-to-string start)))
-	(when (char-valid-p end)   (setq end (char-to-string end)))
+	(cond
+	 ((char-valid-p end)   (setq end (char-to-string end)))
+	 ((zerop (length end)) (setq end "\n")))
 
 	;; Setup the vars for `comment-region'
 	(if comment-start
@@ -414,5 +417,5 @@
 
 (provide 'generic)
 
-;;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea
+;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea
 ;;; generic.el ends here
--- a/lisp/gnus/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/gnus/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,8 @@
+2004-11-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* gnus-sum.el (gnus-summary-exit): Remove redundant and harmful
+	pop-to-buffer, covered by the subsequent gnus-configure-windows.
+
 2004-11-14  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* nnfolder.el (nnfolder-save-marks): Add missing format field in
@@ -56,8 +61,8 @@
 	(mm-coding-system-priorities): Use shift_jis and iso-8859-1
 	instead of japanese-shift-jis and iso-latin-1 respectively in
 	order to share the default value with both Emacs and XEmacs-mule.
-	(mm-mule-charset-to-mime-charset): Make
-	mm-coding-system-priorities effective.
+	(mm-mule-charset-to-mime-charset):
+	Make mm-coding-system-priorities effective.
 	(mm-sort-coding-systems-predicate): Canonicalize coding-systems
 	while predicating of candidates upon the priorities.
 
@@ -76,8 +81,8 @@
 
 	* sieve.el (sieve): Add :version.
 
-	* sha1.el (sha1): Added :version.
-	(sha1-use-external): Removed redundant version.
+	* sha1.el (sha1): Add :version.
+	(sha1-use-external): Remove redundant version.
 
 	* nnmail.el (nnmail-split-fancy-with-parent-ignore-groups)
 	(nnmail-cache-ignore-groups, nnmail-spool-hook)
@@ -89,8 +94,8 @@
 	* mml2015.el (mml2015-unabbrev-trust-alist): Add :version.
 
 	* mml-sec.el (mml-default-sign-method)
-	(mml-default-encrypt-method, mml-signencrypt-style-alist): Add
-	:version.
+	(mml-default-encrypt-method, mml-signencrypt-style-alist):
+	Add :version.
 
 	* mm-uu.el (mm-uu-diff-groups-regexp): Add :version.
 
@@ -151,8 +156,8 @@
 	* html2text.el: Beautify code.  Improve doc strings.  Some checkdoc
 	cleanup.
 	(html2text-get-attr, html2text-fix-paragraph): Simplify code.
-	(html2text-format-tag-list): Added "strong" and "em".  From
-	"Alfred M. Szmidt" <ams@kemisten.nu> (tiny change).
+	(html2text-format-tag-list): Add "strong" and "em".
+	From "Alfred M. Szmidt" <ams@kemisten.nu> (tiny change).
 
 2004-10-29  Katsumi Yamaoka  <yamaoka@jpl.org>
 
@@ -161,8 +166,8 @@
 	<srivasta@golden-gryphon.com>.
 
 	* mm-util.el (mm-coding-system-priorities): Prefer iso-8859-1 than
-	iso-2022-jp even in the Japanese language environment.  Suggested
-	by Jason Rumney <jasonr@gnu.org>.
+	iso-2022-jp even in the Japanese language environment.
+	Suggested by Jason Rumney <jasonr@gnu.org>.
 
 2004-10-28  Katsumi Yamaoka  <yamaoka@jpl.org>
 
@@ -186,12 +191,12 @@
 
 2004-10-25  Reiner Steib  <Reiner.Steib@gmx.de>
 
-	* html2text.el (html2text-buffer-head): Removed.  Use `goto-char'
+	* html2text.el (html2text-buffer-head): Remove.  Use `goto-char'
 	instead.
 
 2004-10-24  Kevin Greiner  <kevin.greiner@compsol.cc>
 
-	* gnus-start.el (gnus-convert-old-newsrc): Fixed numeric
+	* gnus-start.el (gnus-convert-old-newsrc): Fix numeric
 	comparison on string.
 
 2004-10-21  Katsumi Yamaoka  <yamaoka@jpl.org>
@@ -218,17 +223,17 @@
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc>
 
-	* gnus-agent.el (gnus-agent-synchronize-group-flags): When
-	necessary, pass full group name to gnus-request-set-marks.
-	(gnus-agent-synchronize-group-flags): Added support for sync'ing
+	* gnus-agent.el (gnus-agent-synchronize-group-flags):
+	When necessary, pass full group name to gnus-request-set-marks.
+	(gnus-agent-synchronize-group-flags): Add support for sync'ing
 	tick marks.
-        (gnus-agent-synchronize-flags-server): Be silent when writing file.
+	(gnus-agent-synchronize-flags-server): Be silent when writing file.
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc>
 
-	* gnus-agent.el (gnus-agent-synchronize-group-flags): Replaced
-	gnus-request-update-info with explicit code to sync the in-memory
-	info read flags with the marks being sync'd to the backend.
+	* gnus-agent.el (gnus-agent-synchronize-group-flags):
+	Replace gnus-request-update-info with explicit code to sync the
+	in-memory info read flags with the marks being sync'd to the backend.
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc>
 
@@ -237,19 +242,18 @@
 	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): Rewrote read loop to handle
+	(gnus-agent-synchronize-flags-server): Rewrite read loop to handle
 	multi-line expressions.
 	(gnus-agent-synchronize-group-flags): New internal function.
-	Updates marks in memory (in the info structure) AND in the
-	backend.
-	(gnus-agent-check-overview-buffer): Fixed range of
+	Updates marks in memory (in the info structure) AND in the backend.
+	(gnus-agent-check-overview-buffer): Fix range of
 	deletion to remove entire duplicate line.  Fixes merged article
 	number bug.
 
-	* gnus-util.el (gnus-remassoc): Fixed typo in documentation.
-	
-	* nnagent.el (nnagent-request-set-mark): Use
-	gnus-agent-synchronize-group-flags, not backend's request-set-mark
+	* gnus-util.el (gnus-remassoc): Fix typo in documentation.
+
+	* nnagent.el (nnagent-request-set-mark):
+	Use gnus-agent-synchronize-group-flags, not backend's request-set-mark
 	method, to ensure that synchronization updates marks in the
 	backend and in the info (in memory) structure.
 
@@ -260,6 +264,7 @@
 	an error.
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc> for Reiner Steib  <Reiner.Steib@gmx.de>
+
 	* gnus-agent.el (gnus-agent-fetched-hook): Add :version.
 	(gnus-agent-go-online): Change :version.
 	(gnus-agent-expire-unagentized-dirs)
@@ -267,37 +272,38 @@
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc>
 
-	* legacy-gnus-agent.el (gnus-agent-convert-to-compressed-agentview-prompt):
+	* legacy-gnus-agent.el
+	(gnus-agent-convert-to-compressed-agentview-prompt):
 	New function. Used internally to only display 'gnus converting
 	files' message when actually necessary.
 
-	* gnus-sum.el (): Removed (require 'gnus-agent) as required
+	* gnus-sum.el: Remove (require 'gnus-agent) as required
 	methods now autoloaded.
 
-	* gnus-int.el (gnus-request-move-article): Use
-	gnus-agent-unfetch-articles in place of gnus-agent-expire to
+	* gnus-int.el (gnus-request-move-article):
+	Use gnus-agent-unfetch-articles in place of gnus-agent-expire to
 	improve performance.
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc>
 
-	* gnus-agent.el (gnus-agent-cat-groups): rewrote avoiding defsetf
+	* gnus-agent.el (gnus-agent-cat-groups): Rewrite avoiding defsetf
 	to avoid run-time CL dependencies.
 	(gnus-agent-unfetch-articles): New function.
 	(gnus-agent-fetch-headers): Use gnus-agent-braid-nov to validate
 	article numbers even when local .overview file is missing.
 	(gnus-agent-read-article-number): New function. Only accepts
 	27-bit article numbers.
-	(gnus-agent-copy-nov-line, gnus-agent-uncached-articles): Use
-	gnus-agent-read-article-number.
+	(gnus-agent-copy-nov-line, gnus-agent-uncached-articles):
+	Use gnus-agent-read-article-number.
 	(gnus-agent-braid-nov): Rewrote to validate article numbers coming
 	from backend while recognizing that article numbers in .overview
 	must be valid.
 
-	* gnus-start.el (gnus-convert-old-newsrc): Changed message text as
+	* gnus-start.el (gnus-convert-old-newsrc): Change message text as
 	some users confused by references to .newsrc when they only have a
 	.newsrc.eld file.
-	(gnus-convert-mark-converter-prompt,
-	gnus-convert-converter-needs-prompt): Fixed use of property list.
+	(gnus-convert-mark-converter-prompt)
+	(gnus-convert-converter-needs-prompt): Fix use of property list.
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc> for Katsumi Yamaoka  <yamaoka@jpl.org>
 
@@ -310,18 +316,18 @@
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc> for Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
-	* gnus-agent.el (gnus-agent-synchronize-flags): Default to nil. 
-	(gnus-agent-regenerate-group): Using nil messages aren't valid. 
+	* gnus-agent.el (gnus-agent-synchronize-flags): Default to nil.
+	(gnus-agent-regenerate-group): Using nil messages aren't valid.
 
 2004-10-18  Kevin Greiner  <kevin.greiner@compsol.cc> for Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
-	* gnus-agent.el (gnus-agent-read-agentview): Inline
-	gnus-uncompress-range.
+	* gnus-agent.el (gnus-agent-read-agentview):
+	Inline gnus-uncompress-range.
 
 2004-10-18  Kevin Greiner  <kgreiner@xpediantsolutions.com>
-		
+
 	* legacy-gnus-agent.el
-	(gnus-agent-convert-to-compressed-agentview): Fixed typos with
+	(gnus-agent-convert-to-compressed-agentview): Fix typos with
 	help from Florian Weimer <fw@deneb.enyo.de>
 
 	* gnus-agent.el (gnus-agentize):
@@ -345,25 +351,25 @@
 	`method' parameter is nil.  Don't write nil entries into the
 	active file.
 	(gnus-agent-get-group-info): New function.
-	(gnus-agent-get-local): Added optional parameters to avoid calling
+	(gnus-agent-get-local): Add optional parameters to avoid calling
 	gnus-group-real-name and gnus-find-method-for-group.
 	(gnus-agent-set-local): Delete stored entry if either min, or max,
 	are nil.
-	(gnus-agent-fetch-session): Reworded error/quit messages.  On
-	quit, use gnus-agent-regenerate-group to record existance of any
+	(gnus-agent-fetch-session): Reword error/quit messages.
+	On quit, use gnus-agent-regenerate-group to record existance of any
 	articles fetched to disk before the quit occurred.
 
-	* gnus-int.el (gnus-request-delete-group): Use
-	gnus-cache-delete-group and gnus-agent-delete-group to keep the
+	* gnus-int.el (gnus-request-delete-group):
+	Use gnus-cache-delete-group and gnus-agent-delete-group to keep the
 	local disk in sync with the server.
-	 (gnus-request-rename-group): Use
-	gnus-cache-rename-group and gnus-agent-rename-group to keep the
+	 (gnus-request-rename-group):
+	Use gnus-cache-rename-group and gnus-agent-rename-group to keep the
 	local disk in sync with the server.
 
-	* gnus-start.el (gnus-get-unread-articles): Cosmetic
-	simplification to logic.
+	* gnus-start.el (gnus-get-unread-articles):
+	Cosmetic simplification to logic.
 
-	* gnus-group.el (): (gnus-group-delete-group): No longer update
+	* gnus-group.el (gnus-group-delete-group): No longer update
 	gnus-cache-active-altered as gnus-request-delete-group now keeps
 	the cache in sync.
 	(gnus-group-list-active): Let the agent store a server's active
@@ -389,8 +395,8 @@
 
 2004-10-18  Kevin Greiner <kevin.greiner@compsol.cc>
 
-	* gnus-agent.el (gnus-agent-read-local): Bind
-	nnheader-file-coding-system to gnus-agent-file-coding-system to
+	* gnus-agent.el (gnus-agent-read-local):
+	Bind nnheader-file-coding-system to gnus-agent-file-coding-system to
 	avoid the implicit assumption that they will always be equal.
 	(gnus-agent-save-local): Bind buffer-file-coding-system, not
 	coding-system-for-write, as the with-temp-file macro first prints
@@ -401,12 +407,12 @@
 	* legacy-gnus-agent.el (): New. Provides converters that are only
 	loaded when gnus-convert-old-newsrc needs to call them.
 
-	* gnus-agent.el (gnus-agent-read-agentview): Removed support for
+	* gnus-agent.el (gnus-agent-read-agentview): Remove support for
 	old file versions.
-	(gnus-group-prepare-hook): Removed function that converted list
+	(gnus-group-prepare-hook): Remove function that converted list
 	form of gnus-agent-expire-days to group properties.
 
-	* gnus-start.el (gnus-convert-old-newsrc): Registered new
+	* gnus-start.el (gnus-convert-old-newsrc): Register new
 	converters to handle old agent file formats.  Added logic for a
 	"backup before upgrading warning".
 	(gnus-convert-mark-converter-prompt): Developers can mark
@@ -422,10 +428,9 @@
 	articles are being added to a group.
 	(gnus-request-replace-article): Inform the agent that articles
 	need to be uncached as the cached contents are no longer valid.
-	
-        * gnus-agent.el (gnus-agent-file-header-cache): Removed.
-	(gnus-agent-possibly-alter-active): Avoid null in numeric
-	comparison.
+
+	* gnus-agent.el (gnus-agent-file-header-cache): Remove.
+	(gnus-agent-possibly-alter-active): Avoid null in numeric comparison.
 	(gnus-agent-set-local): Refuse to save null in local object table.
 	(gnus-agent-regenerate-group): The REREAD parameter can now be a
 	list of articles that will be marked as unread.
@@ -456,8 +461,8 @@
 2004-10-18  Kevin Greiner <kevin.greiner@compsol.cc>
 
 	* gnus-draft.el (gnus-group-send-queue): Pass the group name
-	"nndraft:queue" along to gnus-draft-send.  Use
-	gnus-agent-prompt-send-queue.
+	"nndraft:queue" along to gnus-draft-send.
+	Use gnus-agent-prompt-send-queue.
 	(gnus-draft-send): Rebind gnus-agent-queue-mail to nil when group
 	is "nndraft:queue".  Suggested by Gaute Strokkenes
 	<gs234@srcf.ucam.org>
@@ -467,9 +472,8 @@
 	gnus-list-of-unread-articles, to avoid exhausting memory with huge
 	numbers of articles.  Use gnus-range-map to avoid having to
 	uncompress the unread list.
-	(gnus-group-archive-directory,
-	gnus-group-recent-archive-directory): Fixed invalid ange-ftp
-	reference.
+	(gnus-group-archive-directory)
+	(gnus-group-recent-archive-directory): Fix invalid ange-ftp reference.
 
 	* gnus-range.el (gnus-range-map): Iterate over list or sequence.
 	(gnus-sorted-range-intersection): Intersection of two ranges
@@ -480,11 +484,11 @@
 	and agentized articles.
 	(gnus-convert-old-newsrc): Rewrote in anticipation of having
 	multiple version-dependent converters.
-	(gnus-groups-to-gnus-format): Replaced gnus-agent-save-groups with
+	(gnus-groups-to-gnus-format): Replace gnus-agent-save-groups with
 	gnus-agent-save-active.
 	(gnus-save-newsrc-file): Save dirty agent range limits.
 
-	* gnus-sum.el (gnus-select-newgroup): Replaced inline code with
+	* gnus-sum.el (gnus-select-newgroup): Replace inline code with
 	gnus-agent-possibly-alter-active.
 	(gnus-adjust-marked-articles): Faster handling of simple lists
 
@@ -502,15 +506,14 @@
 
 	* gnus-sum.el (gnus-summary-make-menu-bar): Add help texts.
 
-	* gnus-art.el (gnus-button-alist): Improve
-	`gnus-button-handle-library' entry.
-
-	* gnus-art.el (gnus-button-alist): Fixed regexp for manual links.
+	* gnus-art.el (gnus-button-alist):
+	Improve `gnus-button-handle-library' entry.
 
-	* gnus-group.el (gnus-group-get-new-news-this-group): Added
-	doc-string.
+	* gnus-art.el (gnus-button-alist): Fix regexp for manual links.
 
-	* gnus-start.el (gnus-activate-group): Added doc-string.
+	* gnus-group.el (gnus-group-get-new-news-this-group): Add doc-string.
+
+	* gnus-start.el (gnus-activate-group): Add doc-string.
 
 	* gnus-art.el (gnus-button-handle-man, gnus-button-alist): Try to
 	handle manual section.
@@ -519,8 +522,8 @@
 	(imap-interactive-login): Use it.
 	Suggested by Mark Plaksin <happy@mcplaksin.org>.
 
-	* gnus-art.el (gnus-button-alist, gnus-header-button-alist): Allow
-	/ in mailto URLs.
+	* gnus-art.el (gnus-button-alist, gnus-header-button-alist):
+	Allow / in mailto URLs.
 
 	* spam.el (spam-directory): Derive from `gnus-directory'.
 
@@ -528,7 +531,7 @@
 
 2004-10-17  Richard M. Stallman  <rms@gnu.org>
 
-	* gnus-registry.el (gnus-registry-unload-hook): 
+	* gnus-registry.el (gnus-registry-unload-hook):
 	Set as a variable with add-hook.
 
 	* nnspool.el (nnspool-spool-directory): Use news-directory instead
@@ -638,15 +641,14 @@
 
 	* gnus-diary.el (gnus-diary-header-schedule): caddr -> car (cddr
 
-	* gnus-art.el (gnus-article-edit-mode): Define before first
-	reference.
+	* gnus-art.el (gnus-article-edit-mode): Define before first reference.
 
 	* gnus.el (gnus-method-to-server): Move defsubst before first use.
 
-	* spam.el (spam-check-spamoracle, spam-spamoracle-learn): Fix
-	format string mismatch.
-	* nnml.el (nnml-request-set-mark, nnml-save-marks): do.	
-	* nnfolder.el (nnfolder-request-set-mark, nnfolder-save-marks): do.
+	* spam.el (spam-check-spamoracle, spam-spamoracle-learn):
+	Fix format string mismatch.
+	* nnml.el (nnml-request-set-mark, nnml-save-marks): Do.
+	* nnfolder.el (nnfolder-request-set-mark, nnfolder-save-marks): Do.
 
 2004-09-27  Reiner Steib  <Reiner.Steib@gmx.de>
 
@@ -663,18 +665,18 @@
 
 	* mm-util.el (mm-charset-synonym-alist): Remove obsolete entries
 	for big5 and gb2312.
-	
+
 	* rfc2047.el (rfc2047-pad-base64): Deal with more cases of invalid
 	padding.
 
-	* mm-bodies.el (mm-7bit-chars): Don't include \r.	
+	* mm-bodies.el (mm-7bit-chars): Don't include \r.
 
 	* mml.el (mml-compute-boundary-1): Don't uncompress files.
 
 	* rfc2047.el (rfc2047-qp-or-base64): New function to reduce
 	dependencies.
 	(rfc2047-encode): Use it.
-	
+
 	* flow-fill.el: Typo.
 
 	* mml.el (mml-generate-mime-1): Don't use format=flowed with
@@ -1010,13 +1012,12 @@
 	* starttls.el: Merge with my GNUTLS based starttls.el.
 	(starttls-gnutls-program, starttls-use-gnutls)
 	(starttls-extra-arguments, starttls-process-connection-type)
-	(starttls-connect, starttls-failure, starttls-success): New
-	variables.
+	(starttls-connect, starttls-failure, starttls-success): New variables.
 	(starttls-program, starttls-extra-args): Doc fix.
-	(starttls-negotiate-gnutls, starttls-open-stream-gnutls): New
-	functions.
-	(starttls-negotiate, starttls-open-stream): Check
-	`starttls-use-gnutls' and pass on to corresponding *-gnutls
+	(starttls-negotiate-gnutls, starttls-open-stream-gnutls):
+	New functions.
+	(starttls-negotiate, starttls-open-stream):
+	Check `starttls-use-gnutls' and pass on to corresponding *-gnutls
 	function if it is set.
 
 2004-08-31  Simon Josefsson  <jas@extundo.com>
@@ -1025,8 +1026,8 @@
 	?* and ?\; (tiny patch).  From Andreas Schwab <schwab@suse.de>.
 
 	* ietf-drums.el (ietf-drums-syntax-table): Set syntax of ?* ?\;
-	and ?\' to symbol instead of whitespace (tiny patch).  From
-	Andreas Schwab <schwab@suse.de>.
+	and ?\' to symbol instead of whitespace (tiny patch).
+	From Andreas Schwab <schwab@suse.de>.
 
 2004-08-31  Jesper Harder  <harder@ifa.au.dk>
 
@@ -1048,7 +1049,7 @@
 
 2004-08-31  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
-	* message.el (message-idna-inside-rhs-p): Removed.
+	* message.el (message-idna-inside-rhs-p): Remove.
 	(message-idna-to-ascii-rhs-1): Use proper address parsing.
 
 2004-08-31  Katsumi Yamaoka  <yamaoka@jpl.org>
@@ -1075,8 +1076,8 @@
 	Karl Chen <quarl@nospam.quarl.org> and Reiner Steib
 	<Reiner.Steib@gmx.de>.
 
-	* gnus-cus.el (gnus-agent-cat-prepare-category-field): Replace
-	pp-to-string with gnus-pp-to-string.
+	* gnus-cus.el (gnus-agent-cat-prepare-category-field):
+	Replace pp-to-string with gnus-pp-to-string.
 
 	* gnus-eform.el (gnus-edit-form): Replace pp with gnus-pp.
 
@@ -1085,8 +1086,8 @@
 
 	* gnus-msg.el (gnus-setup-message): Ignore an article copy while
 	parsing gnus-posting-styles when the message is not for replying.
-	(gnus-summary-resend-message-edit): Call mime-to-mml.  Suggested
-	by Hiroshi Fujishima <pooh@nature.tsukuba.ac.jp>.
+	(gnus-summary-resend-message-edit): Call mime-to-mml.
+	Suggested by Hiroshi Fujishima <pooh@nature.tsukuba.ac.jp>.
 	(gnus-debug): Replace pp with gnus-pp.
 
 	* gnus-score.el (gnus-score-save): Replace pp with gnus-pp.
@@ -1095,8 +1096,8 @@
 	gnus-pp-to-string.
 
 	* gnus-sum.el (gnus-read-header): Don't remove a header for the
-	parent article of a sparse article in the thread hashtb.  From
-	Stefan Wiens <s.wi@gmx.net>.
+	parent article of a sparse article in the thread hashtb.
+	From Stefan Wiens <s.wi@gmx.net>.
 
 	* gnus-util.el (gnus-bind-print-variables): New macro.
 	(gnus-prin1): Use it.
@@ -1120,8 +1121,8 @@
 	t while entering a file name using the mm-with-multibyte macro.
 	Suggested by Hiroshi Fujishima <pooh@nature.tsukuba.ac.jp>.
 
-	* mm-encode.el (mm-content-transfer-encoding-defaults): Use
-	qp-or-base64 for the application/* types.
+	* mm-encode.el (mm-content-transfer-encoding-defaults):
+	Use qp-or-base64 for the application/* types.
 	(mm-safer-encoding): Consider 7bit is safe.
 
 	* mm-util.el (mm-with-multibyte-buffer): New macro.
@@ -1146,9 +1147,9 @@
 
 	* webmail.el (webmail-debug): Replace pp with gnus-pp.
 
-	* gnus-art.el (gnus-article-wash-html-with-w3m): Bind
-	w3m-safe-url-regexp as the value for mm-w3m-safe-url-regexp; use
-	w3m-minor-mode-map instead of mm-w3m-local-map-property.
+	* gnus-art.el (gnus-article-wash-html-with-w3m):
+	Bind w3m-safe-url-regexp as the value for mm-w3m-safe-url-regexp;
+	use w3m-minor-mode-map instead of mm-w3m-local-map-property.
 	(gnus-mime-save-part-and-strip): Use mm-complicated-handles
 	instead of mm-multiple-handles.
 	(gnus-mime-delete-part): Ditto.
@@ -1193,12 +1194,12 @@
 	* mm-decode.el (mime-display, mime-security): Fix custom-manual
 	entries.
 
-	* gnus-art.el (gnus-article): Ditto.  
+	* gnus-art.el (gnus-article): Ditto.
 
 2004-08-23  Katsumi Yamaoka  <yamaoka@jpl.org>
 
-	* gnus-art.el (article-hide-list-identifiers): Bind
-	inhibit-read-only as t.
+	* gnus-art.el (article-hide-list-identifiers):
+	Bind inhibit-read-only as t.
 
 2004-08-22  Reiner Steib  <Reiner.Steib@gmx.de>
 
@@ -1233,8 +1234,8 @@
 
 	* mailcap.el (mailcap-mime-data): Mark as risky.
 
-	* gnus.el (gnus-group, gnus-summary, gnus-summary-sort): Fix
-	custom-manual entries.
+	* gnus.el (gnus-group, gnus-summary, gnus-summary-sort):
+	Fix custom-manual entries.
 
 	* time-date.el: Removed.  Merged into ../calendar/time-date.el.
 
@@ -1256,8 +1257,8 @@
 
 2004-05-19  Reiner Steib  <Reiner.Steib@gmx.de>
 
-	* gnus-msg.el (gnus-summary-followup-with-original): Document
-	yanking of region when active.
+	* gnus-msg.el (gnus-summary-followup-with-original):
+	Document yanking of region when active.
 
 2004-04-13 Kevin Greiner <kgreiner@xpediantsolutions.com>
 
--- a/lisp/gnus/gnus-sum.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/gnus/gnus-sum.el	Wed Dec 08 22:20:27 2004 +0000
@@ -6676,15 +6676,12 @@
 	(when (eq mode 'gnus-summary-mode)
 	  (gnus-kill-buffer buf)))
       (setq gnus-current-select-method gnus-select-method)
-      (if leave-hidden
-	  (set-buffer gnus-group-buffer)
-	(pop-to-buffer gnus-group-buffer))
-      (if (not quit-config)
-	  (progn
-	    (goto-char group-point)
-	    (unless leave-hidden
-	      (gnus-configure-windows 'group 'force)))
-	(gnus-handle-ephemeral-exit quit-config))
+      (set-buffer gnus-group-buffer)
+      (if quit-config
+	  (gnus-handle-ephemeral-exit quit-config)
+	(goto-char group-point)
+	(unless leave-hidden
+	  (gnus-configure-windows 'group 'force)))
       ;; Clear the current group name.
       (unless quit-config
 	(setq gnus-newsgroup-name nil)))))
@@ -11769,5 +11766,5 @@
 ;; coding: iso-8859-1
 ;; End:
 
-;;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
+;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
 ;;; gnus-sum.el ends here
--- a/lisp/ido.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/ido.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1763,7 +1763,10 @@
 	    (setq ido-set-default-item t))))
 
        ;; Handling the require-match must be done in a better way.
-       ((and require-match (not (ido-existing-item-p)))
+       ((and require-match
+	     (not (if ido-directory-too-big
+		      (file-exists-p (concat ido-current-directory ido-final-text))
+		    (ido-existing-item-p))))
 	(error "must specify valid item"))
 
        (t
--- a/lisp/imenu.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/imenu.el	Wed Dec 08 22:20:27 2004 +0000
@@ -62,8 +62,6 @@
 
 ;;; Code:
 
-(require 'newcomment)
-
 (eval-when-compile (require 'cl))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -745,8 +743,8 @@
 ;;;###autoload
 (make-variable-buffer-local 'imenu-case-fold-search)
 
-;; Originally "Built on some ideas that Erik Naggum <erik@naggum.no>
-;; once posted to comp.emacs" but since substantially re-written.
+;; This function can be called with quitting disabled,
+;; so it needs to be careful never to loop!
 (defun imenu--generic-function (patterns)
   "Return an index of the current buffer as an alist.
 
@@ -800,6 +798,7 @@
     (unwind-protect			; for syntax table
 	(save-match-data
 	  (set-syntax-table table)
+
 	  ;; map over the elements of imenu-generic-expression
 	  ;; (typically functions, variables ...)
 	  (dolist (pat patterns)
@@ -808,44 +807,42 @@
 		  (index (nth 2 pat))
 		  (function (nth 3 pat))
 		  (rest (nthcdr 4 pat))
-		  start
-		  cs)
+		  start)
 	      ;; Go backwards for convenience of adding items in order.
 	      (goto-char (point-max))
-	      (while (re-search-backward regexp nil t)
+	      (while (and (re-search-backward regexp nil t)
+			  ;; Exit the loop if we get an empty match,
+			  ;; because it means a bad regexp was specified.
+			  (not (= (match-beginning 0) (match-end 0))))
 		(setq start (point))
 		(goto-char (match-end index))
 		(setq beg (match-beginning index))
-		(setq cs (and comment-start-skip
-			      (save-match-data (comment-beginning))))
-		(if cs
-		    (goto-char (min cs beg)) ; skip this one, it's in a comment
-		  (goto-char beg)
-		  (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)))
-		  (let ((item
-			 (if function
-			     (nconc (list (match-string-no-properties index)
-					  beg function)
-				    rest)
-			   (cons (match-string-no-properties index)
-				 beg)))
-			;; 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)))))
+		(goto-char beg)
+		(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)))
+		(let ((item
+		       (if function
+			   (nconc (list (match-string-no-properties index)
+					beg function)
+				  rest)
+			 (cons (match-string-no-properties index)
+			       beg)))
+		      ;; 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))))
 	  (set-syntax-table old-table)))
     (imenu-progress-message prev-pos 100 t)
     ;; Sort each submenu by position.
--- a/lisp/info-look.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/info-look.el	Wed Dec 08 22:20:27 2004 +0000
@@ -894,7 +894,7 @@
 ;; entries for the same term in some cases.  --fx
 (info-lookup-maybe-add-help
  :mode 'cfengine-mode
- :regexp "[[:alnum:]_]+\\(:?()\\)?"
+ :regexp "[[:alnum:]_]+\\(?:()\\)?"
  :doc-spec '(("(cfengine-Reference)Variable Index"
 	      (lambda (item)
 		;; Index entries may be like `IsPlain()'
--- a/lisp/info.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/info.el	Wed Dec 08 22:20:27 2004 +0000
@@ -188,7 +188,7 @@
   :type 'boolean
   :group 'info)
 
-(defcustom Info-search-whitespace-regexp "\\(?:\\s-+\\)"
+(defcustom Info-search-whitespace-regexp "\\s-+"
   "*If non-nil, regular expression to match a sequence of whitespace chars.
 This applies to Info search for regular expressions.
 You might want to use something like \"[ \\t\\r\\n]+\" instead.
@@ -1486,14 +1486,14 @@
 				(isearch-range-invisible found beg-found)
 			      (isearch-range-invisible beg-found found))
 			    ;; Skip node header line
-			    (save-excursion (forward-line -1)
-					    (looking-at "\^_"))
+			    (and (save-excursion (forward-line -1)
+						 (looking-at "\^_"))
+				 (forward-line 1))
 			    ;; Skip Tag Table node
 			    (save-excursion
 			      (and (search-backward "\^_" nil t)
 				   (looking-at "\^_\nTag Table"))))))
-	    (let ((search-spaces-regexp
-		   Info-search-whitespace-regexp))
+	    (let ((search-spaces-regexp Info-search-whitespace-regexp))
 	      (if (if backward
 		      (re-search-backward regexp bound t)
 		    (re-search-forward regexp bound t))
@@ -1503,9 +1503,10 @@
       ;; If no subfiles, give error now.
       (if give-up
 	  (if (null Info-current-subfile)
-	      (if backward
-                  (re-search-backward regexp)
-                (re-search-forward regexp))
+	      (let ((search-spaces-regexp Info-search-whitespace-regexp))
+		(if backward
+		    (re-search-backward regexp)
+		  (re-search-forward regexp)))
 	    (setq found nil)))
 
       (unless (or found bound)
@@ -1561,18 +1562,20 @@
 				      (isearch-range-invisible found beg-found)
 				    (isearch-range-invisible beg-found found))
 				  ;; Skip node header line
-				  (save-excursion (forward-line -1)
-						  (looking-at "\^_"))
+				  (and (save-excursion (forward-line -1)
+						       (looking-at "\^_"))
+				       (forward-line 1))
 				  ;; Skip Tag Table node
 				  (save-excursion
 				    (and (search-backward "\^_" nil t)
 					 (looking-at "\^_\nTag Table"))))))
-		  (if (if backward
-                          (re-search-backward regexp nil t)
-                        (re-search-forward regexp nil t))
-		      (setq found (point) beg-found (if backward (match-end 0)
-                                                      (match-beginning 0)))
-		    (setq give-up t)))
+		  (let ((search-spaces-regexp Info-search-whitespace-regexp))
+		    (if (if backward
+			    (re-search-backward regexp nil t)
+			  (re-search-forward regexp nil t))
+			(setq found (point) beg-found (if backward (match-end 0)
+							(match-beginning 0)))
+		      (setq give-up t))))
 		(if give-up
 		    (setq found nil))
 		(if found
--- a/lisp/international/mule-util.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/international/mule-util.el	Wed Dec 08 22:20:27 2004 +0000
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
 ;; Licensed to the Free Software Foundation.
-;; Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2002, 2004  Free Software Foundation, Inc.
 
 ;; Keywords: mule, multilingual
 
@@ -356,6 +356,9 @@
   (cond ((< char 256)
 	 ;; Single byte characters are always displayable.
 	 t)
+	((not enable-multibyte-characters)
+	 ;; Maybe there's a font for it, but we can't put it in the buffer.
+	 nil)
 	((display-multi-font-p)
 	 ;; On a window system, a character is displayable if we have
 	 ;; a font for that character in the default face of the
@@ -377,5 +380,5 @@
 ;; coding: iso-2022-7bit
 ;; End:
 
-;;; arch-tag: 5bdb52b6-a3a5-4529-b7a0-37d01b0e570b
+;; arch-tag: 5bdb52b6-a3a5-4529-b7a0-37d01b0e570b
 ;;; mule-util.el ends here
--- a/lisp/isearch.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/isearch.el	Wed Dec 08 22:20:27 2004 +0000
@@ -109,12 +109,14 @@
   :type 'boolean
   :group 'isearch)
 
-(defcustom search-whitespace-regexp "\\(?:\\s-+\\)"
+(defcustom search-whitespace-regexp "\\s-+"
   "*If non-nil, regular expression to match a sequence of whitespace chars.
 This applies to regular expression incremental search.
-You might want to use something like \"\\\\(?:[ \\t\\r\\n]+\\\\)\" instead.
-In the Customization buffer, that is `\\(?:[' followed by a space,
-a tab, a carriage return (control-M), a newline, and `]+\\)'."
+When you put a space or spaces in the incremental regexp, it stands for
+this, unless it is inside of a regexp construct such as [...] or *, + or ?.
+You might want to use something like \"[ \\t\\r\\n]+\" instead.
+In the Customization buffer, that is `[' followed by a space,
+a tab, a carriage return (control-M), a newline, and `]+'."
   :type 'regexp
   :group 'isearch)
 
@@ -260,8 +262,6 @@
     (define-key map "\r" 'isearch-exit)
     (define-key map "\C-j" 'isearch-printing-char)
     (define-key map "\t" 'isearch-printing-char)
-    (define-key map " " 'isearch-whitespace-chars)
-    (define-key map [?\S-\ ] 'isearch-whitespace-chars)
 
     (define-key map    "\C-w" 'isearch-yank-word-or-char)
     (define-key map "\M-\C-w" 'isearch-del-char)
@@ -485,7 +485,12 @@
 Do incremental search forward for regular expression.
 With a prefix argument, do a regular string search instead.
 Like ordinary incremental search except that your input
-is treated as a regexp.  See \\[isearch-forward] for more info."
+is treated as a regexp.  See \\[isearch-forward] for more info.
+
+In regexp incremental searches, a space or spaces normally matches
+any whitespace (the variable `search-whitespace-regexp' controls
+precisely what that means).  If you want to search for a literal space
+and nothing else, enter `[ ]'."
   (interactive "P\np")
   (isearch-mode t (null not-regexp) nil (not no-recursive-edit)))
 
@@ -1676,11 +1681,15 @@
     ;; Assume character codes 0200 - 0377 stand for characters in some
     ;; single-byte character set, and convert them to Emacs
     ;; characters.
-    (and enable-multibyte-characters
-	 (>= char ?\200)
-	 (<= char ?\377)
-	 (setq char (unibyte-char-to-multibyte char)))
-    (isearch-process-search-char char)))
+    (if (and isearch-regexp (= char ?\ ))
+	(if (subregexp-context-p isearch-string pos)
+	    (isearch-process-search-string "[ ]" " ")
+	  (isearch-process-search-char char))
+      (and enable-multibyte-characters
+	   (>= char ?\200)
+	   (<= char ?\377)
+	   (setq char (unibyte-char-to-multibyte char)))
+      (isearch-process-search-char char))))
 
 (defun isearch-return-char ()
   "Convert return into newline for incremental search.
@@ -1704,22 +1713,6 @@
 	  (isearch-process-search-multibyte-characters char)
 	(isearch-process-search-char char)))))
 
-(defun isearch-whitespace-chars ()
-  "Match all whitespace chars, if in regexp mode.
-If you want to search for just a space, type \\<isearch-mode-map>\\[isearch-quote-char] SPC."
-  (interactive)
-  (if isearch-regexp
-      (if (and search-whitespace-regexp (not isearch-within-brackets)
-	       (not isearch-invalid-regexp))
-	  (isearch-process-search-string search-whitespace-regexp " ")
-	(isearch-printing-char))
-    (progn
-      ;; This way of doing word search doesn't correctly extend current search.
-      ;;      (setq isearch-word t)
-      ;;      (setq isearch-adjusted t)
-      ;;      (goto-char isearch-barrier)
-      (isearch-printing-char))))
-
 (defun isearch-process-search-char (char)
   ;; Append the char to the search string, update the message and re-search.
   (isearch-process-search-string
@@ -1960,6 +1953,7 @@
       (let ((inhibit-point-motion-hooks search-invisible)
 	    (inhibit-quit nil)
 	    (case-fold-search isearch-case-fold-search)
+	    (search-spaces-regexp search-whitespace-regexp)
 	    (retry t))
 	(if isearch-regexp (setq isearch-invalid-regexp nil))
 	(setq isearch-within-brackets nil)
@@ -2373,7 +2367,8 @@
 (defun isearch-lazy-highlight-search ()
   "Search ahead for the next or previous match, for lazy highlighting.
 Attempt to do the search exactly the way the pending isearch would."
-  (let ((case-fold-search isearch-case-fold-search))
+  (let ((case-fold-search isearch-case-fold-search)
+	(search-spaces-regexp search-whitespace-regexp))
     (funcall (isearch-search-fun)
              isearch-string
              (if isearch-forward
--- a/lisp/kmacro.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/kmacro.el	Wed Dec 08 22:20:27 2004 +0000
@@ -237,6 +237,8 @@
 (defvar kmacro-counter 0
   "*Current keyboard macro counter.")
 
+(defvar kmacro-default-counter-format "%d")
+
 (defvar kmacro-counter-format "%d"
   "*Current keyboard macro counter format.")
 
@@ -268,12 +270,12 @@
 
 (defun kmacro-set-format (format)
   "Set macro counter FORMAT."
-  (interactive "sMacro Counter Format (printf format): ")
+  (interactive "sMacro Counter Format: ")
   (setq kmacro-counter-format
 	(if (equal format "") "%d" format))
   ;; redefine initial macro counter if we are not executing a macro.
   (if (not (or defining-kbd-macro executing-kbd-macro))
-      (setq kmacro-counter-format-start kmacro-counter-format)))
+      (setq kmacro-default-counter-format kmacro-counter-format)))
 
 
 (defun kmacro-display-counter (&optional value)
@@ -404,12 +406,12 @@
       (let* ((x 60)
 	     (m (format-kbd-macro macro))
 	     (l (length m))
-	     (z (and nil trunc (> l x))))
-	(message (format "%s%s: %s%s" (or descr "Macro")
-			 (if (= kmacro-counter 0) ""
-			   (format " [%s]"
-				   (format kmacro-counter-format-start kmacro-counter)))
-			 (if z (substring m 0 (1- x)) m) (if z "..." ""))))
+	     (z (and trunc (> l x))))
+	(message "%s%s: %s%s" (or descr "Macro")
+		 (if (= kmacro-counter 0) ""
+		   (format " [%s]"
+			   (format kmacro-counter-format-start kmacro-counter)))
+		 (if z (substring m 0 (1- x)) m) (if z "..." "")))
     (message (or empty "No keyboard macros defined"))))
 
 
@@ -588,7 +590,8 @@
 	      kmacro-initial-counter-value nil
 	      kmacro-counter-value-start kmacro-counter
 	      kmacro-last-counter kmacro-counter
-	      kmacro-counter-format-start kmacro-counter-format))
+	      kmacro-counter-format kmacro-default-counter-format
+	      kmacro-counter-format-start kmacro-default-counter-format))
 
       (start-kbd-macro append
 		       (and append
--- a/lisp/ldefs-boot.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/ldefs-boot.el	Wed Dec 08 22:20:27 2004 +0000
@@ -4,7 +4,7 @@
 
 ;;;### (autoloads (5x5-crack 5x5-crack-xor-mutate 5x5-crack-mutating-best
 ;;;;;;  5x5-crack-mutating-current 5x5-crack-randomly 5x5) "5x5"
-;;;;;;  "play/5x5.el" (16211 27037))
+;;;;;;  "play/5x5.el" (16775 26715))
 ;;; Generated autoloads from play/5x5.el
 
 (autoload (quote 5x5) "5x5" "\
@@ -64,7 +64,7 @@
 ;;;***
 
 ;;;### (autoloads (ada-mode ada-add-extensions) "ada-mode" "progmodes/ada-mode.el"
-;;;;;;  (16249 32008))
+;;;;;;  (16561 46414))
 ;;; Generated autoloads from progmodes/ada-mode.el
 
 (autoload (quote ada-add-extensions) "ada-mode" "\
@@ -125,7 +125,7 @@
 ;;;***
 
 ;;;### (autoloads (ada-header) "ada-stmt" "progmodes/ada-stmt.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16507 41097))
 ;;; Generated autoloads from progmodes/ada-stmt.el
 
 (autoload (quote ada-header) "ada-stmt" "\
@@ -136,7 +136,7 @@
 ;;;***
 
 ;;;### (autoloads (ada-find-file) "ada-xref" "progmodes/ada-xref.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16783 21522))
 ;;; Generated autoloads from progmodes/ada-xref.el
 
 (autoload (quote ada-find-file) "ada-xref" "\
@@ -151,7 +151,7 @@
 ;;;;;;  change-log-mode add-change-log-entry-other-window add-change-log-entry
 ;;;;;;  find-change-log prompt-for-change-log-name add-log-mailing-address
 ;;;;;;  add-log-full-name add-log-current-defun-function) "add-log"
-;;;;;;  "add-log.el" (16211 27008))
+;;;;;;  "add-log.el" (16816 23720))
 ;;; Generated autoloads from add-log.el
 
 (defvar add-log-current-defun-function nil "\
@@ -202,7 +202,7 @@
 (autoload (quote add-change-log-entry) "add-log" "\
 Find change log file, and add an entry for today and an item for this file.
 Optional arg WHOAMI (interactive prefix) non-nil means prompt for user
-name and site.
+name and email (stored in `add-log-full-name' and `add-log-mailing-address').
 
 Second arg FILE-NAME is file name of the change log.
 If nil, use the value of `change-log-default-name'.
@@ -288,8 +288,8 @@
 ;;;***
 
 ;;;### (autoloads (defadvice ad-add-advice ad-default-compilation-action
-;;;;;;  ad-redefinition-action) "advice" "emacs-lisp/advice.el" (16211
-;;;;;;  27023))
+;;;;;;  ad-redefinition-action) "advice" "emacs-lisp/advice.el" (16775
+;;;;;;  26709))
 ;;; Generated autoloads from emacs-lisp/advice.el
 
 (defvar ad-redefinition-action (quote warn) "\
@@ -388,7 +388,7 @@
 
 ;;;### (autoloads (align-newline-and-indent align-unhighlight-rule
 ;;;;;;  align-highlight-rule align-current align-entire align-regexp
-;;;;;;  align) "align" "align.el" (16211 27008))
+;;;;;;  align) "align" "align.el" (16780 55376))
 ;;; Generated autoloads from align.el
 
 (autoload (quote align) "align" "\
@@ -477,7 +477,7 @@
 
 ;;;***
 
-;;;### (autoloads (allout-init) "allout" "allout.el" (16271 3441))
+;;;### (autoloads (allout-init) "allout" "allout.el" (16775 26705))
 ;;; Generated autoloads from allout.el
 
 (autoload (quote allout-init) "allout" "\
@@ -493,17 +493,17 @@
  - anything else (eg, t) for auto-activation and auto-layout, without
    any confirmation check.
 
-Use this function to setup your emacs session for automatic activation
+Use this function to setup your Emacs session for automatic activation
 of allout outline mode, contingent to the buffer-specific setting of
 the `allout-layout' variable.  (See `allout-layout' and
 `allout-expose-topic' docstrings for more details on auto layout).
 
 `allout-init' works by setting up (or removing)
-`allout-find-file-hook' in `find-file-hooks', and giving
+`allout-find-file-hook' in `find-file-hook', and giving
 `allout-auto-activation' a suitable setting.
 
-To prime your emacs session for full auto-outline operation, include
-the following two lines in your emacs init file:
+To prime your Emacs session for full auto-outline operation, include
+the following two lines in your Emacs init file:
 
 \(require 'allout)
 \(allout-init t)
@@ -513,7 +513,7 @@
 ;;;***
 
 ;;;### (autoloads (ange-ftp-hook-function ange-ftp-reread-dir) "ange-ftp"
-;;;;;;  "net/ange-ftp.el" (16211 27037))
+;;;;;;  "net/ange-ftp.el" (16746 18215))
 ;;; Generated autoloads from net/ange-ftp.el
 
 (defalias (quote ange-ftp-re-read-dir) (quote ange-ftp-reread-dir))
@@ -532,12 +532,10 @@
 
 \(fn OPERATION &rest ARGS)" nil nil)
 
-(put (quote ange-ftp-hook-function) (quote file-remote-p) t)
-
 ;;;***
 
 ;;;### (autoloads (animate-birthday-present animate-sequence animate-string)
-;;;;;;  "animate" "play/animate.el" (16211 27038))
+;;;;;;  "animate" "play/animate.el" (16442 4954))
 ;;; Generated autoloads from play/animate.el
 
 (autoload (quote animate-string) "animate" "\
@@ -557,14 +555,15 @@
 \(fn LIST-OF-STRINGS SPACE)" nil nil)
 
 (autoload (quote animate-birthday-present) "animate" "\
-Display Sarah's birthday present in a new buffer.
-
-\(fn)" t nil)
+Display one's birthday present in a new buffer.
+You can specify the one's name by NAME; the default value is \"Sarah\".
+
+\(fn &optional NAME)" t nil)
 
 ;;;***
 
 ;;;### (autoloads (ansi-color-process-output ansi-color-for-comint-mode-on)
-;;;;;;  "ansi-color" "ansi-color.el" (16211 27008))
+;;;;;;  "ansi-color" "ansi-color.el" (16213 43266))
 ;;; Generated autoloads from ansi-color.el
 
 (autoload (quote ansi-color-for-comint-mode-on) "ansi-color" "\
@@ -590,7 +589,7 @@
 ;;;***
 
 ;;;### (autoloads (antlr-set-tabs antlr-mode antlr-show-makefile-rules)
-;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (16277 42320))
+;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (16377 12872))
 ;;; Generated autoloads from progmodes/antlr-mode.el
 
 (autoload (quote antlr-show-makefile-rules) "antlr-mode" "\
@@ -626,16 +625,16 @@
 
 ;;;***
 
-;;;### (autoloads (appt-make-list appt-delete appt-add appt-display-diary
-;;;;;;  appt-display-duration appt-msg-window appt-display-mode-line
-;;;;;;  appt-visible appt-audible appt-message-warning-time appt-issue-message)
-;;;;;;  "appt" "calendar/appt.el" (16211 27023))
+;;;### (autoloads (appt-activate appt-make-list appt-delete appt-add
+;;;;;;  appt-display-diary appt-display-duration appt-display-mode-line
+;;;;;;  appt-msg-window appt-visible appt-audible appt-message-warning-time
+;;;;;;  appt-issue-message) "appt" "calendar/appt.el" (16547 17258))
 ;;; Generated autoloads from calendar/appt.el
 
 (defvar appt-issue-message t "\
 *Non-nil means check for appointments in the diary buffer.
-To be detected, the diary entry must have the time
-as the first thing on a line.")
+To be detected, the diary entry must have the format described in the
+documentation of the function `appt-check'.")
 
 (custom-autoload (quote appt-issue-message) "appt")
 
@@ -650,27 +649,31 @@
 (custom-autoload (quote appt-audible) "appt")
 
 (defvar appt-visible t "\
-*Non-nil means display appointment message in echo area.")
+*Non-nil means display appointment message in echo area.
+This variable is only relevant if `appt-msg-window' is nil.")
 
 (custom-autoload (quote appt-visible) "appt")
 
+(defvar appt-msg-window t "\
+*Non-nil means display appointment message in another window.
+If non-nil, this variable overrides `appt-visible'.")
+
+(custom-autoload (quote appt-msg-window) "appt")
+
 (defvar appt-display-mode-line t "\
-*Non-nil means display minutes to appointment and time on the mode line.")
+*Non-nil means display minutes to appointment and time on the mode line.
+This is in addition to any other display of appointment messages.")
 
 (custom-autoload (quote appt-display-mode-line) "appt")
 
-(defvar appt-msg-window t "\
-*Non-nil means display appointment message in another window.")
-
-(custom-autoload (quote appt-msg-window) "appt")
-
 (defvar appt-display-duration 10 "\
-*The number of seconds an appointment message is displayed.")
+*The number of seconds an appointment message is displayed.
+Only relevant if reminders are to be displayed in their own window.")
 
 (custom-autoload (quote appt-display-duration) "appt")
 
 (defvar appt-display-diary t "\
-*Non-nil means to display the next days diary on the screen.
+*Non-nil displays the diary when the appointment list is first initialized.
 This will occur at midnight when the appointment list is updated.")
 
 (custom-autoload (quote appt-display-diary) "appt")
@@ -687,33 +690,29 @@
 \(fn)" t nil)
 
 (autoload (quote appt-make-list) "appt" "\
-Create the appointments list from todays diary buffer.
+Create the appointments list from today's diary buffer.
 The time must be at the beginning of a line for it to be
-put in the appointments list.
-  02/23/89
-    12:00pm lunch
-   Wednesday
-     10:00am group meeting
-We assume that the variables DATE and NUMBER
-hold the arguments that `list-diary-entries' received.
+put in the appointments list (see examples in documentation of
+the function `appt-check').  We assume that the variables DATE and
+NUMBER hold the arguments that `list-diary-entries' received.
 They specify the range of dates that the diary is being processed for.
 
 \(fn)" nil nil)
 
+(autoload (quote appt-activate) "appt" "\
+Toggle checking of appointments.
+With optional numeric argument ARG, turn appointment checking on if
+ARG is positive, otherwise off.
+
+\(fn &optional ARG)" t nil)
+
 ;;;***
 
 ;;;### (autoloads (apropos-documentation apropos-value apropos apropos-documentation-property
-;;;;;;  apropos-command apropos-variable apropos-mode) "apropos"
-;;;;;;  "apropos.el" (16211 27008))
+;;;;;;  apropos-command apropos-variable) "apropos" "apropos.el"
+;;;;;;  (16768 48631))
 ;;; Generated autoloads from apropos.el
 
-(autoload (quote apropos-mode) "apropos" "\
-Major mode for following hyperlinks in output of apropos commands.
-
-\\{apropos-mode-map}
-
-\(fn)" t nil)
-
 (autoload (quote apropos-variable) "apropos" "\
 Show user variables that match REGEXP.
 With optional prefix DO-ALL or if `apropos-do-all' is non-nil, also show
@@ -765,8 +764,8 @@
 
 ;;;***
 
-;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (16211
-;;;;;;  27009))
+;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (16534
+;;;;;;  3807))
 ;;; Generated autoloads from arc-mode.el
 
 (autoload (quote archive-mode) "arc-mode" "\
@@ -786,7 +785,7 @@
 
 ;;;***
 
-;;;### (autoloads (array-mode) "array" "array.el" (16211 27011))
+;;;### (autoloads (array-mode) "array" "array.el" (16213 43267))
 ;;; Generated autoloads from array.el
 
 (autoload (quote array-mode) "array" "\
@@ -857,8 +856,8 @@
 
 ;;;***
 
-;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (16211
-;;;;;;  27040))
+;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (16572
+;;;;;;  19411))
 ;;; Generated autoloads from textmodes/artist.el
 
 (autoload (quote artist-mode) "artist" "\
@@ -1063,8 +1062,8 @@
 
 ;;;***
 
-;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (16211
-;;;;;;  27038))
+;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (16764
+;;;;;;  51521))
 ;;; Generated autoloads from progmodes/asm-mode.el
 
 (autoload (quote asm-mode) "asm-mode" "\
@@ -1092,7 +1091,7 @@
 ;;;***
 
 ;;;### (autoloads (auto-show-mode auto-show-mode) "auto-show" "obsolete/auto-show.el"
-;;;;;;  (16211 27037))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from obsolete/auto-show.el
 
 (defvar auto-show-mode nil "\
@@ -1108,7 +1107,7 @@
 ;;;***
 
 ;;;### (autoloads (autoarg-kp-mode autoarg-mode) "autoarg" "autoarg.el"
-;;;;;;  (16211 27012))
+;;;;;;  (16213 43267))
 ;;; Generated autoloads from autoarg.el
 
 (defvar autoarg-mode nil "\
@@ -1163,7 +1162,7 @@
 ;;;***
 
 ;;;### (autoloads (autoconf-mode) "autoconf" "progmodes/autoconf.el"
-;;;;;;  (16301 41845))
+;;;;;;  (16775 26716))
 ;;; Generated autoloads from progmodes/autoconf.el
 
 (autoload (quote autoconf-mode) "autoconf" "\
@@ -1174,7 +1173,7 @@
 ;;;***
 
 ;;;### (autoloads (auto-insert-mode define-auto-insert auto-insert)
-;;;;;;  "autoinsert" "autoinsert.el" (16211 27012))
+;;;;;;  "autoinsert" "autoinsert.el" (16793 54109))
 ;;; Generated autoloads from autoinsert.el
 
 (autoload (quote auto-insert) "autoinsert" "\
@@ -1212,15 +1211,18 @@
 
 ;;;### (autoloads (batch-update-autoloads update-directory-autoloads
 ;;;;;;  update-file-autoloads) "autoload" "emacs-lisp/autoload.el"
-;;;;;;  (16211 27023))
+;;;;;;  (16775 26709))
 ;;; Generated autoloads from emacs-lisp/autoload.el
 
 (autoload (quote update-file-autoloads) "autoload" "\
 Update the autoloads for FILE in `generated-autoload-file'
 \(which FILE might bind in its local variables).
-Return FILE if there was no autoload cookie in it.
-
-\(fn FILE)" t nil)
+If SAVE-AFTER is non-nil (which is always, when called interactively),
+save the buffer too.
+
+Return FILE if there was no autoload cookie in it, else nil.
+
+\(fn FILE &optional SAVE-AFTER)" t nil)
 
 (autoload (quote update-directory-autoloads) "autoload" "\
 Update loaddefs.el with all the current autoloads from DIRS, and no old ones.
@@ -1242,20 +1244,19 @@
 
 ;;;***
 
-;;;### (autoloads (global-auto-revert-mode turn-on-auto-revert-mode
-;;;;;;  auto-revert-mode) "autorevert" "autorevert.el" (16211 27012))
+;;;### (autoloads (global-auto-revert-mode turn-on-auto-revert-tail-mode
+;;;;;;  auto-revert-tail-mode turn-on-auto-revert-mode auto-revert-mode)
+;;;;;;  "autorevert" "autorevert.el" (16775 26705))
 ;;; Generated autoloads from autorevert.el
 
-(defvar auto-revert-mode nil "\
-*Non-nil when Auto-Revert Mode is active.
-Never set this variable directly, use the command `auto-revert-mode' instead.")
-
 (autoload (quote auto-revert-mode) "autorevert" "\
 Toggle reverting buffer when file on disk changes.
 
 With arg, turn Auto Revert mode on if and only if arg is positive.
 This is a minor mode that affects only the current buffer.
 Use `global-auto-revert-mode' to automatically revert all buffers.
+Use `auto-revert-tail-mode' if you know that the file will only grow
+without being changed in the part that is already in the buffer.
 
 \(fn &optional ARG)" t nil)
 
@@ -1267,6 +1268,32 @@
 
 \(fn)" nil nil)
 
+(autoload (quote auto-revert-tail-mode) "autorevert" "\
+Toggle reverting tail of buffer when file on disk grows.
+With arg, turn Tail mode on iff arg is positive.
+
+When Tail mode is enabled, the tail of the file is constantly
+followed, as with the shell command `tail -f'.  This means that
+whenever the file grows on disk (presumably because some
+background process is appending to it from time to time), this is
+reflected in the current buffer.
+
+You can edit the buffer and turn this mode off and on again as
+you please.  But make sure the background process has stopped
+writing before you save the file!
+
+Use `auto-revert-mode' for changes other than appends!
+
+\(fn &optional ARG)" t nil)
+
+(autoload (quote turn-on-auto-revert-tail-mode) "autorevert" "\
+Turn on Auto-Revert Tail Mode.
+
+This function is designed to be added to hooks, for example:
+  (add-hook 'my-logfile-mode-hook 'turn-on-auto-revert-tail-mode)
+
+\(fn)" nil nil)
+
 (defvar global-auto-revert-mode nil "\
 Non-nil if Global-Auto-Revert mode is enabled.
 See the command `global-auto-revert-mode' for a description of this minor-mode.
@@ -1276,7 +1303,7 @@
 (custom-autoload (quote global-auto-revert-mode) "autorevert")
 
 (autoload (quote global-auto-revert-mode) "autorevert" "\
-Revert any buffer when file on disk change.
+Revert any buffer when file on disk changes.
 
 With arg, turn Auto Revert mode on globally if and only if arg is positive.
 This is a minor mode that affects all buffers.
@@ -1287,7 +1314,7 @@
 ;;;***
 
 ;;;### (autoloads (mouse-avoidance-mode mouse-avoidance-mode) "avoid"
-;;;;;;  "avoid.el" (16211 27012))
+;;;;;;  "avoid.el" (16680 26001))
 ;;; Generated autoloads from avoid.el
 
 (defvar mouse-avoidance-mode nil "\
@@ -1328,7 +1355,7 @@
 ;;;***
 
 ;;;### (autoloads (backquote) "backquote" "emacs-lisp/backquote.el"
-;;;;;;  (16211 27023))
+;;;;;;  (16484 6599))
 ;;; Generated autoloads from emacs-lisp/backquote.el
 
 (autoload (quote backquote) "backquote" "\
@@ -1353,7 +1380,7 @@
 ;;;***
 
 ;;;### (autoloads (display-battery battery) "battery" "battery.el"
-;;;;;;  (16223 32933))
+;;;;;;  (16718 40975))
 ;;; Generated autoloads from battery.el
 
 (autoload (quote battery) "battery" "\
@@ -1375,7 +1402,7 @@
 ;;;***
 
 ;;;### (autoloads (benchmark benchmark-run-compiled benchmark-run)
-;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (16211 27023))
+;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (16213 43272))
 ;;; Generated autoloads from emacs-lisp/benchmark.el
 
 (autoload (quote benchmark-run) "benchmark" "\
@@ -1407,8 +1434,8 @@
 
 ;;;***
 
-;;;### (autoloads (bibtex-mode) "bibtex" "textmodes/bibtex.el" (16277
-;;;;;;  42320))
+;;;### (autoloads (bibtex-mode) "bibtex" "textmodes/bibtex.el" (16820
+;;;;;;  16328))
 ;;; Generated autoloads from textmodes/bibtex.el
 
 (autoload (quote bibtex-mode) "bibtex" "\
@@ -1416,18 +1443,16 @@
 
 General information on working with BibTeX mode:
 
-You should use commands such as \\[bibtex-Book] to get a template for a
-specific entry. You should then fill in all desired fields using
-\\[bibtex-next-field] to jump from field to field. After having filled
-in all desired fields in the entry, you should clean the new entry
-with the command \\[bibtex-clean-entry].
+Use commands such as \\[bibtex-Book] to get a template for a specific entry.
+Then fill in all desired fields using \\[bibtex-next-field] to jump from field
+to field.  After having filled in all desired fields in the entry, clean the
+new entry with the command \\[bibtex-clean-entry].
 
 Some features of BibTeX mode are available only by setting the variable
-`bibtex-maintain-sorted-entries' to non-nil. However, then BibTeX mode will
-work only with buffers containing valid (syntactical correct) entries
-and with entries being sorted. This is usually the case, if you have
-created a buffer completely with BibTeX mode and finished every new
-entry with \\[bibtex-clean-entry].
+`bibtex-maintain-sorted-entries' to non-nil.  However, then BibTeX mode
+works only with buffers containing valid (syntactical correct) and sorted
+entries.  This is usually the case, if you have created a buffer completely
+with BibTeX mode and finished every new entry with \\[bibtex-clean-entry].
 
 For third party BibTeX files, call the function `bibtex-convert-alien'
 to fully take advantage of all features of BibTeX mode.
@@ -1435,68 +1460,34 @@
 
 Special information:
 
-A command such as \\[bibtex-Book] will outline the fields for a BibTeX book entry.
-
-The optional fields start with the string OPT, and are thus ignored by BibTeX.
-Alternatives from which only one is required start with the string ALT.
-The OPT or ALT string may be removed from a field with \\[bibtex-remove-OPT-or-ALT].
+A command such as \\[bibtex-Book] outlines the fields for a BibTeX book entry.
+
+The names of optional fields start with the string OPT, and are thus ignored
+by BibTeX.  The names of alternative fields from which only one is required
+start with the string ALT.  The OPT or ALT string may be removed from
+the name of a field with \\[bibtex-remove-OPT-or-ALT].
 \\[bibtex-make-field] inserts a new field after the current one.
 \\[bibtex-kill-field] kills the current field entirely.
 \\[bibtex-yank] yanks the last recently killed field after the current field.
 \\[bibtex-remove-delimiters] removes the double-quotes or braces around the text of the current field.
- \\[bibtex-empty-field] replaces the text of the current field with the default \"\" or {}.
+\\[bibtex-empty-field] replaces the text of the current field with the default \"\" or {}.
+\\[bibtex-find-text] moves point to the end of the current field.
+\\[bibtex-complete] completes word fragment before point according to context.
 
 The command \\[bibtex-clean-entry] cleans the current entry, i.e. it removes OPT/ALT
-from all non-empty optional or alternative fields, checks that no required
-fields are empty, and does some formatting dependent on the value of
-`bibtex-entry-format'.
+from the names of all non-empty optional or alternative fields, checks that
+no required fields are empty, and does some formatting dependent on the value
+of `bibtex-entry-format'.  Furthermore, it can automatically generate a key
+for the BibTeX entry, see `bibtex-generate-autokey'.
 Note: some functions in BibTeX mode depend on entries being in a special
 format (all fields beginning on separate lines), so it is usually a bad
 idea to remove `realign' from `bibtex-entry-format'.
 
-Use \\[bibtex-find-text] to position the cursor at the end of the current field.
-Use \\[bibtex-next-field] to move to end of the next field.
-
-The following may be of interest as well:
-
-  Functions:
-    `bibtex-entry'
-    `bibtex-kill-entry'
-    `bibtex-yank-pop'
-    `bibtex-pop-previous'
-    `bibtex-pop-next'
-    `bibtex-complete'
-    `bibtex-print-help-message'
-    `bibtex-generate-autokey'
-    `bibtex-beginning-of-entry'
-    `bibtex-end-of-entry'
-    `bibtex-reposition-window'
-    `bibtex-mark-entry'
-    `bibtex-ispell-abstract'
-    `bibtex-ispell-entry'
-    `bibtex-narrow-to-entry'
-    `bibtex-sort-buffer'
-    `bibtex-validate'
-    `bibtex-count'
-    `bibtex-fill-entry'
-    `bibtex-reformat'
-    `bibtex-convert-alien'
-
-  Variables:
-    `bibtex-field-delimiters'
-    `bibtex-include-OPTcrossref'
-    `bibtex-include-OPTkey'
-    `bibtex-user-optional-fields'
-    `bibtex-entry-format'
-    `bibtex-sort-ignore-string-entries'
-    `bibtex-maintain-sorted-entries'
-    `bibtex-entry-field-alist'
-    `bibtex-predefined-strings'
-    `bibtex-string-files'
-
----------------------------------------------------------
-Entry to BibTeX mode calls the value of `bibtex-mode-hook' if that value is
-non-nil.
+BibTeX mode supports Imenu and hideshow minor mode (`hs-minor-mode').
+
+----------------------------------------------------------
+Entry to BibTeX mode calls the value of `bibtex-mode-hook'
+if that value is non-nil.
 
 \\{bibtex-mode-map}
 
@@ -1504,15 +1495,33 @@
 
 ;;;***
 
-;;;### (autoloads nil "binhex" "gnus/binhex.el" (16211 27027))
+;;;### (autoloads (binhex-decode-region binhex-decode-region-external
+;;;;;;  binhex-decode-region-internal) "binhex" "gnus/binhex.el"
+;;;;;;  (16719 60883))
 ;;; Generated autoloads from gnus/binhex.el
 
 (defconst binhex-begin-line "^:...............................................................$")
 
-;;;***
-
-;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (16211
-;;;;;;  27038))
+(autoload (quote binhex-decode-region-internal) "binhex" "\
+Binhex decode region between START and END without using an external program.
+If HEADER-ONLY is non-nil only decode header and return filename.
+
+\(fn START END &optional HEADER-ONLY)" t nil)
+
+(autoload (quote binhex-decode-region-external) "binhex" "\
+Binhex decode region between START and END using external decoder.
+
+\(fn START END)" t nil)
+
+(autoload (quote binhex-decode-region) "binhex" "\
+Binhex decode region between START and END.
+
+\(fn START END)" t nil)
+
+;;;***
+
+;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (16704
+;;;;;;  8186))
 ;;; Generated autoloads from play/blackbox.el
 
 (autoload (quote blackbox) "blackbox" "\
@@ -1634,7 +1643,7 @@
 ;;;### (autoloads (bookmark-bmenu-list bookmark-load bookmark-save
 ;;;;;;  bookmark-write bookmark-delete bookmark-insert bookmark-rename
 ;;;;;;  bookmark-insert-location bookmark-relocate bookmark-jump
-;;;;;;  bookmark-set) "bookmark" "bookmark.el" (16211 27012))
+;;;;;;  bookmark-set) "bookmark" "bookmark.el" (16588 19249))
 ;;; Generated autoloads from bookmark.el
  (define-key ctl-x-map "rb" 'bookmark-jump)
  (define-key ctl-x-map "rm" 'bookmark-set)
@@ -1823,7 +1832,7 @@
 ;;;;;;  browse-url-default-browser browse-url-at-mouse browse-url-at-point
 ;;;;;;  browse-url browse-url-of-region browse-url-of-dired-file
 ;;;;;;  browse-url-of-buffer browse-url-of-file browse-url-browser-function)
-;;;;;;  "browse-url" "net/browse-url.el" (16211 27037))
+;;;;;;  "browse-url" "net/browse-url.el" (16783 21522))
 ;;; Generated autoloads from net/browse-url.el
 
 (defvar browse-url-browser-function (cond ((memq system-type (quote (windows-nt ms-dos cygwin))) (quote browse-url-default-windows-browser)) ((memq system-type (quote (darwin))) (quote browse-url-default-macosx-browser)) (t (quote browse-url-default-browser))) "\
@@ -2073,7 +2082,7 @@
 \(fn URL &optional NEW-WINDOW)" t nil)
 
 (autoload (quote browse-url-mail) "browse-url" "\
-Open a new mail message buffer within Emacs.
+Open a new mail message buffer within Emacs for the RFC 2368 URL.
 Default to using the mailto: URL around or before point as the
 recipient's address.  Supplying a non-nil interactive prefix argument
 will cause the mail to be composed in another window rather than the
@@ -2106,8 +2115,8 @@
 
 ;;;***
 
-;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (16211
-;;;;;;  27038))
+;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (16213
+;;;;;;  43281))
 ;;; Generated autoloads from play/bruce.el
 
 (autoload (quote bruce) "bruce" "\
@@ -2123,7 +2132,7 @@
 ;;;***
 
 ;;;### (autoloads (bs-show bs-customize bs-cycle-previous bs-cycle-next)
-;;;;;;  "bs" "bs.el" (16211 27012))
+;;;;;;  "bs" "bs.el" (16704 8186))
 ;;; Generated autoloads from bs.el
 
 (autoload (quote bs-cycle-next) "bs" "\
@@ -2164,8 +2173,8 @@
 ;;;***
 
 ;;;### (autoloads (insert-text-button make-text-button insert-button
-;;;;;;  make-button define-button-type) "button" "button.el" (16310
-;;;;;;  39781))
+;;;;;;  make-button define-button-type) "button" "button.el" (16750
+;;;;;;  18527))
 ;;; Generated autoloads from button.el
 
 (defvar button-map (let ((map (make-sparse-keymap))) (define-key map "
" (quote push-button)) (define-key map [mouse-2] (quote push-button)) map) "\
@@ -2253,7 +2262,7 @@
 ;;;;;;  batch-byte-compile-if-not-done display-call-tree byte-compile
 ;;;;;;  compile-defun byte-compile-file byte-recompile-directory
 ;;;;;;  byte-force-recompile) "bytecomp" "emacs-lisp/bytecomp.el"
-;;;;;;  (16239 4666))
+;;;;;;  (16801 58026))
 ;;; Generated autoloads from emacs-lisp/bytecomp.el
 
 (autoload (quote byte-force-recompile) "bytecomp" "\
@@ -2290,7 +2299,7 @@
 
 (autoload (quote compile-defun) "bytecomp" "\
 Compile and evaluate the current top-level form.
-Print the result in the minibuffer.
+Print the result in the echo area.
 With argument, insert value in current buffer after the form.
 
 \(fn &optional ARG)" t nil)
@@ -2341,11 +2350,11 @@
 Must be used only with `-batch', and kills Emacs on completion.
 For example, invoke `emacs -batch -f batch-byte-recompile-directory .'.
 
-\(fn)" nil nil)
-
-;;;***
-
-;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (16211 27023))
+\(fn &optional ARG)" nil nil)
+
+;;;***
+
+;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (16630 17322))
 ;;; Generated autoloads from calendar/cal-dst.el
 
 (put (quote calendar-daylight-savings-starts) (quote risky-local-variable) t)
@@ -2355,7 +2364,7 @@
 ;;;***
 
 ;;;### (autoloads (list-yahrzeit-dates) "cal-hebrew" "calendar/cal-hebrew.el"
-;;;;;;  (16211 27023))
+;;;;;;  (16436 34880))
 ;;; Generated autoloads from calendar/cal-hebrew.el
 
 (autoload (quote list-yahrzeit-dates) "cal-hebrew" "\
@@ -2369,30 +2378,12 @@
 
 ;;;### (autoloads (defmath calc-embedded-activate calc-embedded calc-grab-rectangle
 ;;;;;;  calc-grab-region full-calc-keypad calc-keypad calc-eval quick-calc
-;;;;;;  full-calc calc calc-dispatch) "calc" "calc/calc.el" (16211
-;;;;;;  27022))
+;;;;;;  full-calc calc calc-dispatch) "calc" "calc/calc.el" (16816
+;;;;;;  23730))
 ;;; Generated autoloads from calc/calc.el
 
-(defvar calc-info-filename "calc.info" "\
-*File name in which to look for the Calculator's Info documentation.")
-
 (defvar calc-settings-file user-init-file "\
 *File in which to record permanent settings; default is `user-init-file'.")
-
-(defvar calc-autoload-directory nil "\
-Name of directory from which additional \".elc\" files for Calc should be
-loaded.  Should include a trailing \"/\".
-If nil, use original installation directory.
-This can safely be nil as long as the Calc files are on the load-path.")
-
-(defvar calc-gnuplot-name "gnuplot" "\
-*Name of GNUPLOT program, for calc-graph features.")
-
-(defvar calc-gnuplot-plot-command nil "\
-*Name of command for displaying GNUPLOT output; %s = file name to print.")
-
-(defvar calc-gnuplot-print-command "lp %s" "\
-*Name of command for printing GNUPLOT output; %s = file name to print.")
  (global-set-key "\e#" 'calc-dispatch)
 
 (autoload (quote calc-dispatch) "calc" "\
@@ -2408,7 +2399,7 @@
 (autoload (quote full-calc) "calc" "\
 Invoke the Calculator and give it a full-sized window.
 
-\(fn)" t nil)
+\(fn &optional INTERACTIVE)" t nil)
 
 (autoload (quote quick-calc) "calc" "\
 Do a quick calculation in the minibuffer without invoking full Calculator.
@@ -2428,13 +2419,13 @@
 In this mode, click on the Calc \"buttons\" using the left mouse button.
 Or, position the cursor manually and do M-x calc-keypad-press.
 
-\(fn)" t nil)
+\(fn &optional INTERACTIVE)" t nil)
 
 (autoload (quote full-calc-keypad) "calc" "\
 Invoke the Calculator in full-screen \"visual keypad\" mode.
 See calc-keypad for details.
 
-\(fn)" t nil)
+\(fn &optional INTERACTIVE)" t nil)
 
 (autoload (quote calc-grab-region) "calc" "\
 Parse the region as a vector of numbers and push it on the Calculator stack.
@@ -2464,19 +2455,8 @@
 
 ;;;***
 
-;;;### (autoloads (calc-extensions) "calc-ext" "calc/calc-ext.el"
-;;;;;;  (16211 27022))
-;;; Generated autoloads from calc/calc-ext.el
-
-(autoload (quote calc-extensions) "calc-ext" "\
-This function is part of the autoload linkage for parts of Calc.
-
-\(fn)" nil nil)
-
-;;;***
-
-;;;### (autoloads (calculator) "calculator" "calculator.el" (16211
-;;;;;;  27012))
+;;;### (autoloads (calculator) "calculator" "calculator.el" (16213
+;;;;;;  43267))
 ;;; Generated autoloads from calculator.el
 
 (autoload (quote calculator) "calculator" "\
@@ -2487,23 +2467,25 @@
 
 ;;;***
 
-;;;### (autoloads (calendar solar-holidays islamic-holidays christian-holidays
-;;;;;;  hebrew-holidays other-holidays local-holidays oriental-holidays
-;;;;;;  general-holidays holidays-in-diary-buffer diary-list-include-blanks
-;;;;;;  nongregorian-diary-marking-hook mark-diary-entries-hook nongregorian-diary-listing-hook
-;;;;;;  diary-display-hook diary-hook list-diary-entries-hook print-diary-entries-hook
+;;;### (autoloads (calendar calendar-setup solar-holidays bahai-holidays
+;;;;;;  islamic-holidays christian-holidays hebrew-holidays other-holidays
+;;;;;;  local-holidays oriental-holidays general-holidays holidays-in-diary-buffer
+;;;;;;  diary-list-include-blanks nongregorian-diary-marking-hook
+;;;;;;  mark-diary-entries-hook nongregorian-diary-listing-hook diary-display-hook
+;;;;;;  diary-hook list-diary-entries-hook print-diary-entries-hook
 ;;;;;;  american-calendar-display-form european-calendar-display-form
 ;;;;;;  european-date-diary-pattern american-date-diary-pattern european-calendar-style
 ;;;;;;  abbreviated-calendar-year sexp-diary-entry-symbol diary-include-string
-;;;;;;  islamic-diary-entry-symbol hebrew-diary-entry-symbol diary-nonmarking-symbol
-;;;;;;  diary-file calendar-move-hook today-invisible-calendar-hook
+;;;;;;  bahai-diary-entry-symbol islamic-diary-entry-symbol hebrew-diary-entry-symbol
+;;;;;;  diary-nonmarking-symbol diary-file calendar-move-hook today-invisible-calendar-hook
 ;;;;;;  today-visible-calendar-hook initial-calendar-window-hook
-;;;;;;  calendar-load-hook all-islamic-calendar-holidays all-christian-calendar-holidays
-;;;;;;  all-hebrew-calendar-holidays mark-holidays-in-calendar view-calendar-holidays-initially
+;;;;;;  calendar-load-hook all-bahai-calendar-holidays all-islamic-calendar-holidays
+;;;;;;  all-christian-calendar-holidays all-hebrew-calendar-holidays
+;;;;;;  mark-holidays-in-calendar view-calendar-holidays-initially
 ;;;;;;  calendar-remove-frame-by-deleting mark-diary-entries-in-calendar
 ;;;;;;  number-of-diary-entries view-diary-entries-initially calendar-offset
 ;;;;;;  calendar-week-start-day) "calendar" "calendar/calendar.el"
-;;;;;;  (16252 34047))
+;;;;;;  (16738 29931))
 ;;; Generated autoloads from calendar/calendar.el
 
 (defvar calendar-week-start-day 0 "\
@@ -2521,10 +2503,11 @@
 (custom-autoload (quote calendar-offset) "calendar")
 
 (defvar view-diary-entries-initially nil "\
-*Non-nil means display current date's diary entries on entry.
+*Non-nil means display current date's diary entries on entry to calendar.
 The diary is displayed in another window when the calendar is first displayed,
 if the current date is visible.  The number of days of diary entries displayed
-is governed by the variable `number-of-diary-entries'.")
+is governed by the variable `number-of-diary-entries'.  This variable can
+be overridden by the value of `calendar-setup'.")
 
 (custom-autoload (quote view-diary-entries-initially) "calendar")
 
@@ -2599,6 +2582,15 @@
 
 (custom-autoload (quote all-islamic-calendar-holidays) "calendar")
 
+(defvar all-bahai-calendar-holidays nil "\
+*If nil, show only major holidays from the Baha'i calendar.
+These are the days on which work and school must be suspended.
+
+If t, show all the holidays that would appear in a complete Baha'i
+calendar.")
+
+(custom-autoload (quote all-bahai-calendar-holidays) "calendar")
+
 (defvar calendar-load-hook nil "\
 *List of functions to be called after the calendar is first loaded.
 This is the place to add key bindings to `calendar-mode-map'.")
@@ -2740,21 +2732,23 @@
 
       %%(diary-block 11 1 1990 11 10 1990) Vacation
 
-causes the diary entry \"Vacation\" to appear from November 1 through November
-10, 1990.  Other functions available are `diary-float', `diary-anniversary',
-`diary-cyclic', `diary-day-of-year', `diary-iso-date', `diary-french-date',
-`diary-hebrew-date', `diary-islamic-date', `diary-mayan-date',
+causes the diary entry \"Vacation\" to appear from November 1 through
+November 10, 1990.  Other functions available are `diary-float',
+`diary-anniversary', `diary-cyclic', `diary-day-of-year',
+`diary-iso-date', `diary-french-date', `diary-hebrew-date',
+`diary-islamic-date', `diary-bahai-date', `diary-mayan-date',
 `diary-chinese-date', `diary-coptic-date', `diary-ethiopic-date',
 `diary-persian-date', `diary-yahrzeit', `diary-sunrise-sunset',
-`diary-phases-of-moon', `diary-parasha', `diary-omer', `diary-rosh-hodesh',
-and `diary-sabbath-candles'.  See the documentation for the function
-`list-sexp-diary-entries' for more details.
-
-Diary entries based on the Hebrew and/or the Islamic calendar are also
-possible, but because these are somewhat slow, they are ignored
-unless you set the `nongregorian-diary-listing-hook' and the
-`nongregorian-diary-marking-hook' appropriately.  See the documentation
-for these functions for details.
+`diary-phases-of-moon', `diary-parasha', `diary-omer',
+`diary-rosh-hodesh', and `diary-sabbath-candles'.  See the
+documentation for the function `list-sexp-diary-entries' for more
+details.
+
+Diary entries based on the Hebrew, the Islamic and/or the Baha'i
+calendar are also possible, but because these are somewhat slow, they
+are ignored unless you set the `nongregorian-diary-listing-hook' and
+the `nongregorian-diary-marking-hook' appropriately.  See the
+documentation for these functions for details.
 
 Diary files can contain directives to include the contents of other files; for
 details, see the documentation for the variable `list-diary-entries-hook'.")
@@ -2776,6 +2770,11 @@
 
 (custom-autoload (quote islamic-diary-entry-symbol) "calendar")
 
+(defvar bahai-diary-entry-symbol "B" "\
+*Symbol indicating a diary entry according to the Baha'i calendar.")
+
+(custom-autoload (quote bahai-diary-entry-symbol) "calendar")
+
 (defvar diary-include-string "#include" "\
 *The string indicating inclusion of another file of diary entries.
 See the documentation for the function `include-other-diary-files'.")
@@ -2790,8 +2789,9 @@
 
 (defvar abbreviated-calendar-year t "\
 *Interpret a two-digit year DD in a diary entry as either 19DD or 20DD.
-For the Gregorian calendar; similarly for the Hebrew and Islamic calendars.
-If this variable is nil, years must be written in full.")
+For the Gregorian calendar; similarly for the Hebrew, Islamic and
+Baha'i calendars.  If this variable is nil, years must be written in
+full.")
 
 (custom-autoload (quote abbreviated-calendar-year) "calendar")
 
@@ -2809,7 +2809,10 @@
 
 Names can be capitalized or not, written in full (as specified by the
 variable `calendar-day-name-array'), or abbreviated (as specified by
-`calendar-day-abbrev-array') with or without a period.")
+`calendar-day-abbrev-array') with or without a period.  To take effect,
+this variable should be set before the calendar package and its associates
+are loaded.  Otherwise, use one of the functions `european-calendar' or
+`american-calendar' to force the appropriate update.")
 
 (custom-autoload (quote european-calendar-style) "calendar")
 
@@ -2907,9 +2910,10 @@
 
 (defvar nongregorian-diary-listing-hook nil "\
 *List of functions called for listing diary file and included files.
-As the files are processed for diary entries, these functions are used to cull
-relevant entries.  You can use either or both of `list-hebrew-diary-entries'
-and `list-islamic-diary-entries'.  The documentation for these functions
+As the files are processed for diary entries, these functions are used
+to cull relevant entries.  You can use either or both of
+`list-hebrew-diary-entries', `list-islamic-diary-entries' and
+`list-bahai-diary-entries'.  The documentation for these functions
 describes the style of such diary entries.")
 
 (custom-autoload (quote nongregorian-diary-listing-hook) "calendar")
@@ -2932,9 +2936,10 @@
 
 (defvar nongregorian-diary-marking-hook nil "\
 *List of functions called for marking diary file and included files.
-As the files are processed for diary entries, these functions are used to cull
-relevant entries.  You can use either or both of `mark-hebrew-diary-entries'
-and `mark-islamic-diary-entries'.  The documentation for these functions
+As the files are processed for diary entries, these functions are used
+to cull relevant entries.  You can use either or both of
+`mark-hebrew-diary-entries', `mark-islamic-diary-entries' and
+`mark-bahai-diary-entries'.  The documentation for these functions
 describes the style of such diary entries.")
 
 (custom-autoload (quote nongregorian-diary-marking-hook) "calendar")
@@ -3012,7 +3017,7 @@
 
 (put (quote christian-holidays) (quote risky-local-variable) t)
 
-(defvar christian-holidays (quote ((if all-christian-calendar-holidays (holiday-fixed 1 6 "Epiphany")) (holiday-easter-etc) (if all-christian-calendar-holidays (holiday-greek-orthodox-easter)) (if all-christian-calendar-holidays (holiday-fixed 8 15 "Assumption")) (if all-christian-calendar-holidays (holiday-advent)) (holiday-fixed 12 25 "Christmas") (if all-christian-calendar-holidays (holiday-julian 12 25 "Eastern Orthodox Christmas")))) "\
+(defvar christian-holidays (quote ((if all-christian-calendar-holidays (holiday-fixed 1 6 "Epiphany")) (holiday-easter-etc 0 "Easter Sunday") (holiday-easter-etc -2 "Good Friday") (holiday-easter-etc -46 "Ash Wednesday") (if all-christian-calendar-holidays (holiday-easter-etc -63 "Septuagesima Sunday")) (if all-christian-calendar-holidays (holiday-easter-etc -56 "Sexagesima Sunday")) (if all-christian-calendar-holidays (holiday-easter-etc -49 "Shrove Sunday")) (if all-christian-calendar-holidays (holiday-easter-etc -48 "Shrove Monday")) (if all-christian-calendar-holidays (holiday-easter-etc -47 "Shrove Tuesday")) (if all-christian-calendar-holidays (holiday-easter-etc -14 "Passion Sunday")) (if all-christian-calendar-holidays (holiday-easter-etc -7 "Palm Sunday")) (if all-christian-calendar-holidays (holiday-easter-etc -3 "Maundy Thursday")) (if all-christian-calendar-holidays (holiday-easter-etc 35 "Rogation Sunday")) (if all-christian-calendar-holidays (holiday-easter-etc 39 "Ascension Day")) (if all-christian-calendar-holidays (holiday-easter-etc 49 "Pentecost (Whitsunday)")) (if all-christian-calendar-holidays (holiday-easter-etc 50 "Whitmonday")) (if all-christian-calendar-holidays (holiday-easter-etc 56 "Trinity Sunday")) (if all-christian-calendar-holidays (holiday-easter-etc 60 "Corpus Christi")) (if all-christian-calendar-holidays (holiday-greek-orthodox-easter)) (if all-christian-calendar-holidays (holiday-fixed 8 15 "Assumption")) (if all-christian-calendar-holidays (holiday-advent 0 "Advent")) (holiday-fixed 12 25 "Christmas") (if all-christian-calendar-holidays (holiday-julian 12 25 "Eastern Orthodox Christmas")))) "\
 *Christian holidays.
 See the documentation for `calendar-holidays' for details.")
 
@@ -3026,6 +3031,14 @@
 
 (custom-autoload (quote islamic-holidays) "calendar")
 
+(put (quote bahai-holidays) (quote risky-local-variable) t)
+
+(defvar bahai-holidays (quote ((holiday-fixed 3 21 (format "Baha'i New Year (Naw-Ruz) %d" (- displayed-year (1- 1844)))) (holiday-fixed 4 21 "First Day of Ridvan") (if all-bahai-calendar-holidays (holiday-fixed 4 22 "Second Day of Ridvan")) (if all-bahai-calendar-holidays (holiday-fixed 4 23 "Third Day of Ridvan")) (if all-bahai-calendar-holidays (holiday-fixed 4 24 "Fourth Day of Ridvan")) (if all-bahai-calendar-holidays (holiday-fixed 4 25 "Fifth Day of Ridvan")) (if all-bahai-calendar-holidays (holiday-fixed 4 26 "Sixth Day of Ridvan")) (if all-bahai-calendar-holidays (holiday-fixed 4 27 "Seventh Day of Ridvan")) (if all-bahai-calendar-holidays (holiday-fixed 4 28 "Eighth Day of Ridvan")) (holiday-fixed 4 29 "Ninth Day of Ridvan") (if all-bahai-calendar-holidays (holiday-fixed 4 30 "Tenth Day of Ridvan")) (if all-bahai-calendar-holidays (holiday-fixed 5 1 "Eleventh Day of Ridvan")) (holiday-fixed 5 2 "Twelfth Day of Ridvan") (holiday-fixed 5 23 "Declaration of the Bab") (holiday-fixed 5 29 "Ascension of Baha'u'llah") (holiday-fixed 7 9 "Martyrdom of the Bab") (holiday-fixed 10 20 "Birth of the Bab") (holiday-fixed 11 12 "Birth of Baha'u'llah") (if all-bahai-calendar-holidays (holiday-fixed 11 26 "Day of the Covenant")) (if all-bahai-calendar-holidays (holiday-fixed 11 28 "Ascension of `Abdu'l-Baha")))) "\
+*Baha'i holidays.
+See the documentation for `calendar-holidays' for details.")
+
+(custom-autoload (quote bahai-holidays) "calendar")
+
 (put (quote solar-holidays) (quote risky-local-variable) t)
 
 (defvar solar-holidays (quote ((if (fboundp (quote atan)) (solar-equinoxes-solstices)) (if (progn (require (quote cal-dst)) t) (funcall (quote holiday-sexp) calendar-daylight-savings-starts (quote (format "Daylight Savings Time Begins %s" (if (fboundp (quote atan)) (solar-time-string (/ calendar-daylight-savings-starts-time (float 60)) calendar-standard-time-zone-name) ""))))) (funcall (quote holiday-sexp) calendar-daylight-savings-ends (quote (format "Daylight Savings Time Ends %s" (if (fboundp (quote atan)) (solar-time-string (/ calendar-daylight-savings-ends-time (float 60)) calendar-daylight-time-zone-name) "")))))) "\
@@ -3037,11 +3050,14 @@
 (put (quote calendar-holidays) (quote risky-local-variable) t)
 
 (defvar calendar-setup nil "\
-The frame set up of the calendar.
-The choices are `one-frame' (calendar and diary together in one separate,
-dedicated frame), `two-frames' (calendar and diary in separate, dedicated
-frames), `calendar-only' (calendar in a separate, dedicated frame); with
-any other value the current frame is used.")
+The frame setup of the calendar.
+The choices are: `one-frame' (calendar and diary together in one separate,
+dedicated frame); `two-frames' (calendar and diary in separate, dedicated
+frames); `calendar-only' (calendar in a separate, dedicated frame); with
+any other value the current frame is used.  Using any of the first 
+three options overrides the value of `view-diary-entries-initially'.")
+
+(custom-autoload (quote calendar-setup) "calendar")
 
 (autoload (quote calendar) "calendar" "\
 Choose between the one frame, two frame, or basic calendar displays.
@@ -3054,9 +3070,27 @@
 
 ;;;***
 
+;;;### (autoloads (canlock-verify canlock-insert-header) "canlock"
+;;;;;;  "gnus/canlock.el" (16697 49031))
+;;; Generated autoloads from gnus/canlock.el
+
+(autoload (quote canlock-insert-header) "canlock" "\
+Insert a Cancel-Key and/or a Cancel-Lock header if possible.
+
+\(fn &optional ID-FOR-KEY ID-FOR-LOCK PASSWORD)" nil nil)
+
+(autoload (quote canlock-verify) "canlock" "\
+Verify Cancel-Lock or Cancel-Key in BUFFER.
+If BUFFER is nil, the current buffer is assumed.  Signal an error if
+it fails.
+
+\(fn &optional BUFFER)" t nil)
+
+;;;***
+
 ;;;### (autoloads (pike-mode idl-mode java-mode objc-mode c++-mode
 ;;;;;;  c-mode c-initialize-cc-mode) "cc-mode" "progmodes/cc-mode.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16816 23740))
 ;;; Generated autoloads from progmodes/cc-mode.el
 
 (autoload (quote c-initialize-cc-mode) "cc-mode" "\
@@ -3209,12 +3243,12 @@
  (add-to-list 'interpreter-mode-alist '("mawk" . awk-mode))
  (add-to-list 'interpreter-mode-alist '("nawk" . awk-mode))
  (add-to-list 'interpreter-mode-alist '("gawk" . awk-mode))
- (autoload 'awk-mode "cc-mode" "Major mode for editing AWK code.")
+ (autoload 'awk-mode "cc-mode" "Major mode for editing AWK code." t)
 
 ;;;***
 
 ;;;### (autoloads (c-set-offset c-add-style c-set-style) "cc-styles"
-;;;;;;  "progmodes/cc-styles.el" (16241 41611))
+;;;;;;  "progmodes/cc-styles.el" (16667 39430))
 ;;; Generated autoloads from progmodes/cc-styles.el
 
 (autoload (quote c-set-style) "cc-styles" "\
@@ -3271,7 +3305,7 @@
 
 ;;;### (autoloads (ccl-execute-with-args check-ccl-program define-ccl-program
 ;;;;;;  declare-ccl-program ccl-dump ccl-compile) "ccl" "international/ccl.el"
-;;;;;;  (16211 27032))
+;;;;;;  (16585 28856))
 ;;; Generated autoloads from international/ccl.el
 
 (autoload (quote ccl-compile) "ccl" "\
@@ -3528,7 +3562,7 @@
 ;;;***
 
 ;;;### (autoloads (cfengine-mode) "cfengine" "progmodes/cfengine.el"
-;;;;;;  (16278 45828))
+;;;;;;  (16534 3809))
 ;;; Generated autoloads from progmodes/cfengine.el
 
 (autoload (quote cfengine-mode) "cfengine" "\
@@ -3550,7 +3584,7 @@
 ;;;;;;  checkdoc-comments checkdoc-continue checkdoc-start checkdoc-current-buffer
 ;;;;;;  checkdoc-eval-current-buffer checkdoc-message-interactive
 ;;;;;;  checkdoc-interactive checkdoc) "checkdoc" "emacs-lisp/checkdoc.el"
-;;;;;;  (16211 27023))
+;;;;;;  (16709 44237))
 ;;; Generated autoloads from emacs-lisp/checkdoc.el
 
 (autoload (quote checkdoc) "checkdoc" "\
@@ -3723,7 +3757,7 @@
 With prefix ARG, turn Checkdoc minor mode on iff ARG is positive.
 
 In Checkdoc minor mode, the usual bindings for `eval-defun' which is
-bound to \\<checkdoc-minor-mode-map> \\[checkdoc-eval-defun] and `checkdoc-eval-current-buffer' are overridden to include
+bound to \\<checkdoc-minor-mode-map>\\[checkdoc-eval-defun] and `checkdoc-eval-current-buffer' are overridden to include
 checking of documentation strings.
 
 \\{checkdoc-minor-mode-map}
@@ -3733,8 +3767,8 @@
 ;;;***
 
 ;;;### (autoloads (encode-hz-buffer encode-hz-region decode-hz-buffer
-;;;;;;  decode-hz-region) "china-util" "language/china-util.el" (16211
-;;;;;;  27033))
+;;;;;;  decode-hz-region) "china-util" "language/china-util.el" (16213
+;;;;;;  43280))
 ;;; Generated autoloads from language/china-util.el
 
 (autoload (quote decode-hz-region) "china-util" "\
@@ -3762,7 +3796,7 @@
 ;;;***
 
 ;;;### (autoloads (command-history list-command-history repeat-matching-complex-command)
-;;;;;;  "chistory" "chistory.el" (16211 27012))
+;;;;;;  "chistory" "chistory.el" (16213 43267))
 ;;; Generated autoloads from chistory.el
 
 (autoload (quote repeat-matching-complex-command) "chistory" "\
@@ -3801,7 +3835,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (16211 27024))
+;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (16764 51520))
 ;;; Generated autoloads from emacs-lisp/cl.el
 
 (defvar custom-print-functions nil "\
@@ -3817,7 +3851,7 @@
 ;;;***
 
 ;;;### (autoloads (common-lisp-indent-function) "cl-indent" "emacs-lisp/cl-indent.el"
-;;;;;;  (16211 27024))
+;;;;;;  (16680 26003))
 ;;; Generated autoloads from emacs-lisp/cl-indent.el
 
 (autoload (quote common-lisp-indent-function) "cl-indent" "\
@@ -3828,7 +3862,7 @@
 ;;;***
 
 ;;;### (autoloads (c-macro-expand) "cmacexp" "progmodes/cmacexp.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from progmodes/cmacexp.el
 
 (autoload (quote c-macro-expand) "cmacexp" "\
@@ -3847,8 +3881,8 @@
 
 ;;;***
 
-;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (16211
-;;;;;;  27012))
+;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (16718
+;;;;;;  40975))
 ;;; Generated autoloads from cmuscheme.el
 
 (autoload (quote run-scheme) "cmuscheme" "\
@@ -3865,7 +3899,7 @@
 ;;;***
 
 ;;;### (autoloads (cp-make-coding-system) "code-pages" "international/code-pages.el"
-;;;;;;  (16271 3438))
+;;;;;;  (16589 26258))
 ;;; Generated autoloads from international/code-pages.el
 
 (autoload (quote cp-make-coding-system) "code-pages" "\
@@ -3884,7 +3918,7 @@
 
 ;;;### (autoloads (codepage-setup cp-supported-codepages cp-offset-for-codepage
 ;;;;;;  cp-language-for-codepage cp-charset-for-codepage cp-make-coding-systems-for-codepage)
-;;;;;;  "codepage" "international/codepage.el" (16215 28546))
+;;;;;;  "codepage" "international/codepage.el" (16216 22162))
 ;;; Generated autoloads from international/codepage.el
 
 (autoload (quote cp-make-coding-systems-for-codepage) "codepage" "\
@@ -3943,11 +3977,11 @@
 ;;;### (autoloads (comint-redirect-results-list-from-process comint-redirect-results-list
 ;;;;;;  comint-redirect-send-command-to-process comint-redirect-send-command
 ;;;;;;  comint-run make-comint make-comint-in-buffer) "comint" "comint.el"
-;;;;;;  (16211 27012))
+;;;;;;  (16810 63790))
 ;;; Generated autoloads from comint.el
 
 (autoload (quote make-comint-in-buffer) "comint" "\
-Make a comint process NAME in BUFFER, running PROGRAM.
+Make a Comint process NAME in BUFFER, running PROGRAM.
 If BUFFER is nil, it defaults to NAME surrounded by `*'s.
 PROGRAM should be either a string denoting an executable program to create
 via `start-process', or a cons pair of the form (HOST . SERVICE) denoting a TCP
@@ -3960,20 +3994,20 @@
 \(fn NAME BUFFER PROGRAM &optional STARTFILE &rest SWITCHES)" nil nil)
 
 (autoload (quote make-comint) "comint" "\
-Make a comint process NAME in a buffer, running PROGRAM.
+Make a Comint process NAME in a buffer, running PROGRAM.
 The name of the buffer is made by surrounding NAME with `*'s.
 PROGRAM should be either a string denoting an executable program to create
 via `start-process', or a cons pair of the form (HOST . SERVICE) denoting a TCP
 connection to be opened via `open-network-stream'.  If there is already a
 running process in that buffer, it is not restarted.  Optional third arg
-STARTFILE is the name of a file to send the contents of to the process.
+STARTFILE is the name of a file to send the contents of the process to.
 
 If PROGRAM is a string, any more args are arguments to PROGRAM.
 
 \(fn NAME PROGRAM &optional STARTFILE &rest SWITCHES)" nil nil)
 
 (autoload (quote comint-run) "comint" "\
-Run PROGRAM in a comint buffer and switch to it.
+Run PROGRAM in a Comint buffer and switch to it.
 The buffer name is made by surrounding the file name of PROGRAM with `*'s.
 The file name is used to make a symbol name, such as `comint-sh-hook', and any
 hooks on this symbol are run in the buffer.
@@ -3983,7 +4017,7 @@
 
 (autoload (quote comint-redirect-send-command) "comint" "\
 Send COMMAND to process in current buffer, with output to OUTPUT-BUFFER.
-With prefix arg, echo output in process buffer.
+With prefix arg ECHO, echo output in process buffer.
 
 If NO-DISPLAY is non-nil, do not show the output buffer.
 
@@ -4013,8 +4047,8 @@
 
 ;;;***
 
-;;;### (autoloads (compare-windows) "compare-w" "compare-w.el" (16277
-;;;;;;  42321))
+;;;### (autoloads (compare-windows) "compare-w" "compare-w.el" (16810
+;;;;;;  63790))
 ;;; Generated autoloads from compare-w.el
 
 (autoload (quote compare-windows) "compare-w" "\
@@ -4047,10 +4081,10 @@
 
 ;;;***
 
-;;;### (autoloads (next-error compilation-minor-mode compilation-shell-minor-mode
-;;;;;;  compilation-mode grep-tree grep-find grep compile compilation-search-path
+;;;### (autoloads (compilation-next-error-function compilation-minor-mode
+;;;;;;  compilation-shell-minor-mode compilation-mode compile compilation-search-path
 ;;;;;;  compilation-ask-about-save compilation-window-height compilation-mode-hook)
-;;;;;;  "compile" "progmodes/compile.el" (16277 42320))
+;;;;;;  "compile" "progmodes/compile.el" (16805 44924))
 ;;; Generated autoloads from progmodes/compile.el
 
 (defvar compilation-mode-hook nil "\
@@ -4065,9 +4099,11 @@
 
 (defvar compilation-process-setup-function nil "\
 *Function to call to customize the compilation process.
-This functions is called immediately before the compilation process is
+This function is called immediately before the compilation process is
 started.  It can be used to set any variables or functions that are used
-while processing the output of the compilation process.")
+while processing the output of the compilation process.  The function
+is called with variables `compilation-buffer' and `compilation-window'
+bound to the compilation buffer and window, respectively.")
 
 (defvar compilation-buffer-name-function nil "\
 Function to compute the name of a compilation buffer.
@@ -4103,11 +4139,16 @@
 Runs COMMAND, a shell command, in a separate process asynchronously
 with output going to the buffer `*compilation*'.
 
+If optional second arg COMINT is t the buffer will be in Comint mode with
+`compilation-shell-minor-mode'.
+
 You can then use the command \\[next-error] to find the next error message
 and move to the source code that caused it.
 
 Interactively, prompts for the command if `compilation-read-command' is
 non-nil; otherwise uses `compile-command'.  With prefix arg, always prompts.
+Additionally, with universal prefix arg, compilation buffer will be in
+comint mode, i.e. interactive.
 
 To run more than one compilation at once, start one and rename
 the `*compilation*' buffer to some other name with
@@ -4119,54 +4160,7 @@
 the function in `compilation-buffer-name-function', so you can set that
 to a function that generates a unique name.
 
-\(fn COMMAND)" t nil)
-
-(autoload (quote grep) "compile" "\
-Run grep, with user-specified args, and collect output in a buffer.
-While grep runs asynchronously, you can use \\[next-error] (M-x next-error),
-or \\<compilation-minor-mode-map>\\[compile-goto-error] in the grep output buffer, to go to the lines
-where grep found matches.
-
-This command uses a special history list for its COMMAND-ARGS, so you can
-easily repeat a grep command.
-
-A prefix argument says to default the argument based upon the current
-tag the cursor is over, substituting it into the last grep command
-in the grep command history (or into `grep-command'
-if that history list is empty).
-
-\(fn COMMAND-ARGS)" t nil)
-
-(autoload (quote grep-find) "compile" "\
-Run grep via find, with user-specified args COMMAND-ARGS.
-Collect output in a buffer.
-While find runs asynchronously, you can use the \\[next-error] command
-to find the text that grep hits refer to.
-
-This command uses a special history list for its arguments, so you can
-easily repeat a find command.
-
-\(fn COMMAND-ARGS)" t nil)
-
-(autoload (quote grep-tree) "compile" "\
-Grep for REGEXP in FILES in directory tree rooted at DIR.
-Collect output in a buffer.
-Interactively, prompt separately for each search parameter.
-With prefix arg, reuse previous REGEXP.
-The search is limited to file names matching shell pattern FILES.
-FILES may use abbreviations defined in `grep-tree-files-aliases', e.g.
-entering `ch' is equivalent to `*.[ch]'.
-
-While find runs asynchronously, you can use the \\[next-error] command
-to find the text that grep hits refer to.
-
-This command uses a special history list for its arguments, so you can
-easily repeat a find command.
-
-When used non-interactively, optional arg SUBDIRS limits the search to
-those sub directories of DIR.
-
-\(fn REGEXP FILES DIR &optional SUBDIRS)" t nil)
+\(fn COMMAND &optional COMINT)" t nil)
 
 (autoload (quote compilation-mode) "compile" "\
 Major mode for compilation log buffers.
@@ -4176,6 +4170,8 @@
 
 Runs `compilation-mode-hook' with `run-hooks' (which see).
 
+\\{compilation-mode-map}
+
 \(fn &optional NAME-OF-MODE)" t nil)
 
 (autoload (quote compilation-shell-minor-mode) "compile" "\
@@ -4197,38 +4193,15 @@
 
 \(fn &optional ARG)" t nil)
 
-(autoload (quote next-error) "compile" "\
-Visit next compilation error message and corresponding source code.
-
-If all the error messages parsed so far have been processed already,
-the message buffer is checked for new ones.
-
-A prefix ARGP specifies how many error messages to move;
-negative means move back to previous error messages.
-Just \\[universal-argument] as a prefix means reparse the error message buffer
-and start at the first error.
-
-\\[next-error] normally uses the most recently started compilation or
-grep buffer.  However, it can operate on any buffer with output from
-the \\[compile] and \\[grep] commands, or, more generally, on any
-buffer in Compilation mode or with Compilation Minor mode enabled.  To
-specify use of a particular buffer for error messages, type
-\\[next-error] in that buffer.
-
-Once \\[next-error] has chosen the buffer for error messages,
-it stays with that buffer until you use it in some other buffer which
-uses Compilation mode or Compilation Minor mode.
-
-See variables `compilation-parse-errors-function' and
-`compilation-error-regexp-alist' for customization ideas.
-
-\(fn &optional ARGP)" t nil)
- (define-key ctl-x-map "`" 'next-error)
+(autoload (quote compilation-next-error-function) "compile" "\
+Not documented
+
+\(fn N &optional RESET)" t nil)
 
 ;;;***
 
 ;;;### (autoloads (partial-completion-mode) "complete" "complete.el"
-;;;;;;  (16276 26334))
+;;;;;;  (16377 12871))
 ;;; Generated autoloads from complete.el
 
 (defvar partial-completion-mode nil "\
@@ -4263,7 +4236,7 @@
 ;;;***
 
 ;;;### (autoloads (dynamic-completion-mode) "completion" "completion.el"
-;;;;;;  (16211 27013))
+;;;;;;  (16581 41633))
 ;;; Generated autoloads from completion.el
 
 (autoload (quote dynamic-completion-mode) "completion" "\
@@ -4275,8 +4248,8 @@
 
 ;;;### (autoloads (decompose-composite-char compose-last-chars compose-chars-after
 ;;;;;;  find-composition compose-chars decompose-string compose-string
-;;;;;;  decompose-region compose-region) "composite" "composite.el"
-;;;;;;  (16211 27013))
+;;;;;;  decompose-region compose-region encode-composition-rule)
+;;;;;;  "composite" "composite.el" (16702 49512))
 ;;; Generated autoloads from composite.el
 
 (defconst reference-point-alist (quote ((tl . 0) (tc . 1) (tr . 2) (Bl . 3) (Bc . 4) (Br . 5) (bl . 6) (bc . 7) (br . 8) (cl . 9) (cc . 10) (cr . 11) (top-left . 0) (top-center . 1) (top-right . 2) (base-left . 3) (base-center . 4) (base-right . 5) (bottom-left . 6) (bottom-center . 7) (bottom-right . 8) (center-left . 9) (center-center . 10) (center-right . 11) (ml . 3) (mc . 10) (mr . 5) (mid-left . 3) (mid-center . 10) (mid-right . 5))) "\
@@ -4318,6 +4291,13 @@
     +----+-----+ <--- new descent
 ")
 
+(autoload (quote encode-composition-rule) "composite" "\
+Encode composition rule RULE into an integer value.
+RULE is a cons of global and new reference point symbols
+\(see reference-point-alist).
+
+\(fn RULE)" nil nil)
+
 (autoload (quote compose-region) "composite" "\
 Compose characters in the current region.
 
@@ -4488,8 +4468,159 @@
 
 ;;;***
 
+;;;### (autoloads (conf-xdefaults-mode conf-ppd-mode conf-colon-mode
+;;;;;;  conf-space-mode conf-javaprop-mode conf-windows-mode conf-unix-mode
+;;;;;;  conf-mode) "conf-mode" "textmodes/conf-mode.el" (16813 38253))
+;;; Generated autoloads from textmodes/conf-mode.el
+
+(autoload (quote conf-mode) "conf-mode" "\
+Mode for Unix and Windows Conf files and Java properties.
+Most conf files know only three kinds of constructs: parameter
+assignments optionally grouped into sections and comments.  Yet
+there is a great range of variation in the exact syntax of conf
+files.  See below for various wrapper commands that set up the
+details for some of the most widespread variants.
+
+This mode sets up font locking, outline, imenu and it provides
+alignment support through `conf-align-assignments'.  If strings
+come out wrong, try `conf-quote-normal'.
+
+Some files allow continuation lines, either with a backslash at
+the end of line, or by indenting the next line (further).  These
+constructs cannot currently be recognized.
+
+Because of this great variety of nuances, which are often not
+even clearly specified, please don't expect it to get every file
+quite right.  Patches that clearly identify some special case,
+without breaking the general ones, are welcome.
+
+If instead you start this mode with the generic `conf-mode'
+command, it will parse the buffer.  It will generally well
+identify the first four cases listed below.  If the buffer
+doesn't have enough contents to decide, this is identical to
+`conf-windows-mode' on Windows, elsewhere to `conf-unix-mode'.
+See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
+`conf-ppd-mode' and `conf-xdefaults-mode'.
+
+\\{conf-mode-map}
+
+\(fn &optional COMMENT SYNTAX-TABLE NAME)" t nil)
+
+(autoload (quote conf-unix-mode) "conf-mode" "\
+Conf Mode starter for Unix style Conf files.
+Comments start with `#'.
+For details see `conf-mode'.  Example:
+
+# Conf mode font-locks this right on Unix and with C-c C-u
+
+\[Desktop Entry]
+	 Encoding=UTF-8
+	 Name=The GIMP
+	 Name[ca]=El GIMP
+	 Name[cs]=GIMP
+
+\(fn)" t nil)
+
+(autoload (quote conf-windows-mode) "conf-mode" "\
+Conf Mode starter for Windows style Conf files.
+Comments start with `;'.
+For details see `conf-mode'.  Example:
+
+; Conf mode font-locks this right on Windows and with C-c C-w
+
+\[ExtShellFolderViews]
+Default={5984FFE0-28D4-11CF-AE66-08002B2E1262}
+{5984FFE0-28D4-11CF-AE66-08002B2E1262}={5984FFE0-28D4-11CF-AE66-08002B2E1262}
+
+\[{5984FFE0-28D4-11CF-AE66-08002B2E1262}]
+PersistMoniker=file://Folder.htt
+
+\(fn)" t nil)
+
+(autoload (quote conf-javaprop-mode) "conf-mode" "\
+Conf Mode starter for Java properties files.
+Comments start with `#' but are also recognized with `//' or
+between `/*' and `*/'.
+For details see `conf-mode'.  Example:
+
+# Conf mode font-locks this right with C-c C-j (Java properties)
+// another kind of comment
+/* yet another */
+
+name:value
+name=value
+name value
+x.1 =
+x.2.y.1.z.1 =
+x.2.y.1.z.2.zz =
+
+\(fn)" t nil)
+
+(autoload (quote conf-space-mode) "conf-mode" "\
+Conf Mode starter for space separated conf files.
+\"Assignments\" are with ` '.  Keywords before the parameters are
+recognized according to `conf-space-keywords'.  Interactively
+with a prefix ARG of `0' no keywords will be recognized.  With
+any other prefix arg you will be prompted for a regexp to match
+the keywords.  Programmatically you can pass such a regexp as
+KEYWORDS, or any non-nil non-string for no keywords.
+
+For details see `conf-mode'.  Example:
+
+# Conf mode font-locks this right with C-c C-s (space separated)
+
+image/jpeg			jpeg jpg jpe
+image/png			png
+image/tiff			tiff tif
+
+# Or with keywords (from a recognized file name):
+class desktop
+# Standard multimedia devices
+add /dev/audio		desktop
+add /dev/mixer		desktop
+
+\(fn &optional KEYWORDS)" t nil)
+
+(autoload (quote conf-colon-mode) "conf-mode" "\
+Conf Mode starter for Colon files.
+\"Assignments\" are with `:'.
+For details see `conf-mode'.  Example:
+
+# Conf mode font-locks this right with C-c C-c (colon)
+
+<Multi_key> <exclam> <exclam>		: \"\\241\"	exclamdown
+<Multi_key> <c> <slash>			: \"\\242\"	cent
+
+\(fn &optional COMMENT SYNTAX-TABLE NAME)" t nil)
+
+(autoload (quote conf-ppd-mode) "conf-mode" "\
+Conf Mode starter for Adobe/CUPS PPD files.
+Comments start with `*%' and \"assignments\" are with `:'.
+For details see `conf-mode'.  Example:
+
+*% Conf mode font-locks this right with C-c C-p (PPD)
+
+*DefaultTransfer: Null
+*Transfer Null.Inverse: \"{ 1 exch sub }\"
+
+\(fn)" t nil)
+
+(autoload (quote conf-xdefaults-mode) "conf-mode" "\
+Conf Mode starter for Xdefaults files.
+Comments start with `!' and \"assignments\" are with `:'.
+For details see `conf-mode'.  Example:
+
+! Conf mode font-locks this right with C-c C-x (.Xdefaults)
+
+*background:			gray99
+*foreground:			black
+
+\(fn)" t nil)
+
+;;;***
+
 ;;;### (autoloads (shuffle-vector cookie-snarf cookie-insert cookie)
-;;;;;;  "cookie1" "play/cookie1.el" (16211 27038))
+;;;;;;  "cookie1" "play/cookie1.el" (16213 43281))
 ;;; Generated autoloads from play/cookie1.el
 
 (autoload (quote cookie) "cookie1" "\
@@ -4521,7 +4652,7 @@
 ;;;***
 
 ;;;### (autoloads (copyright copyright-update) "copyright" "emacs-lisp/copyright.el"
-;;;;;;  (16211 27024))
+;;;;;;  (16675 7397))
 ;;; Generated autoloads from emacs-lisp/copyright.el
 
 (autoload (quote copyright-update) "copyright" "\
@@ -4543,7 +4674,7 @@
 ;;;***
 
 ;;;### (autoloads (cperl-mode) "cperl-mode" "progmodes/cperl-mode.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16805 44924))
 ;;; Generated autoloads from progmodes/cperl-mode.el
 
 (autoload (quote cperl-mode) "cperl-mode" "\
@@ -4716,7 +4847,7 @@
 ;;;***
 
 ;;;### (autoloads (cpp-parse-edit cpp-highlight-buffer) "cpp" "progmodes/cpp.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from progmodes/cpp.el
 
 (autoload (quote cpp-highlight-buffer) "cpp" "\
@@ -4735,7 +4866,7 @@
 ;;;***
 
 ;;;### (autoloads (crisp-mode crisp-mode) "crisp" "emulation/crisp.el"
-;;;;;;  (16211 27026))
+;;;;;;  (16213 43273))
 ;;; Generated autoloads from emulation/crisp.el
 
 (defvar crisp-mode nil "\
@@ -4759,7 +4890,7 @@
 ;;;***
 
 ;;;### (autoloads (completing-read-multiple) "crm" "emacs-lisp/crm.el"
-;;;;;;  (16211 27024))
+;;;;;;  (16213 43272))
 ;;; Generated autoloads from emacs-lisp/crm.el
 
 (autoload (quote completing-read-multiple) "crm" "\
@@ -4794,8 +4925,8 @@
 
 ;;;***
 
-;;;### (autoloads (cua-mode) "cua-base" "emulation/cua-base.el" (16211
-;;;;;;  27026))
+;;;### (autoloads (cua-mode) "cua-base" "emulation/cua-base.el" (16775
+;;;;;;  26710))
 ;;; Generated autoloads from emulation/cua-base.el
 
 (defvar cua-mode nil "\
@@ -4833,7 +4964,7 @@
 ;;;;;;  customize-face customize-changed-options customize-option-other-window
 ;;;;;;  customize-option customize-group-other-window customize-group
 ;;;;;;  customize-mode customize customize-save-variable customize-set-variable
-;;;;;;  customize-set-value) "cus-edit" "cus-edit.el" (16211 27013))
+;;;;;;  customize-set-value) "cus-edit" "cus-edit.el" (16820 16328))
 ;;; Generated autoloads from cus-edit.el
  (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'")
 
@@ -4943,19 +5074,19 @@
 \(fn SINCE-VERSION)" t nil)
 
 (autoload (quote customize-face) "cus-edit" "\
-Customize SYMBOL, which should be a face name or nil.
-If SYMBOL is nil, customize all faces.
+Customize FACE, which should be a face name or nil.
+If FACE is nil, customize all faces.
 
 Interactively, when point is on text which has a face specified,
-suggest to customized that face, if it's customizable.
+suggest to customize that face, if it's customizable.
 
 \(fn &optional FACE)" t nil)
 
 (autoload (quote customize-face-other-window) "cus-edit" "\
-Show customization buffer for face SYMBOL in other window.
+Show customization buffer for face FACE in other window.
 
 Interactively, when point is on text which has a face specified,
-suggest to customized that face, if it's customizable.
+suggest to customize that face, if it's customizable.
 
 \(fn &optional FACE)" t nil)
 
@@ -5010,7 +5141,8 @@
 \(fn OPTIONS &optional NAME DESCRIPTION)" nil nil)
 
 (autoload (quote custom-buffer-create-other-window) "cus-edit" "\
-Create a buffer containing OPTIONS.
+Create a buffer containing OPTIONS, and display it in another window.
+The result includes selecting that window.
 Optional NAME is the name of the buffer.
 OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
 SYMBOL is a customization option, and WIDGET is a widget for editing
@@ -5026,8 +5158,11 @@
 (defvar custom-file nil "\
 File used for storing customization information.
 The default is nil, which means to use your init file
-as specified by `user-init-file'.  If you specify some other file,
-you need to explicitly load that file for the settings to take effect.
+as specified by `user-init-file'.  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 ...)'
@@ -5064,7 +5199,7 @@
 
 ;;;### (autoloads (custom-reset-faces custom-theme-reset-faces custom-theme-face-value
 ;;;;;;  custom-set-faces custom-declare-face) "cus-face" "cus-face.el"
-;;;;;;  (16211 27013))
+;;;;;;  (16589 26258))
 ;;; Generated autoloads from cus-face.el
 
 (autoload (quote custom-declare-face) "cus-face" "\
@@ -5122,7 +5257,7 @@
 ;;;***
 
 ;;;### (autoloads (customize-create-theme) "cus-theme" "cus-theme.el"
-;;;;;;  (16211 27013))
+;;;;;;  (16213 43267))
 ;;; Generated autoloads from cus-theme.el
 
 (autoload (quote customize-create-theme) "cus-theme" "\
@@ -5133,7 +5268,7 @@
 ;;;***
 
 ;;;### (autoloads (cvs-status-mode) "cvs-status" "cvs-status.el"
-;;;;;;  (16211 27013))
+;;;;;;  (16788 34908))
 ;;; Generated autoloads from cvs-status.el
 
 (autoload (quote cvs-status-mode) "cvs-status" "\
@@ -5144,7 +5279,7 @@
 ;;;***
 
 ;;;### (autoloads (global-cwarn-mode turn-on-cwarn-mode cwarn-mode)
-;;;;;;  "cwarn" "progmodes/cwarn.el" (16211 27039))
+;;;;;;  "cwarn" "progmodes/cwarn.el" (16213 43281))
 ;;; Generated autoloads from progmodes/cwarn.el
 
 (autoload (quote cwarn-mode) "cwarn" "\
@@ -5186,7 +5321,7 @@
 
 ;;;### (autoloads (standard-display-cyrillic-translit cyrillic-encode-alternativnyj-char
 ;;;;;;  cyrillic-encode-koi8-r-char) "cyril-util" "language/cyril-util.el"
-;;;;;;  (16211 27033))
+;;;;;;  (16213 43280))
 ;;; Generated autoloads from language/cyril-util.el
 
 (autoload (quote cyrillic-encode-koi8-r-char) "cyril-util" "\
@@ -5215,7 +5350,7 @@
 ;;;***
 
 ;;;### (autoloads (dabbrev-expand dabbrev-completion) "dabbrev" "dabbrev.el"
-;;;;;;  (16211 27013))
+;;;;;;  (16795 7139))
 ;;; Generated autoloads from dabbrev.el
  (define-key esc-map "/" 'dabbrev-expand)
  (define-key esc-map [?\C-/] 'dabbrev-completion)
@@ -5262,8 +5397,8 @@
 
 ;;;***
 
-;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (16211
-;;;;;;  27039))
+;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (16213
+;;;;;;  43281))
 ;;; Generated autoloads from progmodes/dcl-mode.el
 
 (autoload (quote dcl-mode) "dcl-mode" "\
@@ -5390,7 +5525,7 @@
 ;;;***
 
 ;;;### (autoloads (cancel-debug-on-entry debug-on-entry debug) "debug"
-;;;;;;  "emacs-lisp/debug.el" (16211 27025))
+;;;;;;  "emacs-lisp/debug.el" (16213 43273))
 ;;; Generated autoloads from emacs-lisp/debug.el
 
 (setq debugger (quote debug))
@@ -5425,7 +5560,7 @@
 ;;;***
 
 ;;;### (autoloads (decipher-mode decipher) "decipher" "play/decipher.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from play/decipher.el
 
 (autoload (quote decipher) "decipher" "\
@@ -5454,8 +5589,8 @@
 ;;;***
 
 ;;;### (autoloads (delimit-columns-rectangle delimit-columns-region
-;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (16211
-;;;;;;  27013))
+;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (16462
+;;;;;;  53446))
 ;;; Generated autoloads from delim-col.el
 
 (autoload (quote delimit-columns-customize) "delim-col" "\
@@ -5479,8 +5614,8 @@
 
 ;;;***
 
-;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (16211
-;;;;;;  27039))
+;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (16507
+;;;;;;  41097))
 ;;; Generated autoloads from progmodes/delphi.el
 
 (autoload (quote delphi-mode) "delphi" "\
@@ -5530,8 +5665,8 @@
 
 ;;;***
 
-;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (16211
-;;;;;;  27013))
+;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (16764
+;;;;;;  51517))
 ;;; Generated autoloads from delsel.el
 
 (defalias (quote pending-delete-mode) (quote delete-selection-mode))
@@ -5559,7 +5694,7 @@
 ;;;***
 
 ;;;### (autoloads (derived-mode-init-mode-variables define-derived-mode)
-;;;;;;  "derived" "emacs-lisp/derived.el" (16211 27025))
+;;;;;;  "derived" "emacs-lisp/derived.el" (16213 43273))
 ;;; Generated autoloads from emacs-lisp/derived.el
 
 (autoload (quote define-derived-mode) "derived" "\
@@ -5621,7 +5756,7 @@
 ;;;***
 
 ;;;### (autoloads (describe-char describe-text-properties) "descr-text"
-;;;;;;  "descr-text.el" (16302 39173))
+;;;;;;  "descr-text.el" (16801 58019))
 ;;; Generated autoloads from descr-text.el
 
 (autoload (quote describe-text-properties) "descr-text" "\
@@ -5646,7 +5781,7 @@
 
 ;;;### (autoloads (desktop-revert desktop-save-in-desktop-dir desktop-change-dir
 ;;;;;;  desktop-load-default desktop-read desktop-save-mode) "desktop"
-;;;;;;  "desktop.el" (16297 34365))
+;;;;;;  "desktop.el" (16808 48569))
 ;;; Generated autoloads from desktop.el
 
 (defvar desktop-save-mode nil "\
@@ -5665,6 +5800,21 @@
 
 \(fn &optional ARG)" t nil)
 
+(defvar desktop-save-buffer nil "\
+When non-nil, save buffer status in desktop file.
+This variable becomes buffer local when set.
+
+If the value is a function, it called by `desktop-save' with argument
+DESKTOP-DIRNAME to obtain auxiliary information to saved in the desktop
+file along with the state of the buffer for which it was called.
+
+When file names are returned, they should be formatted using the call
+\"(desktop-file-name FILE-NAME DESKTOP-DIRNAME)\".
+
+Later, when `desktop-read' calls a function in `desktop-buffer-mode-handlers'
+to restore the buffer, the auxiliary information is passed as the argument
+DESKTOP-BUFFER-MISC.")
+
 (autoload (quote desktop-read) "desktop" "\
 Read and process the desktop file in directory DIRNAME.
 Look for a desktop file in DIRNAME, or if DIRNAME is omitted, look in
@@ -5702,12 +5852,69 @@
 
 ;;;***
 
-;;;### (autoloads (devanagari-post-read-conversion) "devan-util"
-;;;;;;  "language/devan-util.el" (16232 544))
+;;;### (autoloads (gnus-article-outlook-deuglify-article gnus-outlook-deuglify-article
+;;;;;;  gnus-article-outlook-repair-attribution gnus-article-outlook-unwrap-lines
+;;;;;;  gnus-outlook-display-hook gnus-outlook-deuglify-unwrap-max
+;;;;;;  gnus-outlook-deuglify-unwrap-min) "deuglify" "gnus/deuglify.el"
+;;;;;;  (16775 26711))
+;;; Generated autoloads from gnus/deuglify.el
+
+(defvar gnus-outlook-deuglify-unwrap-min 45 "\
+Minimum length of the cited line above the (possibly) wrapped line.")
+
+(custom-autoload (quote gnus-outlook-deuglify-unwrap-min) "deuglify")
+
+(defvar gnus-outlook-deuglify-unwrap-max 95 "\
+Maximum length of the cited line after unwrapping.")
+
+(custom-autoload (quote gnus-outlook-deuglify-unwrap-max) "deuglify")
+
+(defvar gnus-outlook-display-hook nil "\
+A hook called after an deuglified article has been prepared.
+It is run after `gnus-article-prepare-hook'.")
+
+(custom-autoload (quote gnus-outlook-display-hook) "deuglify")
+
+(autoload (quote gnus-article-outlook-unwrap-lines) "deuglify" "\
+Unwrap lines that appear to be wrapped citation lines.
+You can control what lines will be unwrapped by frobbing
+`gnus-outlook-deuglify-unwrap-min' and `gnus-outlook-deuglify-unwrap-max',
+indicating the minimum and maximum length of an unwrapped citation line.  If
+NODISPLAY is non-nil, don't redisplay the article buffer.
+
+\(fn &optional NODISPLAY)" t nil)
+
+(autoload (quote gnus-article-outlook-repair-attribution) "deuglify" "\
+Repair a broken attribution line.
+If NODISPLAY is non-nil, don't redisplay the article buffer.
+
+\(fn &optional NODISPLAY)" t nil)
+
+(autoload (quote gnus-outlook-deuglify-article) "deuglify" "\
+Full deuglify of broken Outlook (Express) articles.
+Treat dumbquotes, unwrap lines, repair attribution and rearrange citation.  If
+NODISPLAY is non-nil, don't redisplay the article buffer.
+
+\(fn &optional NODISPLAY)" t nil)
+
+(autoload (quote gnus-article-outlook-deuglify-article) "deuglify" "\
+Deuglify broken Outlook (Express) articles and redisplay.
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (devanagari-post-read-conversion devanagari-compose-region)
+;;;;;;  "devan-util" "language/devan-util.el" (16585 28857))
 ;;; Generated autoloads from language/devan-util.el
 
 (defconst devanagari-consonant "[\x51ad5-\x51af9\x51b38-\x51b3f]")
 
+(autoload (quote devanagari-compose-region) "devan-util" "\
+Not documented
+
+\(fn FROM TO)" t nil)
+
 (autoload (quote devanagari-post-read-conversion) "devan-util" "\
 Not documented
 
@@ -5716,14 +5923,14 @@
 ;;;***
 
 ;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib"
-;;;;;;  "calendar/diary-lib.el" (16212 54636))
+;;;;;;  "calendar/diary-lib.el" (16785 59559))
 ;;; Generated autoloads from calendar/diary-lib.el
 
 (autoload (quote diary) "diary-lib" "\
 Generate the diary window for ARG days starting with the current date.
 If no argument is provided, the number of days of diary entries is governed
-by the variable `number-of-diary-entries'.  This function is suitable for
-execution in a `.emacs' file.
+by the variable `number-of-diary-entries'.  A value of ARG less than 1
+does nothing.  This function is suitable for execution in a `.emacs' file.
 
 \(fn &optional ARG)" t nil)
 
@@ -5762,11 +5969,11 @@
 ;;;***
 
 ;;;### (autoloads (diff-backup diff diff-command diff-switches) "diff"
-;;;;;;  "diff.el" (16277 42321))
+;;;;;;  "diff.el" (16534 3807))
 ;;; Generated autoloads from diff.el
 
 (defvar diff-switches "-c" "\
-*A string or list of strings specifying switches to be be passed to diff.")
+*A string or list of strings specifying switches to be passed to diff.")
 
 (custom-autoload (quote diff-switches) "diff")
 
@@ -5779,8 +5986,8 @@
 Find and display the differences between OLD and NEW files.
 Interactively the current buffer's file name is the default for NEW
 and a backup file for NEW is the default for OLD.
+If NO-ASYNC is non-nil, call diff synchronously.
 With prefix arg, prompt for diff switches.
-If NO-ASYNC is non-nil, call diff synchronously.
 
 \(fn OLD NEW &optional SWITCHES NO-ASYNC)" t nil)
 
@@ -5789,13 +5996,14 @@
 Uses the latest backup, if there are several numerical backups.
 If this file is a backup, diff it with its original.
 The backup file is the first file given to `diff'.
+With prefix arg, prompt for diff switches.
 
 \(fn FILE &optional SWITCHES)" t nil)
 
 ;;;***
 
 ;;;### (autoloads (diff-minor-mode diff-mode) "diff-mode" "diff-mode.el"
-;;;;;;  (16309 31935))
+;;;;;;  (16746 18215))
 ;;; Generated autoloads from diff-mode.el
 
 (autoload (quote diff-mode) "diff-mode" "\
@@ -5820,11 +6028,11 @@
 
 ;;;***
 
-;;;### (autoloads (dired-noselect dired-other-frame dired-other-window
-;;;;;;  dired dired-copy-preserve-time dired-dwim-target dired-keep-marker-symlink
-;;;;;;  dired-keep-marker-hardlink dired-keep-marker-copy dired-keep-marker-rename
-;;;;;;  dired-trivial-filenames dired-ls-F-marks-symlinks dired-listing-switches)
-;;;;;;  "dired" "dired.el" (16292 22310))
+;;;### (autoloads (dired-restore-desktop-buffer dired-noselect dired-other-frame
+;;;;;;  dired-other-window dired dired-copy-preserve-time dired-dwim-target
+;;;;;;  dired-keep-marker-symlink dired-keep-marker-hardlink dired-keep-marker-copy
+;;;;;;  dired-keep-marker-rename dired-trivial-filenames dired-ls-F-marks-symlinks
+;;;;;;  dired-listing-switches) "dired" "dired.el" (16804 23129))
 ;;; Generated autoloads from dired.el
 
 (defvar dired-listing-switches "-al" "\
@@ -5950,6 +6158,11 @@
 \(fn DIR-OR-LIST &optional SWITCHES)" nil nil)
  (put 'dired-find-alternate-file 'disabled t)
 
+(autoload (quote dired-restore-desktop-buffer) "dired" "\
+Restore a dired buffer specified in a desktop file.
+
+\(fn DESKTOP-BUFFER-FILE-NAME DESKTOP-BUFFER-NAME DESKTOP-BUFFER-MISC)" nil nil)
+
 ;;;***
 
 ;;;### (autoloads (dired-show-file-type dired-do-query-replace-regexp
@@ -5961,10 +6174,11 @@
 ;;;;;;  dired-do-hardlink dired-do-symlink dired-do-copy dired-create-directory
 ;;;;;;  dired-rename-file dired-copy-file dired-relist-file dired-remove-file
 ;;;;;;  dired-add-file dired-do-redisplay dired-do-load dired-do-byte-compile
-;;;;;;  dired-do-compress dired-compress-file dired-do-kill-lines
-;;;;;;  dired-do-shell-command dired-do-print dired-do-chown dired-do-chgrp
+;;;;;;  dired-do-compress dired-query dired-compress-file dired-do-kill-lines
+;;;;;;  dired-run-shell-command dired-do-shell-command dired-clean-directory
+;;;;;;  dired-do-print dired-do-touch dired-do-chown dired-do-chgrp
 ;;;;;;  dired-do-chmod dired-backup-diff dired-diff) "dired-aux"
-;;;;;;  "dired-aux.el" (16211 27013))
+;;;;;;  "dired-aux.el" (16804 23129))
 ;;; Generated autoloads from dired-aux.el
 
 (autoload (quote dired-diff) "dired-aux" "\
@@ -6002,6 +6216,12 @@
 
 \(fn &optional ARG)" t nil)
 
+(autoload (quote dired-do-touch) "dired-aux" "\
+Change the timestamp of the marked (or next ARG) files.
+This calls touch.
+
+\(fn &optional ARG)" t nil)
+
 (autoload (quote dired-do-print) "dired-aux" "\
 Print the marked (or next ARG) files.
 Uses the shell command coming from variables `lpr-command' and
@@ -6009,6 +6229,17 @@
 
 \(fn &optional ARG)" t nil)
 
+(autoload (quote dired-clean-directory) "dired-aux" "\
+Flag numerical backups for deletion.
+Spares `dired-kept-versions' latest versions, and `kept-old-versions' oldest.
+Positive prefix arg KEEP overrides `dired-kept-versions';
+Negative prefix arg KEEP overrides `kept-old-versions' with KEEP made positive.
+
+To clear the flags on these files, you can use \\[dired-flag-backup-files]
+with a prefix argument.
+
+\(fn KEEP)" t nil)
+
 (autoload (quote dired-do-shell-command) "dired-aux" "\
 Run a shell command COMMAND on the marked files.
 If no files are marked or a specific numeric prefix arg is given,
@@ -6045,12 +6276,22 @@
 
 \(fn COMMAND &optional ARG FILE-LIST)" t nil)
 
+(autoload (quote dired-run-shell-command) "dired-aux" "\
+Not documented
+
+\(fn COMMAND)" nil nil)
+
 (autoload (quote dired-do-kill-lines) "dired-aux" "\
 Kill all marked lines (not the files).
 With a prefix argument, kill that many lines starting with the current line.
-\(A negative argument kills lines before the current line.)
-To kill an entire subdirectory, go to its directory header line
-and use this command with a prefix argument (the value does not matter).
+\(A negative argument kills backward.)
+If you use this command with a prefix argument to kill the line
+for a file that is a directory, which you have inserted in the
+Dired buffer as a subdirectory, then it deletes that subdirectory
+from the buffer as well.
+To kill an entire subdirectory (without killing its line in the
+parent directory), go to its directory header line and use this
+command with a prefix argument (the value does not matter).
 
 \(fn &optional ARG FMT)" t nil)
 
@@ -6059,6 +6300,11 @@
 
 \(fn FILE)" nil nil)
 
+(autoload (quote dired-query) "dired-aux" "\
+Not documented
+
+\(fn QS-VAR QS-PROMPT &rest QS-ARGS)" nil nil)
+
 (autoload (quote dired-do-compress) "dired-aux" "\
 Compress or uncompress marked (or next ARG) files.
 
@@ -6079,6 +6325,14 @@
 If on a subdir line, redisplay that subdirectory.  In that case,
 a prefix arg lets you edit the `ls' switches used for the new listing.
 
+Dired remembers switches specified with a prefix arg, so that reverting
+the buffer will not reset them.  However, using `dired-undo' to re-insert
+or delete subdirectories can bypass this machinery.  Hence, you sometimes
+may have to reset some subdirectory switches after a `dired-undo'.
+You can reset all subdirectory switches to the default using
+\\<dired-mode-map>\\[dired-reset-subdir-switches].
+See Info node `(emacs-xtra)Subdir switches' for more details.
+
 \(fn &optional ARG TEST-FOR-SUBDIR)" t nil)
 
 (autoload (quote dired-add-file) "dired-aux" "\
@@ -6209,6 +6463,14 @@
   this subdirectory.
 This function takes some pains to conform to `ls -lR' output.
 
+Dired remembers switches specified with a prefix arg, so that reverting
+the buffer will not reset them.  However, using `dired-undo' to re-insert
+or delete subdirectories can bypass this machinery.  Hence, you sometimes
+may have to reset some subdirectory switches after a `dired-undo'.
+You can reset all subdirectory switches to the default using
+\\<dired-mode-map>\\[dired-reset-subdir-switches].
+See Info node `(emacs-xtra)Subdir switches' for more details.
+
 \(fn DIRNAME &optional SWITCHES NO-ERROR-IF-NOT-DIR-P)" t nil)
 
 (autoload (quote dired-insert-subdir) "dired-aux" "\
@@ -6296,7 +6558,7 @@
 
 ;;;***
 
-;;;### (autoloads (dired-jump) "dired-x" "dired-x.el" (16246 41969))
+;;;### (autoloads (dired-jump) "dired-x" "dired-x.el" (16589 26258))
 ;;; Generated autoloads from dired-x.el
 
 (autoload (quote dired-jump) "dired-x" "\
@@ -6310,7 +6572,7 @@
 
 ;;;***
 
-;;;### (autoloads (dirtrack) "dirtrack" "dirtrack.el" (16211 27015))
+;;;### (autoloads (dirtrack) "dirtrack" "dirtrack.el" (16213 43267))
 ;;; Generated autoloads from dirtrack.el
 
 (autoload (quote dirtrack) "dirtrack" "\
@@ -6329,8 +6591,8 @@
 
 ;;;***
 
-;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (16211
-;;;;;;  27025))
+;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (16519
+;;;;;;  44982))
 ;;; Generated autoloads from emacs-lisp/disass.el
 
 (autoload (quote disassemble) "disass" "\
@@ -6348,7 +6610,7 @@
 ;;;;;;  standard-display-graphic standard-display-g1 standard-display-ascii
 ;;;;;;  standard-display-default standard-display-8bit describe-current-display-table
 ;;;;;;  describe-display-table set-display-table-slot display-table-slot
-;;;;;;  make-display-table) "disp-table" "disp-table.el" (16286 45076))
+;;;;;;  make-display-table) "disp-table" "disp-table.el" (16814 63075))
 ;;; Generated autoloads from disp-table.el
 
 (autoload (quote make-display-table) "disp-table" "\
@@ -6449,7 +6711,7 @@
 ;;;***
 
 ;;;### (autoloads (dissociated-press) "dissociate" "play/dissociate.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from play/dissociate.el
 
 (autoload (quote dissociated-press) "dissociate" "\
@@ -6465,7 +6727,31 @@
 
 ;;;***
 
-;;;### (autoloads (doctor) "doctor" "play/doctor.el" (16211 27038))
+;;;### (autoloads (dns-mode-soa-increment-serial dns-mode) "dns-mode"
+;;;;;;  "textmodes/dns-mode.el" (16710 53610))
+;;; Generated autoloads from textmodes/dns-mode.el
+
+(autoload (quote dns-mode) "dns-mode" "\
+Major mode for viewing and editing DNS master files.
+This mode is inherited from text mode.  It add syntax
+highlighting, and some commands for handling DNS master files.
+Its keymap inherits from `text-mode' and it has the same
+variables for customizing indentation.  It has its own abbrev
+table and its own syntax table.
+
+Turning on DNS mode runs `dns-mode-hook'.
+
+\(fn)" t nil)
+
+(autoload (quote dns-mode-soa-increment-serial) "dns-mode" "\
+Locate SOA record and increment the serial field.
+
+\(fn)" t nil)
+(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode))
+
+;;;***
+
+;;;### (autoloads (doctor) "doctor" "play/doctor.el" (16213 43281))
 ;;; Generated autoloads from play/doctor.el
 
 (autoload (quote doctor) "doctor" "\
@@ -6476,7 +6762,7 @@
 ;;;***
 
 ;;;### (autoloads (double-mode double-mode) "double" "double.el"
-;;;;;;  (16211 27015))
+;;;;;;  (16213 43267))
 ;;; Generated autoloads from double.el
 
 (defvar double-mode nil "\
@@ -6497,7 +6783,7 @@
 
 ;;;***
 
-;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (16211 27038))
+;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (16213 43281))
 ;;; Generated autoloads from play/dunnet.el
 
 (autoload (quote dunnet) "dunnet" "\
@@ -6508,7 +6794,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-earcon-display) "earcon" "gnus/earcon.el"
-;;;;;;  (16211 27027))
+;;;;;;  (16698 21927))
 ;;; Generated autoloads from gnus/earcon.el
 
 (autoload (quote gnus-earcon-display) "earcon" "\
@@ -6520,7 +6806,7 @@
 
 ;;;### (autoloads (easy-mmode-defsyntax easy-mmode-defmap easy-mmode-define-keymap
 ;;;;;;  easy-mmode-define-global-mode define-minor-mode) "easy-mmode"
-;;;;;;  "emacs-lisp/easy-mmode.el" (16309 31935))
+;;;;;;  "emacs-lisp/easy-mmode.el" (16775 26710))
 ;;; Generated autoloads from emacs-lisp/easy-mmode.el
 
 (defalias (quote easy-mmode-define-minor-mode) (quote define-minor-mode))
@@ -6595,8 +6881,8 @@
 ;;;***
 
 ;;;### (autoloads (easy-menu-change easy-menu-create-menu easy-menu-do-define
-;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (16211
-;;;;;;  27026))
+;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (16787
+;;;;;;  16350))
 ;;; Generated autoloads from emacs-lisp/easymenu.el
 
 (put (quote easy-menu-define) (quote lisp-indent-function) (quote defun))
@@ -6613,8 +6899,8 @@
 
    :filter FUNCTION
 
-FUNCTION is a function with one argument, the menu.  It returns the actual
-menu displayed.
+FUNCTION is a function with one argument, the rest of menu items.
+It returns the remaining items of the displayed menu.
 
    :visible INCLUDE
 
@@ -6735,10 +7021,13 @@
 ;;;***
 
 ;;;### (autoloads (ebnf-pop-style ebnf-push-style ebnf-reset-style
-;;;;;;  ebnf-apply-style ebnf-merge-style ebnf-insert-style ebnf-setup
-;;;;;;  ebnf-syntax-region ebnf-syntax-buffer ebnf-eps-region ebnf-eps-buffer
-;;;;;;  ebnf-spool-region ebnf-spool-buffer ebnf-print-region ebnf-print-buffer
-;;;;;;  ebnf-customize) "ebnf2ps" "progmodes/ebnf2ps.el" (16211 27039))
+;;;;;;  ebnf-apply-style ebnf-merge-style ebnf-delete-style ebnf-insert-style
+;;;;;;  ebnf-setup ebnf-syntax-region ebnf-syntax-buffer ebnf-syntax-file
+;;;;;;  ebnf-syntax-directory ebnf-eps-region ebnf-eps-buffer ebnf-eps-file
+;;;;;;  ebnf-eps-directory ebnf-spool-region ebnf-spool-buffer ebnf-spool-file
+;;;;;;  ebnf-spool-directory ebnf-print-region ebnf-print-buffer
+;;;;;;  ebnf-print-file ebnf-print-directory ebnf-customize) "ebnf2ps"
+;;;;;;  "progmodes/ebnf2ps.el" (16801 58033))
 ;;; Generated autoloads from progmodes/ebnf2ps.el
 
 (autoload (quote ebnf-customize) "ebnf2ps" "\
@@ -6746,6 +7035,28 @@
 
 \(fn)" t nil)
 
+(autoload (quote ebnf-print-directory) "ebnf2ps" "\
+Generate and print a PostScript syntactic chart image of DIRECTORY.
+
+If DIRECTORY is nil, it's used `default-directory'.
+
+The files in DIRECTORY that matches `ebnf-file-suffix-regexp' (which see) are
+processed.
+
+See also `ebnf-print-buffer'.
+
+\(fn &optional DIRECTORY)" t nil)
+
+(autoload (quote ebnf-print-file) "ebnf2ps" "\
+Generate and print a PostScript syntactic chart image of the file FILE.
+
+If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't
+killed after process termination.
+
+See also `ebnf-print-buffer'.
+
+\(fn FILE &optional DO-NOT-KILL-BUFFER-WHEN-DONE)" t nil)
+
 (autoload (quote ebnf-print-buffer) "ebnf2ps" "\
 Generate and print a PostScript syntactic chart image of the buffer.
 
@@ -6766,6 +7077,28 @@
 
 \(fn FROM TO &optional FILENAME)" t nil)
 
+(autoload (quote ebnf-spool-directory) "ebnf2ps" "\
+Generate and spool a PostScript syntactic chart image of DIRECTORY.
+
+If DIRECTORY is nil, it's used `default-directory'.
+
+The files in DIRECTORY that matches `ebnf-file-suffix-regexp' (which see) are
+processed.
+
+See also `ebnf-spool-buffer'.
+
+\(fn &optional DIRECTORY)" t nil)
+
+(autoload (quote ebnf-spool-file) "ebnf2ps" "\
+Generate and spool a PostScript syntactic chart image of the file FILE.
+
+If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't
+killed after process termination.
+
+See also `ebnf-spool-buffer'.
+
+\(fn FILE &optional DO-NOT-KILL-BUFFER-WHEN-DONE)" t nil)
+
 (autoload (quote ebnf-spool-buffer) "ebnf2ps" "\
 Generate and spool a PostScript syntactic chart image of the buffer.
 Like `ebnf-print-buffer' except that the PostScript image is saved in a
@@ -6783,6 +7116,28 @@
 
 \(fn FROM TO)" t nil)
 
+(autoload (quote ebnf-eps-directory) "ebnf2ps" "\
+Generate EPS files from EBNF files in DIRECTORY.
+
+If DIRECTORY is nil, it's used `default-directory'.
+
+The files in DIRECTORY that matches `ebnf-file-suffix-regexp' (which see) are
+processed.
+
+See also `ebnf-eps-buffer'.
+
+\(fn &optional DIRECTORY)" t nil)
+
+(autoload (quote ebnf-eps-file) "ebnf2ps" "\
+Generate an EPS file from EBNF file FILE.
+
+If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't
+killed after EPS generation.
+
+See also `ebnf-eps-buffer'.
+
+\(fn FILE &optional DO-NOT-KILL-BUFFER-WHEN-DONE)" t nil)
+
 (autoload (quote ebnf-eps-buffer) "ebnf2ps" "\
 Generate a PostScript syntactic chart image of the buffer in a EPS file.
 
@@ -6825,6 +7180,28 @@
 
 (defalias (quote ebnf-despool) (quote ps-despool))
 
+(autoload (quote ebnf-syntax-directory) "ebnf2ps" "\
+Does a syntactic analysis of the files in DIRECTORY.
+
+If DIRECTORY is nil, it's used `default-directory'.
+
+The files in DIRECTORY that matches `ebnf-file-suffix-regexp' (which see) are
+processed.
+
+See also `ebnf-syntax-buffer'.
+
+\(fn &optional DIRECTORY)" t nil)
+
+(autoload (quote ebnf-syntax-file) "ebnf2ps" "\
+Does a syntactic analysis of the FILE.
+
+If optional arg DO-NOT-KILL-BUFFER-WHEN-DONE is non-nil, the buffer isn't
+killed after syntax checking.
+
+See also `ebnf-syntax-buffer'.
+
+\(fn FILE &optional DO-NOT-KILL-BUFFER-WHEN-DONE)" t nil)
+
 (autoload (quote ebnf-syntax-buffer) "ebnf2ps" "\
 Does a syntactic analysis of the current buffer.
 
@@ -6843,18 +7220,31 @@
 (autoload (quote ebnf-insert-style) "ebnf2ps" "\
 Insert a new style NAME with inheritance INHERITS and values VALUES.
 
+See `ebnf-style-database' documentation.
+
 \(fn NAME INHERITS &rest VALUES)" t nil)
 
+(autoload (quote ebnf-delete-style) "ebnf2ps" "\
+Delete style NAME.
+
+See `ebnf-style-database' documentation.
+
+\(fn NAME)" t nil)
+
 (autoload (quote ebnf-merge-style) "ebnf2ps" "\
 Merge values of style NAME with style VALUES.
 
+See `ebnf-style-database' documentation.
+
 \(fn NAME &rest VALUES)" t nil)
 
 (autoload (quote ebnf-apply-style) "ebnf2ps" "\
-Set STYLE to current style.
+Set STYLE as the current style.
 
 It returns the old style symbol.
 
+See `ebnf-style-database' documentation.
+
 \(fn STYLE)" t nil)
 
 (autoload (quote ebnf-reset-style) "ebnf2ps" "\
@@ -6862,20 +7252,26 @@
 
 It returns the old style symbol.
 
+See `ebnf-style-database' documentation.
+
 \(fn &optional STYLE)" t nil)
 
 (autoload (quote ebnf-push-style) "ebnf2ps" "\
-Push the current style and set STYLE to current style.
+Push the current style and set STYLE as the current style.
 
 It returns the old style symbol.
 
+See `ebnf-style-database' documentation.
+
 \(fn &optional STYLE)" t nil)
 
 (autoload (quote ebnf-pop-style) "ebnf2ps" "\
-Pop a style and set it to current style.
+Pop a style and set it as the current style.
 
 It returns the old style symbol.
 
+See `ebnf-style-database' documentation.
+
 \(fn)" t nil)
 
 ;;;***
@@ -6890,8 +7286,8 @@
 ;;;;;;  ebrowse-tags-find-declaration-other-window ebrowse-tags-find-definition
 ;;;;;;  ebrowse-tags-view-definition ebrowse-tags-find-declaration
 ;;;;;;  ebrowse-tags-view-declaration ebrowse-member-mode ebrowse-electric-choose-tree
-;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (16233
-;;;;;;  59013))
+;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (16234
+;;;;;;  50257))
 ;;; Generated autoloads from progmodes/ebrowse.el
 
 (autoload (quote ebrowse-tree-mode) "ebrowse" "\
@@ -7042,11 +7438,11 @@
 ;;;***
 
 ;;;### (autoloads (electric-buffer-list) "ebuff-menu" "ebuff-menu.el"
-;;;;;;  (16211 27015))
+;;;;;;  (16787 16350))
 ;;; Generated autoloads from ebuff-menu.el
 
 (autoload (quote electric-buffer-list) "ebuff-menu" "\
-Pops up a buffer describing the set of Emacs buffers.
+Pop up a buffer describing the set of Emacs buffers.
 Vaguely like ITS lunar select buffer; combining typeoutoid buffer
 listing with menuoid buffer selection.
 
@@ -7056,9 +7452,9 @@
 
 To exit and select a new buffer, type a space when the cursor is on
 the appropriate line of the buffer-list window.  Other commands are
-much like those of buffer-menu-mode.
-
-Calls value of `electric-buffer-menu-mode-hook' on entry if non-nil.
+much like those of `Buffer-menu-mode'.
+
+Run hooks in `electric-buffer-menu-mode-hook' on entry.
 
 \\{electric-buffer-menu-mode-map}
 
@@ -7067,7 +7463,7 @@
 ;;;***
 
 ;;;### (autoloads (Electric-command-history-redo-expression) "echistory"
-;;;;;;  "echistory.el" (16211 27015))
+;;;;;;  "echistory.el" (16213 43267))
 ;;; Generated autoloads from echistory.el
 
 (autoload (quote Electric-command-history-redo-expression) "echistory" "\
@@ -7079,7 +7475,7 @@
 ;;;***
 
 ;;;### (autoloads (edebug-eval-top-level-form def-edebug-spec edebug-all-forms
-;;;;;;  edebug-all-defs) "edebug" "emacs-lisp/edebug.el" (16277 42320))
+;;;;;;  edebug-all-defs) "edebug" "emacs-lisp/edebug.el" (16810 63791))
 ;;; Generated autoloads from emacs-lisp/edebug.el
 
 (defvar edebug-all-defs nil "\
@@ -7142,7 +7538,7 @@
 ;;;;;;  ediff-merge-directory-revisions ediff-merge-directories-with-ancestor
 ;;;;;;  ediff-merge-directories ediff-directories3 ediff-directory-revisions
 ;;;;;;  ediff-directories ediff-buffers3 ediff-buffers ediff-backup
-;;;;;;  ediff-files3 ediff-files) "ediff" "ediff.el" (16271 3439))
+;;;;;;  ediff-files3 ediff-files) "ediff" "ediff.el" (16580 11202))
 ;;; Generated autoloads from ediff.el
 
 (autoload (quote ediff-files) "ediff" "\
@@ -7378,7 +7774,7 @@
 ;;;***
 
 ;;;### (autoloads (ediff-customize) "ediff-help" "ediff-help.el"
-;;;;;;  (16211 27015))
+;;;;;;  (16213 43267))
 ;;; Generated autoloads from ediff-help.el
 
 (autoload (quote ediff-customize) "ediff-help" "\
@@ -7388,7 +7784,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "ediff-hook" "ediff-hook.el" (16211 27015))
+;;;### (autoloads nil "ediff-hook" "ediff-hook.el" (16213 43267))
 ;;; Generated autoloads from ediff-hook.el
 
 (defvar ediff-window-setup-function)
@@ -7401,7 +7797,7 @@
 ;;;***
 
 ;;;### (autoloads (ediff-show-registry) "ediff-mult" "ediff-mult.el"
-;;;;;;  (16271 3441))
+;;;;;;  (16626 19946))
 ;;; Generated autoloads from ediff-mult.el
 
 (autoload (quote ediff-show-registry) "ediff-mult" "\
@@ -7414,7 +7810,7 @@
 ;;;***
 
 ;;;### (autoloads (ediff-toggle-use-toolbar ediff-toggle-multiframe)
-;;;;;;  "ediff-util" "ediff-util.el" (16271 3439))
+;;;;;;  "ediff-util" "ediff-util.el" (16442 4953))
 ;;; Generated autoloads from ediff-util.el
 
 (autoload (quote ediff-toggle-multiframe) "ediff-util" "\
@@ -7435,7 +7831,7 @@
 
 ;;;### (autoloads (format-kbd-macro read-kbd-macro edit-named-kbd-macro
 ;;;;;;  edit-last-kbd-macro edit-kbd-macro) "edmacro" "edmacro.el"
-;;;;;;  (16211 27015))
+;;;;;;  (16733 11795))
 ;;; Generated autoloads from edmacro.el
 
 (defvar edmacro-eight-bits nil "\
@@ -7488,7 +7884,7 @@
 ;;;***
 
 ;;;### (autoloads (edt-emulation-on edt-set-scroll-margins) "edt"
-;;;;;;  "emulation/edt.el" (16211 27026))
+;;;;;;  "emulation/edt.el" (16213 43273))
 ;;; Generated autoloads from emulation/edt.el
 
 (autoload (quote edt-set-scroll-margins) "edt" "\
@@ -7506,7 +7902,7 @@
 ;;;***
 
 ;;;### (autoloads (electric-helpify with-electric-help) "ehelp" "ehelp.el"
-;;;;;;  (16211 27015))
+;;;;;;  (16775 26706))
 ;;; Generated autoloads from ehelp.el
 
 (autoload (quote with-electric-help) "ehelp" "\
@@ -7544,7 +7940,7 @@
 ;;;***
 
 ;;;### (autoloads (turn-on-eldoc-mode eldoc-mode eldoc-minor-mode-string)
-;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (16218 6703))
+;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (16507 41097))
 ;;; Generated autoloads from emacs-lisp/eldoc.el
 
 (defvar eldoc-minor-mode-string " ElDoc" "\
@@ -7576,8 +7972,8 @@
 
 ;;;***
 
-;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (16211
-;;;;;;  27015))
+;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (16768
+;;;;;;  48631))
 ;;; Generated autoloads from elide-head.el
 
 (autoload (quote elide-head) "elide-head" "\
@@ -7593,7 +7989,7 @@
 ;;;***
 
 ;;;### (autoloads (elint-initialize) "elint" "emacs-lisp/elint.el"
-;;;;;;  (16276 26334))
+;;;;;;  (16816 23731))
 ;;; Generated autoloads from emacs-lisp/elint.el
 
 (autoload (quote elint-initialize) "elint" "\
@@ -7604,8 +8000,8 @@
 ;;;***
 
 ;;;### (autoloads (elp-results elp-instrument-package elp-instrument-list
-;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (16211
-;;;;;;  27026))
+;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (16783
+;;;;;;  21522))
 ;;; Generated autoloads from emacs-lisp/elp.el
 
 (autoload (quote elp-instrument-function) "elp" "\
@@ -7639,7 +8035,7 @@
 ;;;***
 
 ;;;### (autoloads (report-emacs-bug) "emacsbug" "mail/emacsbug.el"
-;;;;;;  (16256 53161))
+;;;;;;  (16804 23129))
 ;;; Generated autoloads from mail/emacsbug.el
 
 (autoload (quote report-emacs-bug) "emacsbug" "\
@@ -7654,7 +8050,7 @@
 ;;;;;;  emerge-revisions emerge-files-with-ancestor-remote emerge-files-remote
 ;;;;;;  emerge-files-with-ancestor-command emerge-files-command emerge-buffers-with-ancestor
 ;;;;;;  emerge-buffers emerge-files-with-ancestor emerge-files) "emerge"
-;;;;;;  "emerge.el" (16211 27015))
+;;;;;;  "emerge.el" (16381 6707))
 ;;; Generated autoloads from emerge.el
 
 (defvar menu-bar-emerge-menu (make-sparse-keymap "Emerge"))
@@ -7732,7 +8128,7 @@
 ;;;***
 
 ;;;### (autoloads (encoded-kbd-mode) "encoded-kb" "international/encoded-kb.el"
-;;;;;;  (16211 27032))
+;;;;;;  (16657 61756))
 ;;; Generated autoloads from international/encoded-kb.el
 
 (defvar encoded-kbd-mode nil "\
@@ -7760,14 +8156,14 @@
 ;;;***
 
 ;;;### (autoloads (enriched-decode enriched-encode enriched-mode)
-;;;;;;  "enriched" "textmodes/enriched.el" (16211 27043))
+;;;;;;  "enriched" "textmodes/enriched.el" (16738 29931))
 ;;; Generated autoloads from textmodes/enriched.el
 
 (autoload (quote enriched-mode) "enriched" "\
 Minor mode for editing text/enriched files.
 These are files with embedded formatting information in the MIME standard
 text/enriched format.
-Turning the mode on runs `enriched-mode-hook'.
+Turning the mode on or off runs `enriched-mode-hook'.
 
 More information about Enriched mode is available in the file
 etc/enriched.doc in the Emacs distribution directory.
@@ -7790,8 +8186,8 @@
 
 ;;;***
 
-;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (16211
-;;;;;;  27027))
+;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (16777
+;;;;;;  65418))
 ;;; Generated autoloads from eshell/esh-mode.el
 
 (autoload (quote eshell-mode) "esh-mode" "\
@@ -7803,8 +8199,8 @@
 
 ;;;***
 
-;;;### (autoloads (eshell-test) "esh-test" "eshell/esh-test.el" (16211
-;;;;;;  27027))
+;;;### (autoloads (eshell-test) "esh-test" "eshell/esh-test.el" (16548
+;;;;;;  34615))
 ;;; Generated autoloads from eshell/esh-test.el
 
 (autoload (quote eshell-test) "esh-test" "\
@@ -7815,7 +8211,7 @@
 ;;;***
 
 ;;;### (autoloads (eshell-report-bug eshell-command-result eshell-command
-;;;;;;  eshell) "eshell" "eshell/eshell.el" (16211 27027))
+;;;;;;  eshell) "eshell" "eshell/eshell.el" (16484 6599))
 ;;; Generated autoloads from eshell/eshell.el
 
 (autoload (quote eshell) "eshell" "\
@@ -7860,8 +8256,8 @@
 ;;;;;;  find-tag find-tag-noselect tags-table-files visit-tags-table-buffer
 ;;;;;;  visit-tags-table find-tag-default-function find-tag-hook
 ;;;;;;  tags-add-tables tags-compression-info-list tags-table-list
-;;;;;;  tags-case-fold-search) "etags" "progmodes/etags.el" (16211
-;;;;;;  27039))
+;;;;;;  tags-case-fold-search) "etags" "progmodes/etags.el" (16746
+;;;;;;  18215))
 ;;; Generated autoloads from progmodes/etags.el
 
 (defvar tags-file-name nil "\
@@ -8158,7 +8554,7 @@
 ;;;;;;  ethio-fidel-to-sera-buffer ethio-fidel-to-sera-region ethio-sera-to-fidel-marker
 ;;;;;;  ethio-sera-to-fidel-mail ethio-sera-to-fidel-mail-or-marker
 ;;;;;;  ethio-sera-to-fidel-buffer ethio-sera-to-fidel-region setup-ethiopic-environment-internal)
-;;;;;;  "ethio-util" "language/ethio-util.el" (16211 27033))
+;;;;;;  "ethio-util" "language/ethio-util.el" (16498 35858))
 ;;; Generated autoloads from language/ethio-util.el
 
 (autoload (quote setup-ethiopic-environment-internal) "ethio-util" "\
@@ -8340,7 +8736,7 @@
 \(fn)" nil nil)
 
 (autoload (quote ethio-find-file) "ethio-util" "\
-Transcribe file content into Ethiopic dependig on filename suffix.
+Transcribe file content into Ethiopic depending on filename suffix.
 
 \(fn)" nil nil)
 
@@ -8353,7 +8749,7 @@
 
 ;;;### (autoloads (eudc-load-eudc eudc-query-form eudc-expand-inline
 ;;;;;;  eudc-get-phone eudc-get-email eudc-set-server) "eudc" "net/eudc.el"
-;;;;;;  (16211 27037))
+;;;;;;  (16775 26715))
 ;;; Generated autoloads from net/eudc.el
 
 (autoload (quote eudc-set-server) "eudc" "\
@@ -8365,13 +8761,15 @@
 
 (autoload (quote eudc-get-email) "eudc" "\
 Get the email field of NAME from the directory server.
-
-\(fn NAME)" t nil)
+If ERROR is non-nil, report an error if there is none.
+
+\(fn NAME &optional ERROR)" t nil)
 
 (autoload (quote eudc-get-phone) "eudc" "\
 Get the phone field of NAME from the directory server.
-
-\(fn NAME)" t nil)
+If ERROR is non-nil, report an error if there is none.
+
+\(fn NAME &optional ERROR)" t nil)
 
 (autoload (quote eudc-expand-inline) "eudc" "\
 Query the directory server, and expand the query string before point.
@@ -8407,7 +8805,7 @@
 
 ;;;### (autoloads (eudc-display-jpeg-as-button eudc-display-jpeg-inline
 ;;;;;;  eudc-display-sound eudc-display-mail eudc-display-url eudc-display-generic-binary)
-;;;;;;  "eudc-bob" "net/eudc-bob.el" (16211 27037))
+;;;;;;  "eudc-bob" "net/eudc-bob.el" (16213 43280))
 ;;; Generated autoloads from net/eudc-bob.el
 
 (autoload (quote eudc-display-generic-binary) "eudc-bob" "\
@@ -8443,7 +8841,7 @@
 ;;;***
 
 ;;;### (autoloads (eudc-try-bbdb-insert eudc-insert-record-at-point-into-bbdb)
-;;;;;;  "eudc-export" "net/eudc-export.el" (16211 27037))
+;;;;;;  "eudc-export" "net/eudc-export.el" (16213 43280))
 ;;; Generated autoloads from net/eudc-export.el
 
 (autoload (quote eudc-insert-record-at-point-into-bbdb) "eudc-export" "\
@@ -8460,7 +8858,7 @@
 ;;;***
 
 ;;;### (autoloads (eudc-edit-hotlist) "eudc-hotlist" "net/eudc-hotlist.el"
-;;;;;;  (16211 27037))
+;;;;;;  (16213 43280))
 ;;; Generated autoloads from net/eudc-hotlist.el
 
 (autoload (quote eudc-edit-hotlist) "eudc-hotlist" "\
@@ -8471,10 +8869,17 @@
 ;;;***
 
 ;;;### (autoloads (executable-make-buffer-file-executable-if-script-p
-;;;;;;  executable-self-display executable-set-magic executable-find)
-;;;;;;  "executable" "progmodes/executable.el" (16211 27039))
+;;;;;;  executable-self-display executable-set-magic executable-find
+;;;;;;  executable-command-find-posix-p) "executable" "progmodes/executable.el"
+;;;;;;  (16435 60138))
 ;;; Generated autoloads from progmodes/executable.el
 
+(autoload (quote executable-command-find-posix-p) "executable" "\
+Check if PROGRAM handles arguments Posix-style.
+If PROGRAM is non-nil, use that instead of \"find\".
+
+\(fn &optional PROGRAM)" nil nil)
+
 (autoload (quote executable-find) "executable" "\
 Search for COMMAND in `exec-path' and return the absolute file name.
 Return nil if COMMAND is not found anywhere in `exec-path'.
@@ -8506,7 +8911,7 @@
 ;;;***
 
 ;;;### (autoloads (expand-jump-to-next-slot expand-jump-to-previous-slot
-;;;;;;  expand-add-abbrevs) "expand" "expand.el" (16211 27015))
+;;;;;;  expand-add-abbrevs) "expand" "expand.el" (16213 43267))
 ;;; Generated autoloads from expand.el
 
 (autoload (quote expand-add-abbrevs) "expand" "\
@@ -8549,7 +8954,7 @@
 
 ;;;***
 
-;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (16211 27039))
+;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (16805 44924))
 ;;; Generated autoloads from progmodes/f90.el
 
 (autoload (quote f90-mode) "f90" "\
@@ -8618,7 +9023,7 @@
 ;;;;;;  facemenu-remove-all facemenu-remove-face-props facemenu-set-read-only
 ;;;;;;  facemenu-set-intangible facemenu-set-invisible facemenu-set-face-from-menu
 ;;;;;;  facemenu-set-background facemenu-set-foreground facemenu-set-face)
-;;;;;;  "facemenu" "facemenu.el" (16211 27015))
+;;;;;;  "facemenu" "facemenu.el" (16698 21925))
 ;;; Generated autoloads from facemenu.el
  (define-key global-map "\M-g" 'facemenu-keymap)
  (autoload 'facemenu-keymap "facemenu" "Keymap for face-changing commands." t 'keymap)
@@ -8777,7 +9182,7 @@
 ;;;***
 
 ;;;### (autoloads (turn-on-fast-lock fast-lock-mode) "fast-lock"
-;;;;;;  "fast-lock.el" (16211 27015))
+;;;;;;  "fast-lock.el" (16777 65418))
 ;;; Generated autoloads from fast-lock.el
 
 (autoload (quote fast-lock-mode) "fast-lock" "\
@@ -8818,7 +9223,7 @@
 
 ;;;### (autoloads (feedmail-queue-reminder feedmail-run-the-queue
 ;;;;;;  feedmail-run-the-queue-global-prompt feedmail-run-the-queue-no-prompts
-;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (16211 27033))
+;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (16213 43280))
 ;;; Generated autoloads from mail/feedmail.el
 
 (autoload (quote feedmail-send-it) "feedmail" "\
@@ -8872,7 +9277,7 @@
 ;;;***
 
 ;;;### (autoloads (ffap-bindings dired-at-point ffap-at-mouse ffap-menu
-;;;;;;  find-file-at-point ffap-next) "ffap" "ffap.el" (16252 34051))
+;;;;;;  find-file-at-point ffap-next) "ffap" "ffap.el" (16585 28850))
 ;;; Generated autoloads from ffap.el
 
 (autoload (quote ffap-next) "ffap" "\
@@ -8931,7 +9336,7 @@
 ;;;***
 
 ;;;### (autoloads (file-cache-minibuffer-complete) "filecache" "filecache.el"
-;;;;;;  (16211 27016))
+;;;;;;  (16435 26305))
 ;;; Generated autoloads from filecache.el
 
 (autoload (quote file-cache-minibuffer-complete) "filecache" "\
@@ -8950,7 +9355,8 @@
 ;;;***
 
 ;;;### (autoloads (find-grep-dired find-name-dired find-dired find-grep-options
-;;;;;;  find-ls-option) "find-dired" "find-dired.el" (16211 27016))
+;;;;;;  find-ls-subdir-switches find-ls-option) "find-dired" "find-dired.el"
+;;;;;;  (16580 11202))
 ;;; Generated autoloads from find-dired.el
 
 (defvar find-ls-option (if (eq system-type (quote berkeley-unix)) (quote ("-ls" . "-gilsb")) (quote ("-exec ls -ld {} \\;" . "-ld"))) "\
@@ -8961,6 +9367,14 @@
 
 (custom-autoload (quote find-ls-option) "find-dired")
 
+(defvar find-ls-subdir-switches "-al" "\
+`ls' switches for inserting subdirectories in `*Find*' buffers.
+This should contain the \"-l\" switch.
+Use the \"-F\" or \"-b\" switches if and only if you also use
+them for `find-ls-option'.")
+
+(custom-autoload (quote find-ls-subdir-switches) "find-dired")
+
 (defvar find-grep-options (if (or (eq system-type (quote berkeley-unix)) (string-match "solaris2" system-configuration) (string-match "irix" system-configuration)) "-s" "-q") "\
 *Option to grep to be as silent as possible.
 On Berkeley systems, this is `-s'; on Posix, and with GNU grep, `-q' does it.
@@ -9003,7 +9417,7 @@
 
 ;;;### (autoloads (ff-mouse-find-other-file-other-window ff-mouse-find-other-file
 ;;;;;;  ff-find-other-file ff-get-other-file) "find-file" "find-file.el"
-;;;;;;  (16247 2100))
+;;;;;;  (16767 25304))
 ;;; Generated autoloads from find-file.el
 
 (defvar ff-special-constructs (quote (("^#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]" lambda nil (setq fname (buffer-substring (match-beginning 2) (match-end 2)))))) "\
@@ -9094,7 +9508,7 @@
 ;;;;;;  find-variable-other-window find-variable find-variable-noselect
 ;;;;;;  find-function-other-frame find-function-other-window find-function
 ;;;;;;  find-function-noselect find-function-search-for-symbol find-library)
-;;;;;;  "find-func" "emacs-lisp/find-func.el" (16211 27026))
+;;;;;;  "find-func" "emacs-lisp/find-func.el" (16795 7139))
 ;;; Generated autoloads from emacs-lisp/find-func.el
 
 (autoload (quote find-library) "find-func" "\
@@ -9214,7 +9628,7 @@
 ;;;***
 
 ;;;### (autoloads (find-lisp-find-dired-filter find-lisp-find-dired-subdirectories
-;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (16211 27016))
+;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (16213 43268))
 ;;; Generated autoloads from find-lisp.el
 
 (autoload (quote find-lisp-find-dired) "find-lisp" "\
@@ -9235,7 +9649,7 @@
 ;;;***
 
 ;;;### (autoloads (finder-by-keyword finder-commentary finder-list-keywords)
-;;;;;;  "finder" "finder.el" (16235 4766))
+;;;;;;  "finder" "finder.el" (16488 3556))
 ;;; Generated autoloads from finder.el
 
 (autoload (quote finder-list-keywords) "finder" "\
@@ -9257,7 +9671,7 @@
 ;;;***
 
 ;;;### (autoloads (enable-flow-control-on enable-flow-control) "flow-ctrl"
-;;;;;;  "flow-ctrl.el" (16211 27016))
+;;;;;;  "flow-ctrl.el" (16213 43268))
 ;;; Generated autoloads from flow-ctrl.el
 
 (autoload (quote enable-flow-control) "flow-ctrl" "\
@@ -9278,9 +9692,43 @@
 
 ;;;***
 
+;;;### (autoloads (fill-flowed fill-flowed-encode) "flow-fill" "gnus/flow-fill.el"
+;;;;;;  (16727 56924))
+;;; Generated autoloads from gnus/flow-fill.el
+
+(autoload (quote fill-flowed-encode) "flow-fill" "\
+Not documented
+
+\(fn &optional BUFFER)" nil nil)
+
+(autoload (quote fill-flowed) "flow-fill" "\
+Not documented
+
+\(fn &optional BUFFER)" nil nil)
+
+;;;***
+
+;;;### (autoloads (flymake-mode-off flymake-mode-on) "flymake" "progmodes/flymake.el"
+;;;;;;  (16808 48570))
+;;; Generated autoloads from progmodes/flymake.el
+
+(unless (assq (quote flymake-mode) minor-mode-alist) (setq minor-mode-alist (cons (quote (flymake-mode flymake-mode-line)) minor-mode-alist)))
+
+(autoload (quote flymake-mode-on) "flymake" "\
+Turn flymake mode on.
+
+\(fn)" nil nil)
+
+(autoload (quote flymake-mode-off) "flymake" "\
+Turn flymake mode off.
+
+\(fn)" nil nil)
+
+;;;***
+
 ;;;### (autoloads (flyspell-buffer flyspell-region flyspell-mode-off
 ;;;;;;  flyspell-version flyspell-mode flyspell-prog-mode flyspell-mode-line-string)
-;;;;;;  "flyspell" "textmodes/flyspell.el" (16211 27043))
+;;;;;;  "flyspell" "textmodes/flyspell.el" (16795 7139))
 ;;; Generated autoloads from textmodes/flyspell.el
 
 (defvar flyspell-mode-line-string " Fly" "\
@@ -9300,7 +9748,7 @@
 
 (autoload (quote flyspell-mode) "flyspell" "\
 Minor mode performing on-the-fly spelling checking.
-Ispell is automatically spawned on background for each entered words.
+This spawns a single Ispell process and checks each word.
 The default flyspell behavior is to highlight incorrect words.
 With no argument, this command toggles Flyspell mode.
 With a prefix argument ARG, turn Flyspell minor mode on iff ARG is positive.
@@ -9354,7 +9802,7 @@
 
 ;;;### (autoloads (follow-delete-other-windows-and-split follow-mode
 ;;;;;;  turn-off-follow-mode turn-on-follow-mode) "follow" "follow.el"
-;;;;;;  (16211 27016))
+;;;;;;  (16534 3807))
 ;;; Generated autoloads from follow.el
 
 (autoload (quote turn-on-follow-mode) "follow" "\
@@ -9430,7 +9878,7 @@
 
 ;;;### (autoloads (font-lock-fontify-buffer font-lock-remove-keywords
 ;;;;;;  font-lock-add-keywords font-lock-mode-internal) "font-lock"
-;;;;;;  "font-lock.el" (16211 27016))
+;;;;;;  "font-lock.el" (16808 48569))
 ;;; Generated autoloads from font-lock.el
 
 (autoload (quote font-lock-mode-internal) "font-lock" "\
@@ -9486,8 +9934,8 @@
 
 ;;;***
 
-;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (16211
-;;;;;;  27033))
+;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (16635
+;;;;;;  35910))
 ;;; Generated autoloads from mail/footnote.el
 
 (autoload (quote footnote-mode) "footnote" "\
@@ -9508,7 +9956,7 @@
 ;;;***
 
 ;;;### (autoloads (forms-find-file-other-window forms-find-file forms-mode)
-;;;;;;  "forms" "forms.el" (16211 27016))
+;;;;;;  "forms" "forms.el" (16507 41097))
 ;;; Generated autoloads from forms.el
 
 (autoload (quote forms-mode) "forms" "\
@@ -9545,7 +9993,7 @@
 ;;;***
 
 ;;;### (autoloads (fortran-mode fortran-tab-mode-default) "fortran"
-;;;;;;  "progmodes/fortran.el" (16211 27039))
+;;;;;;  "progmodes/fortran.el" (16534 3809))
 ;;; Generated autoloads from progmodes/fortran.el
 
 (defvar fortran-tab-mode-default nil "\
@@ -9631,7 +10079,7 @@
 ;;;***
 
 ;;;### (autoloads (fortune fortune-to-signature fortune-compile fortune-from-region
-;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (16211 27038))
+;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (16775 26716))
 ;;; Generated autoloads from play/fortune.el
 
 (autoload (quote fortune-add-fortune) "fortune" "\
@@ -9680,8 +10128,8 @@
 
 ;;;***
 
-;;;### (autoloads (set-fringe-style fringe-mode fringe-mode) "fringe"
-;;;;;;  "fringe.el" (16271 3439))
+;;;### (autoloads (fringe-indicators set-fringe-style fringe-mode
+;;;;;;  fringe-mode) "fringe" "fringe.el" (16810 63790))
 ;;; Generated autoloads from fringe.el
 
 (defvar fringe-mode nil "\
@@ -9749,29 +10197,53 @@
 
 \(fn &optional MODE)" t nil)
 
-;;;***
-
-;;;### (autoloads (gdba) "gdb-ui" "gdb-ui.el" (16278 45828))
-;;; Generated autoloads from gdb-ui.el
+(defvar fringe-indicators nil "\
+Visually indicate buffer boundaries and scrolling.
+Setting this variable, changes `default-indicate-buffer-boundaries'.")
+
+(custom-autoload (quote fringe-indicators) "fringe")
+
+;;;***
+
+;;;### (autoloads (gdba) "gdb-ui" "progmodes/gdb-ui.el" (16808 48570))
+;;; Generated autoloads from progmodes/gdb-ui.el
 
 (autoload (quote gdba) "gdb-ui" "\
 Run gdb on program FILE in buffer *gud-FILE*.
 The directory containing FILE becomes the initial working directory
 and source-file directory for your debugger.
 
-If `gdb-many-windows' is nil (the default value) then gdb starts with
-just two windows : the GUD and the source buffer. If it is t the
-following layout will appear (keybindings given in relevant buffer) :
+If `gdb-many-windows' is nil (the default value) then gdb just
+pops up the GUD buffer unless `gdb-show-main' is t. In this case
+it starts with two windows: one displaying the GUD buffer and the
+other with the source file with the main routine of the inferior.
+
+If `gdb-many-windows' is t, regardless of the value of
+`gdb-show-main', the layout below will appear unless
+`gdb-use-inferior-io-buffer' is nil when the source buffer
+occupies the full width of the frame.  Keybindings are given in
+relevant buffer.
+
+Watch expressions appear in the speedbar/slowbar.
+
+The following commands help control operation :
+
+`gdb-many-windows'    - Toggle the number of windows gdb uses.
+`gdb-restore-windows' - To restore the window layout.
+
+See Info node `(emacs)GDB Graphical Interface' for a more
+detailed description of this mode.
+
 
 ---------------------------------------------------------------------
                                GDB Toolbar
 ---------------------------------------------------------------------
-GUD buffer (I/O of GDB)           | Locals buffer
+ GUD buffer (I/O of GDB)          | Locals buffer
                                   |
                                   |
                                   |
 ---------------------------------------------------------------------
-Source buffer                     | Input/Output (of debuggee) buffer
+ Source buffer                    | Input/Output (of inferior) buffer
                                   | (comint-mode)
                                   |
                                   |
@@ -9780,43 +10252,23 @@
                                   |
                                   |
 ---------------------------------------------------------------------
-Stack buffer                      | Breakpoints buffer
+ Stack buffer                     | Breakpoints buffer
  RET      gdb-frames-select       | SPC    gdb-toggle-breakpoint
                                   | RET    gdb-goto-breakpoint
                                   |   d    gdb-delete-breakpoint
 ---------------------------------------------------------------------
 
-All the buffers share the toolbar and source should always display in the same
-window e.g after typing g on a breakpoint in the breakpoints buffer. Breakpoint
-icons are displayed both by setting a break with gud-break and by typing break
-in the GUD buffer.
-
-This works best (depending on the size of your monitor) using most of the
-screen.
-
-Displayed expressions appear in separate frames. Arrays may be displayed
-as slices and visualised using the graph program from plotutils if installed.
-Pointers in structures may be followed in a tree-like fashion.
-
-The following interactive lisp functions help control operation :
-
-`gdb-many-windows'    - Toggle the number of windows gdb uses.
-`gdb-restore-windows' - To restore the window layout.
-
 \(fn COMMAND-LINE)" t nil)
 
 ;;;***
 
 ;;;### (autoloads (generic-mode define-generic-mode) "generic" "generic.el"
-;;;;;;  (16211 27016))
+;;;;;;  (16810 63790))
 ;;; Generated autoloads from generic.el
 
 (autoload (quote define-generic-mode) "generic" "\
 Create a new generic mode with NAME.
 
-Args: (NAME COMMENT-LIST KEYWORD-LIST FONT-LOCK-LIST AUTO-MODE-LIST
-            FUNCTION-LIST &optional DESCRIPTION)
-
 NAME should be a symbol; its string representation is used as the function
 name. If DESCRIPTION is provided, it is used as the docstring for the new
 function.
@@ -9826,13 +10278,14 @@
 or a one-character string, it is added to the mode's syntax table with
 `comment-start' syntax.  If the entry is a cons pair, the elements of the
 pair are considered to be `comment-start' and `comment-end' respectively.
+\(The latter should be nil if you want comments to end at end of line.)
 Note that Emacs has limitations regarding comment characters.
 
 KEYWORD-LIST is a list of keywords to highlight with `font-lock-keyword-face'.
 Each keyword should be a string.
 
 FONT-LOCK-LIST is a list of additional expressions to highlight. Each entry
-in the list should have the same form as an entry in `font-lock-defaults-alist'
+in the list should have the same form as an entry in `font-lock-keywords'.
 
 AUTO-MODE-LIST is a list of regular expressions to add to `auto-mode-alist'.
 These regexps are added to `auto-mode-alist' as soon as `define-generic-mode'
@@ -9857,7 +10310,7 @@
 ;;;***
 
 ;;;### (autoloads (glasses-mode) "glasses" "progmodes/glasses.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from progmodes/glasses.el
 
 (autoload (quote glasses-mode) "glasses" "\
@@ -9870,21 +10323,22 @@
 ;;;***
 
 ;;;### (autoloads (gnus gnus-other-frame gnus-slave gnus-no-server
-;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (16211 27028))
+;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (16775 26712))
 ;;; Generated autoloads from gnus/gnus.el
 
 (autoload (quote gnus-slave-no-server) "gnus" "\
-Read network news as a slave, without connecting to local server.
+Read network news as a slave, without connecting to the local server.
 
 \(fn &optional ARG)" t nil)
 
 (autoload (quote gnus-no-server) "gnus" "\
 Read network news.
-If ARG is a positive number, Gnus will use that as the
-startup level.	If ARG is nil, Gnus will be started at level 2.
-If ARG is non-nil and not a positive number, Gnus will
-prompt the user for the name of an NNTP server to use.
-As opposed to `gnus', this command will not connect to the local server.
+If ARG is a positive number, Gnus will use that as the startup
+level. If ARG is nil, Gnus will be started at level 2.  If ARG is
+non-nil and not a positive number, Gnus will prompt the user for the
+name of an NNTP server to use.
+As opposed to `gnus', this command will not connect to the local
+server.
 
 \(fn &optional ARG SLAVE)" t nil)
 
@@ -9895,22 +10349,32 @@
 
 (autoload (quote gnus-other-frame) "gnus" "\
 Pop up a frame to read news.
-
-\(fn &optional ARG)" t nil)
+This will call one of the Gnus commands which is specified by the user
+option `gnus-other-frame-function' (default `gnus') with the argument
+ARG if Gnus is not running, otherwise just pop up a Gnus frame.  The
+optional second argument DISPLAY should be a standard display string
+such as \"unix:0\" to specify where to pop up a frame.  If DISPLAY is
+omitted or the function `make-frame-on-display' is not available, the
+current display is used.
+
+\(fn &optional ARG DISPLAY)" t nil)
 
 (autoload (quote gnus) "gnus" "\
 Read network news.
 If ARG is non-nil and a positive number, Gnus will use that as the
-startup level.	If ARG is non-nil and not a positive number, Gnus will
+startup level.  If ARG is non-nil and not a positive number, Gnus will
 prompt the user for the name of an NNTP server to use.
 
 \(fn &optional ARG DONT-CONNECT SLAVE)" t nil)
 
 ;;;***
 
-;;;### (autoloads (gnus-agent-batch gnus-agent-batch-fetch gnus-agentize
-;;;;;;  gnus-plugged gnus-unplugged) "gnus-agent" "gnus/gnus-agent.el"
-;;;;;;  (16211 27027))
+;;;### (autoloads (gnus-agent-regenerate gnus-agent-batch gnus-agent-batch-fetch
+;;;;;;  gnus-agent-find-parameter gnus-agent-possibly-alter-active
+;;;;;;  gnus-agent-get-undownloaded-list gnus-agent-delete-group
+;;;;;;  gnus-agent-rename-group gnus-agent-possibly-save-gcc gnus-agentize
+;;;;;;  gnus-slave-unplugged gnus-plugged gnus-unplugged) "gnus-agent"
+;;;;;;  "gnus/gnus-agent.el" (16775 26712))
 ;;; Generated autoloads from gnus/gnus-agent.el
 
 (autoload (quote gnus-unplugged) "gnus-agent" "\
@@ -9923,18 +10387,60 @@
 
 \(fn)" t nil)
 
+(autoload (quote gnus-slave-unplugged) "gnus-agent" "\
+Read news as a slave unplugged.
+
+\(fn &optional ARG)" t nil)
+
 (autoload (quote gnus-agentize) "gnus-agent" "\
 Allow Gnus to be an offline newsreader.
-The normal usage of this command is to put the following as the
-last form in your `.gnus.el' file:
-
-\(gnus-agentize)
-
-This will modify the `gnus-before-startup-hook', `gnus-post-method',
-and `message-send-mail-function' variables, and install the Gnus
-agent minor mode in all Gnus buffers.
-
-\(fn)" t nil)
+
+The gnus-agentize function is now called internally by gnus when
+gnus-agent is set.  If you wish to avoid calling gnus-agentize,
+customize gnus-agent to nil.
+
+This will modify the `gnus-setup-news-hook', and
+`message-send-mail-real-function' variables, and install the Gnus agent
+minor mode in all Gnus buffers.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-agent-possibly-save-gcc) "gnus-agent" "\
+Save GCC if Gnus is unplugged.
+
+\(fn)" nil nil)
+
+(autoload (quote gnus-agent-rename-group) "gnus-agent" "\
+Rename fully-qualified OLD-GROUP as NEW-GROUP.  Always updates the agent, even when
+disabled, as the old agent files would corrupt gnus when the agent was
+next enabled. Depends upon the caller to determine whether group renaming is supported.
+
+\(fn OLD-GROUP NEW-GROUP)" nil nil)
+
+(autoload (quote gnus-agent-delete-group) "gnus-agent" "\
+Delete fully-qualified GROUP.  Always updates the agent, even when
+disabled, as the old agent files would corrupt gnus when the agent was
+next enabled. Depends upon the caller to determine whether group deletion is supported.
+
+\(fn GROUP)" nil nil)
+
+(autoload (quote gnus-agent-get-undownloaded-list) "gnus-agent" "\
+Construct list of articles that have not been downloaded.
+
+\(fn)" nil nil)
+
+(autoload (quote gnus-agent-possibly-alter-active) "gnus-agent" "\
+Possibly expand a group's active range to include articles
+downloaded into the agent.
+
+\(fn GROUP ACTIVE &optional INFO)" nil nil)
+
+(autoload (quote gnus-agent-find-parameter) "gnus-agent" "\
+Search for GROUPs SYMBOL in the group's parameters, the group's
+topic parameters, the group's category, or the customizable
+variables.  Returns the first non-nil value found.
+
+\(fn GROUP SYMBOL)" nil nil)
 
 (autoload (quote gnus-agent-batch-fetch) "gnus-agent" "\
 Start Gnus and fetch session.
@@ -9942,14 +10448,20 @@
 \(fn)" t nil)
 
 (autoload (quote gnus-agent-batch) "gnus-agent" "\
-Not documented
-
-\(fn)" t nil)
+Start Gnus, send queue and fetch session.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-agent-regenerate) "gnus-agent" "\
+Regenerate all agent covered files.
+If CLEAN, obsolete (ignore).
+
+\(fn &optional CLEAN REREAD)" t nil)
 
 ;;;***
 
 ;;;### (autoloads (gnus-article-prepare-display) "gnus-art" "gnus/gnus-art.el"
-;;;;;;  (16211 27027))
+;;;;;;  (16788 34909))
 ;;; Generated autoloads from gnus/gnus-art.el
 
 (autoload (quote gnus-article-prepare-display) "gnus-art" "\
@@ -9960,7 +10472,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-audio-play) "gnus-audio" "gnus/gnus-audio.el"
-;;;;;;  (16211 27027))
+;;;;;;  (16698 21927))
 ;;; Generated autoloads from gnus/gnus-audio.el
 
 (autoload (quote gnus-audio-play) "gnus-audio" "\
@@ -9970,9 +10482,10 @@
 
 ;;;***
 
-;;;### (autoloads (gnus-cache-generate-nov-databases gnus-cache-generate-active
-;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (16211
-;;;;;;  27028))
+;;;### (autoloads (gnus-cache-delete-group gnus-cache-rename-group
+;;;;;;  gnus-cache-generate-nov-databases gnus-cache-generate-active
+;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (16764
+;;;;;;  51520))
 ;;; Generated autoloads from gnus/gnus-cache.el
 
 (autoload (quote gnus-jog-cache) "gnus-cache" "\
@@ -9993,17 +10506,132 @@
 
 \(fn DIR)" t nil)
 
+(autoload (quote gnus-cache-rename-group) "gnus-cache" "\
+Rename OLD-GROUP as NEW-GROUP.  Always updates the cache, even when
+disabled, as the old cache files would corrupt gnus when the cache was
+next enabled. Depends upon the caller to determine whether group renaming is supported.
+
+\(fn OLD-GROUP NEW-GROUP)" nil nil)
+
+(autoload (quote gnus-cache-delete-group) "gnus-cache" "\
+Delete GROUP.  Always updates the cache, even when
+disabled, as the old cache files would corrupt gnus when the cache was
+next enabled. Depends upon the caller to determine whether group deletion is supported.
+
+\(fn GROUP)" nil nil)
+
+;;;***
+
+;;;### (autoloads (gnus-delay-initialize gnus-delay-send-queue gnus-delay-article)
+;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (16775 26712))
+;;; Generated autoloads from gnus/gnus-delay.el
+
+(defgroup gnus-delay nil "Arrange for sending postings later." :version "21.4" :group (quote gnus))
+
+(autoload (quote gnus-delay-article) "gnus-delay" "\
+Delay this article by some time.
+DELAY is a string, giving the length of the time.  Possible values are:
+
+* <digits><units> for <units> in minutes (`m'), hours (`h'), days (`d'),
+  weeks (`w'), months (`M'), or years (`Y');
+
+* YYYY-MM-DD for a specific date.  The time of day is given by the
+  variable `gnus-delay-default-hour', minute and second are zero.
+
+* hh:mm for a specific time.  Use 24h format.  If it is later than this
+  time, then the deadline is tomorrow, else today.
+
+\(fn DELAY)" t nil)
+
+(autoload (quote gnus-delay-send-queue) "gnus-delay" "\
+Send all the delayed messages that are due now.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-delay-initialize) "gnus-delay" "\
+Initialize the gnus-delay package.
+This sets up a key binding in `message-mode' to delay a message.
+This tells Gnus to look for delayed messages after getting new news.
+
+The optional arg NO-KEYMAP is ignored.
+Checking delayed messages is skipped if optional arg NO-CHECK is non-nil.
+
+\(fn &optional NO-KEYMAP NO-CHECK)" nil nil)
+
+;;;***
+
+;;;### (autoloads (turn-on-gnus-dired-mode) "gnus-dired" "gnus/gnus-dired.el"
+;;;;;;  (16697 49031))
+;;; Generated autoloads from gnus/gnus-dired.el
+
+(autoload (quote turn-on-gnus-dired-mode) "gnus-dired" "\
+Convenience method to turn on gnus-dired-mode.
+
+\(fn)" nil nil)
+
+;;;***
+
+;;;### (autoloads (gnus-draft-reminder) "gnus-draft" "gnus/gnus-draft.el"
+;;;;;;  (16764 51520))
+;;; Generated autoloads from gnus/gnus-draft.el
+
+(autoload (quote gnus-draft-reminder) "gnus-draft" "\
+Reminder user if there are unsent drafts.
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (gnus-convert-png-to-face gnus-convert-face-to-png
+;;;;;;  gnus-face-from-file gnus-x-face-from-file gnus-insert-random-x-face-header
+;;;;;;  gnus-random-x-face) "gnus-fun" "gnus/gnus-fun.el" (16730
+;;;;;;  31107))
+;;; Generated autoloads from gnus/gnus-fun.el
+
+(autoload (quote gnus-random-x-face) "gnus-fun" "\
+Return X-Face header data chosen randomly from `gnus-x-face-directory'.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-insert-random-x-face-header) "gnus-fun" "\
+Insert a random X-Face header from `gnus-x-face-directory'.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-x-face-from-file) "gnus-fun" "\
+Insert an X-Face header based on an image file.
+
+\(fn FILE)" t nil)
+
+(autoload (quote gnus-face-from-file) "gnus-fun" "\
+Return an Face header based on an image file.
+
+\(fn FILE)" t nil)
+
+(autoload (quote gnus-convert-face-to-png) "gnus-fun" "\
+Convert FACE (which is base64-encoded) to a PNG.
+The PNG is returned as a string.
+
+\(fn FACE)" nil nil)
+
+(autoload (quote gnus-convert-png-to-face) "gnus-fun" "\
+Convert FILE to a Face.
+FILE should be a PNG file that's 48x48 and smaller than or equal to
+726 bytes.
+
+\(fn FILE)" nil nil)
+
 ;;;***
 
 ;;;### (autoloads (gnus-fetch-group-other-frame gnus-fetch-group)
-;;;;;;  "gnus-group" "gnus/gnus-group.el" (16211 27028))
+;;;;;;  "gnus-group" "gnus/gnus-group.el" (16770 10720))
 ;;; Generated autoloads from gnus/gnus-group.el
 
 (autoload (quote gnus-fetch-group) "gnus-group" "\
 Start Gnus if necessary and enter GROUP.
 Returns whether the fetching was successful or not.
 
-\(fn GROUP)" t nil)
+\(fn GROUP &optional ARTICLES)" t nil)
 
 (autoload (quote gnus-fetch-group-other-frame) "gnus-group" "\
 Pop up a frame and enter GROUP.
@@ -10013,7 +10641,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-batch-score) "gnus-kill" "gnus/gnus-kill.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16698 21927))
 ;;; Generated autoloads from gnus/gnus-kill.el
 
 (defalias (quote gnus-batch-kill) (quote gnus-batch-score))
@@ -10026,8 +10654,9 @@
 
 ;;;***
 
-;;;### (autoloads (gnus-mailing-list-mode turn-on-gnus-mailing-list-mode)
-;;;;;;  "gnus-ml" "gnus/gnus-ml.el" (16211 27028))
+;;;### (autoloads (gnus-mailing-list-mode gnus-mailing-list-insinuate
+;;;;;;  turn-on-gnus-mailing-list-mode) "gnus-ml" "gnus/gnus-ml.el"
+;;;;;;  (16698 21927))
 ;;; Generated autoloads from gnus/gnus-ml.el
 
 (autoload (quote turn-on-gnus-mailing-list-mode) "gnus-ml" "\
@@ -10035,6 +10664,12 @@
 
 \(fn)" nil nil)
 
+(autoload (quote gnus-mailing-list-insinuate) "gnus-ml" "\
+Setup group parameters from List-Post header.
+If FORCE is non-nil, replace the old ones.
+
+\(fn &optional FORCE)" t nil)
+
 (autoload (quote gnus-mailing-list-mode) "gnus-ml" "\
 Minor mode for providing mailing-list commands.
 
@@ -10046,7 +10681,7 @@
 
 ;;;### (autoloads (gnus-group-split-fancy gnus-group-split gnus-group-split-update
 ;;;;;;  gnus-group-split-setup) "gnus-mlspl" "gnus/gnus-mlspl.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16698 21927))
 ;;; Generated autoloads from gnus/gnus-mlspl.el
 
 (autoload (quote gnus-group-split-setup) "gnus-mlspl" "\
@@ -10069,13 +10704,14 @@
 uses are as simple as the name of a default mail group, but more
 elaborate fancy splits may also be useful to split mail that doesn't
 match any of the group-specified splitting rules.  See
-gnus-group-split-fancy for details.
+`gnus-group-split-fancy' for details.
 
 \(fn &optional AUTO-UPDATE CATCH-ALL)" t nil)
 
 (autoload (quote gnus-group-split-update) "gnus-mlspl" "\
-Computes nnmail-split-fancy from group params and CATCH-ALL, by
-calling (gnus-group-split-fancy nil nil CATCH-ALL).
+Computes nnmail-split-fancy from group params and CATCH-ALL.
+It does this by calling by calling (gnus-group-split-fancy nil
+nil CATCH-ALL).
 
 If CATCH-ALL is nil, gnus-group-split-default-catch-all-group is used
 instead.  This variable is set by gnus-group-split-setup.
@@ -10084,7 +10720,7 @@
 
 (autoload (quote gnus-group-split) "gnus-mlspl" "\
 Uses information from group parameters in order to split mail.
-See gnus-group-split-fancy for more information.
+See `gnus-group-split-fancy' for more information.
 
 gnus-group-split is a valid value for nnmail-split-methods.
 
@@ -10133,12 +10769,12 @@
 nnml:mail.others:
 \((split-spec . catch-all))
 
-Calling (gnus-group-split-fancy nil nil \"mail.misc\") returns:
+Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
 
 \(| (& (any \"\\\\(bar@femail\\\\.com\\\\|.*@femail\\\\.com\\\\)\"
 	   \"mail.bar\")
       (any \"\\\\(foo@nowhere\\\\.gov\\\\|foo@localhost\\\\|foo-redist@home\\\\)\"
-           - \"bugs-foo\" - \"rambling-foo\" \"mail.foo\"))
+	   - \"bugs-foo\" - \"rambling-foo\" \"mail.foo\"))
    \"mail.others\")
 
 \(fn &optional GROUPS NO-CROSSPOST CATCH-ALL)" nil nil)
@@ -10146,7 +10782,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-change-server) "gnus-move" "gnus/gnus-move.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16213 43273))
 ;;; Generated autoloads from gnus/gnus-move.el
 
 (autoload (quote gnus-change-server) "gnus-move" "\
@@ -10157,8 +10793,8 @@
 
 ;;;***
 
-;;;### (autoloads (gnus-msg-mail) "gnus-msg" "gnus/gnus-msg.el" (16211
-;;;;;;  27028))
+;;;### (autoloads (gnus-button-reply gnus-button-mailto gnus-msg-mail)
+;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (16784 39521))
 ;;; Generated autoloads from gnus/gnus-msg.el
 
 (autoload (quote gnus-msg-mail) "gnus-msg" "\
@@ -10166,32 +10802,165 @@
 Like `message-mail', but with Gnus paraphernalia, particularly the
 Gcc: header for archiving purposes.
 
-\(fn &rest ARGS)" t nil)
+\(fn &optional TO SUBJECT OTHER-HEADERS CONTINUE SWITCH-ACTION YANK-ACTION SEND-ACTIONS)" t nil)
+
+(autoload (quote gnus-button-mailto) "gnus-msg" "\
+Mail to ADDRESS.
+
+\(fn ADDRESS)" nil nil)
+
+(autoload (quote gnus-button-reply) "gnus-msg" "\
+Like `message-reply'.
+
+\(fn &optional TO-ADDRESS WIDE)" t nil)
 
 (define-mail-user-agent (quote gnus-user-agent) (quote gnus-msg-mail) (quote message-send-and-exit) (quote message-kill-buffer) (quote message-send-hook))
 
 ;;;***
 
-;;;### (autoloads (gnus-mule-add-group) "gnus-mule" "gnus/gnus-mule.el"
-;;;;;;  (16211 27028))
-;;; Generated autoloads from gnus/gnus-mule.el
-
-(autoload (quote gnus-mule-add-group) "gnus-mule" "\
-Specify that articles of news group NAME are encoded in CODING-SYSTEM.
-All news groups deeper than NAME are also the target.
-If CODING-SYSTEM is a cons, the car part is used and the cdr
-part is ignored.
-
-This function exists for backward compatibility with Emacs 20.  It is
-recommended to customize the variable `gnus-group-charset-alist'
-rather than using this function.
-
-\(fn NAME CODING-SYSTEM)" nil nil)
+;;;### (autoloads (gnus-treat-newsgroups-picon gnus-treat-mail-picon
+;;;;;;  gnus-treat-from-picon) "gnus-picon" "gnus/gnus-picon.el"
+;;;;;;  (16730 31107))
+;;; Generated autoloads from gnus/gnus-picon.el
+
+(autoload (quote gnus-treat-from-picon) "gnus-picon" "\
+Display picons in the From header.
+If picons are already displayed, remove them.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-treat-mail-picon) "gnus-picon" "\
+Display picons in the Cc and To headers.
+If picons are already displayed, remove them.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-treat-newsgroups-picon) "gnus-picon" "\
+Display picons in the Newsgroups and Followup-To headers.
+If picons are already displayed, remove them.
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (gnus-add-to-sorted-list gnus-sorted-nunion gnus-sorted-union
+;;;;;;  gnus-sorted-nintersection gnus-sorted-range-intersection
+;;;;;;  gnus-sorted-intersection gnus-intersection gnus-sorted-complement
+;;;;;;  gnus-sorted-ndifference gnus-sorted-difference) "gnus-range"
+;;;;;;  "gnus/gnus-range.el" (16764 51520))
+;;; Generated autoloads from gnus/gnus-range.el
+
+(autoload (quote gnus-sorted-difference) "gnus-range" "\
+Return a list of elements of LIST1 that do not appear in LIST2.
+Both lists have to be sorted over <.
+The tail of LIST1 is not copied.
+
+\(fn LIST1 LIST2)" nil nil)
+
+(autoload (quote gnus-sorted-ndifference) "gnus-range" "\
+Return a list of elements of LIST1 that do not appear in LIST2.
+Both lists have to be sorted over <.
+LIST1 is modified.
+
+\(fn LIST1 LIST2)" nil nil)
+
+(autoload (quote gnus-sorted-complement) "gnus-range" "\
+Return a list of elements that are in LIST1 or LIST2 but not both.
+Both lists have to be sorted over <.
+
+\(fn LIST1 LIST2)" nil nil)
+
+(autoload (quote gnus-intersection) "gnus-range" "\
+Not documented
+
+\(fn LIST1 LIST2)" nil nil)
+
+(autoload (quote gnus-sorted-intersection) "gnus-range" "\
+Return intersection of LIST1 and LIST2.
+LIST1 and LIST2 have to be sorted over <.
+
+\(fn LIST1 LIST2)" nil nil)
+
+(autoload (quote gnus-sorted-range-intersection) "gnus-range" "\
+Return intersection of RANGE1 and RANGE2.
+RANGE1 and RANGE2 have to be sorted over <.
+
+\(fn RANGE1 RANGE2)" nil nil)
+
+(defalias (quote gnus-set-sorted-intersection) (quote gnus-sorted-nintersection))
+
+(autoload (quote gnus-sorted-nintersection) "gnus-range" "\
+Return intersection of LIST1 and LIST2 by modifying cdr pointers of LIST1.
+LIST1 and LIST2 have to be sorted over <.
+
+\(fn LIST1 LIST2)" nil nil)
+
+(autoload (quote gnus-sorted-union) "gnus-range" "\
+Return union of LIST1 and LIST2.
+LIST1 and LIST2 have to be sorted over <.
+
+\(fn LIST1 LIST2)" nil nil)
+
+(autoload (quote gnus-sorted-nunion) "gnus-range" "\
+Return union of LIST1 and LIST2 by modifying cdr pointers of LIST1.
+LIST1 and LIST2 have to be sorted over <.
+
+\(fn LIST1 LIST2)" nil nil)
+
+(autoload (quote gnus-add-to-sorted-list) "gnus-range" "\
+Add NUM into sorted LIST by side effect.
+
+\(fn LIST NUM)" nil nil)
+
+;;;***
+
+;;;### (autoloads (gnus-registry-install-hooks gnus-registry-initialize)
+;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (16775 26712))
+;;; Generated autoloads from gnus/gnus-registry.el
+
+(autoload (quote gnus-registry-initialize) "gnus-registry" "\
+Not documented
+
+\(fn)" t nil)
+
+(autoload (quote gnus-registry-install-hooks) "gnus-registry" "\
+Install the registry hooks.
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (gnus-sieve-article-add-rule gnus-sieve-generate
+;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (16697
+;;;;;;  49031))
+;;; Generated autoloads from gnus/gnus-sieve.el
+
+(autoload (quote gnus-sieve-update) "gnus-sieve" "\
+Update the Sieve script in gnus-sieve-file, by replacing the region
+between gnus-sieve-region-start and gnus-sieve-region-end with
+\(gnus-sieve-script gnus-sieve-select-method gnus-sieve-crosspost), then
+execute gnus-sieve-update-shell-command.
+See the documentation for these variables and functions for details.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-sieve-generate) "gnus-sieve" "\
+Generate the Sieve script in gnus-sieve-file, by replacing the region
+between gnus-sieve-region-start and gnus-sieve-region-end with
+\(gnus-sieve-script gnus-sieve-select-method gnus-sieve-crosspost).
+See the documentation for these variables and functions for details.
+
+\(fn)" t nil)
+
+(autoload (quote gnus-sieve-article-add-rule) "gnus-sieve" "\
+Not documented
+
+\(fn)" t nil)
 
 ;;;***
 
 ;;;### (autoloads (gnus-batch-brew-soup) "gnus-soup" "gnus/gnus-soup.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16698 21927))
 ;;; Generated autoloads from gnus/gnus-soup.el
 
 (autoload (quote gnus-batch-brew-soup) "gnus-soup" "\
@@ -10211,7 +10980,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-update-format) "gnus-spec" "gnus/gnus-spec.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16775 26712))
 ;;; Generated autoloads from gnus/gnus-spec.el
 
 (autoload (quote gnus-update-format) "gnus-spec" "\
@@ -10221,27 +10990,25 @@
 
 ;;;***
 
-;;;### (autoloads (gnus-declare-backend gnus-unload) "gnus-start"
-;;;;;;  "gnus/gnus-start.el" (16211 27028))
+;;;### (autoloads (gnus-fixup-nnimap-unread-after-getting-new-news
+;;;;;;  gnus-declare-backend) "gnus-start" "gnus/gnus-start.el" (16792
+;;;;;;  36614))
 ;;; Generated autoloads from gnus/gnus-start.el
 
-(autoload (quote gnus-unload) "gnus-start" "\
-Unload all Gnus features.
-\(For some value of `all' or `Gnus'.)  Currently, features whose names
-have prefixes `gnus-', `nn', `mm-' or `rfc' are unloaded.  Use
-cautiously -- unloading may cause trouble.
-
-\(fn)" t nil)
-
 (autoload (quote gnus-declare-backend) "gnus-start" "\
-Declare backend NAME with ABILITIES as a Gnus backend.
+Declare back end NAME with ABILITIES as a Gnus back end.
 
 \(fn NAME &rest ABILITIES)" nil nil)
 
+(autoload (quote gnus-fixup-nnimap-unread-after-getting-new-news) "gnus-start" "\
+Not documented
+
+\(fn)" nil nil)
+
 ;;;***
 
 ;;;### (autoloads (gnus-add-configuration) "gnus-win" "gnus/gnus-win.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16775 26712))
 ;;; Generated autoloads from gnus/gnus-win.el
 
 (autoload (quote gnus-add-configuration) "gnus-win" "\
@@ -10251,7 +11018,7 @@
 
 ;;;***
 
-;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (16211 27038))
+;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (16213 43281))
 ;;; Generated autoloads from play/gomoku.el
 
 (autoload (quote gomoku) "gomoku" "\
@@ -10278,7 +11045,7 @@
 ;;;***
 
 ;;;### (autoloads (goto-address goto-address-at-point goto-address-at-mouse)
-;;;;;;  "goto-addr" "net/goto-addr.el" (16211 27037))
+;;;;;;  "goto-addr" "net/goto-addr.el" (16602 38814))
 ;;; Generated autoloads from net/goto-addr.el
 
 (autoload (quote goto-address-at-mouse) "goto-addr" "\
@@ -10310,7 +11077,126 @@
 
 ;;;***
 
-;;;### (autoloads (gs-load-image) "gs" "gs.el" (16211 27016))
+;;;### (autoloads (grep-tree grep-find grep grep-compute-defaults
+;;;;;;  grep-process-setup grep-setup-hook grep-find-command grep-command
+;;;;;;  grep-window-height) "grep" "progmodes/grep.el" (16805 44924))
+;;; Generated autoloads from progmodes/grep.el
+
+(defvar grep-window-height nil "\
+*Number of lines in a grep window.  If nil, use `compilation-window-height'.")
+
+(custom-autoload (quote grep-window-height) "grep")
+
+(defvar grep-command nil "\
+The default grep command for \\[grep].
+If the grep program used supports an option to always include file names
+in its output (such as the `-H' option to GNU grep), it's a good idea to
+include it when specifying `grep-command'.
+
+The default value of this variable is set up by `grep-compute-defaults';
+call that function before using this variable in your program.")
+
+(custom-autoload (quote grep-command) "grep")
+
+(defvar grep-find-command nil "\
+The default find command for \\[grep-find].
+The default value of this variable is set up by `grep-compute-defaults';
+call that function before using this variable in your program.")
+
+(custom-autoload (quote grep-find-command) "grep")
+
+(defvar grep-setup-hook nil "\
+List of hook functions run by `grep-process-setup' (see `run-hooks').")
+
+(custom-autoload (quote grep-setup-hook) "grep")
+
+(defvar grep-regexp-alist (quote (("^\\(.+?\\)[: 	]+\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[: 	]" 1 (2 . 5) (4 . 6)) ("^\\(.+?\\)[:(]+\\([0-9]+\\)\\([:)]\\).*?\\(\\[01;41m\\)\\(.*?\\)\\(\\[00m\\)" 1 2 ((lambda nil (setq compilation-error-screen-columns nil) (- (match-beginning 5) (match-end 3) 8)) lambda nil (- (match-end 5) (match-end 3) 8))) ("^Binary file \\(.+\\) matches$" 1 nil nil 1))) "\
+Regexp used to match grep hits.  See `compilation-error-regexp-alist'.")
+
+(defvar grep-program "grep" "\
+The default grep program for `grep-command' and `grep-find-command'.
+This variable's value takes effect when `grep-compute-defaults' is called.")
+
+(defvar find-program "find" "\
+The default find program for `grep-find-command'.
+This variable's value takes effect when `grep-compute-defaults' is called.")
+
+(defvar grep-find-use-xargs nil "\
+Whether \\[grep-find] uses the `xargs' utility by default.
+
+If nil, it uses `find -exec'; if `gnu', it uses `find -print0' and `xargs -0';
+if not nil and not `gnu', it uses `find -print' and `xargs'.
+
+This variable's value takes effect when `grep-compute-defaults' is called.")
+
+(defvar grep-history nil)
+
+(defvar grep-find-history nil)
+
+(autoload (quote grep-process-setup) "grep" "\
+Setup compilation variables and buffer for `grep'.
+Set up `compilation-exit-message-function' and run `grep-setup-hook'.
+
+\(fn)" nil nil)
+
+(autoload (quote grep-compute-defaults) "grep" "\
+Not documented
+
+\(fn)" nil nil)
+
+(autoload (quote grep) "grep" "\
+Run grep, with user-specified args, and collect output in a buffer.
+While grep runs asynchronously, you can use \\[next-error] (M-x next-error),
+or \\<grep-mode-map>\\[compile-goto-error] in the grep output buffer, to go to the lines
+where grep found matches.
+
+This command uses a special history list for its COMMAND-ARGS, so you can
+easily repeat a grep command.
+
+A prefix argument says to default the argument based upon the current
+tag the cursor is over, substituting it into the last grep command
+in the grep command history (or into `grep-command'
+if that history list is empty).
+
+If specified, optional second arg HIGHLIGHT-REGEXP is the regexp to
+temporarily highlight in visited source lines.
+
+\(fn COMMAND-ARGS &optional HIGHLIGHT-REGEXP)" t nil)
+
+(autoload (quote grep-find) "grep" "\
+Run grep via find, with user-specified args COMMAND-ARGS.
+Collect output in a buffer.
+While find runs asynchronously, you can use the \\[next-error] command
+to find the text that grep hits refer to.
+
+This command uses a special history list for its arguments, so you can
+easily repeat a find command.
+
+\(fn COMMAND-ARGS)" t nil)
+
+(autoload (quote grep-tree) "grep" "\
+Grep for REGEXP in FILES in directory tree rooted at DIR.
+Collect output in a buffer.
+Interactively, prompt separately for each search parameter.
+With prefix arg, reuse previous REGEXP.
+The search is limited to file names matching shell pattern FILES.
+FILES may use abbreviations defined in `grep-tree-files-aliases', e.g.
+entering `ch' is equivalent to `*.[ch]'.
+
+While find runs asynchronously, you can use the \\[next-error] command
+to find the text that grep hits refer to.
+
+This command uses a special history list for its arguments, so you can
+easily repeat a find command.
+
+When used non-interactively, optional arg SUBDIRS limits the search to
+those sub directories of DIR.
+
+\(fn REGEXP FILES DIR &optional SUBDIRS)" t nil)
+
+;;;***
+
+;;;### (autoloads (gs-load-image) "gs" "gs.el" (16565 48734))
 ;;; Generated autoloads from gs.el
 
 (autoload (quote gs-load-image) "gs" "\
@@ -10324,7 +11210,7 @@
 ;;;***
 
 ;;;### (autoloads (gdb-script-mode bashdb jdb pdb perldb xdb dbx
-;;;;;;  sdb gdb) "gud" "progmodes/gud.el" (16278 45828))
+;;;;;;  sdb gdb) "gud" "progmodes/gud.el" (16808 48570))
 ;;; Generated autoloads from progmodes/gud.el
 
 (autoload (quote gdb) "gud" "\
@@ -10405,8 +11291,8 @@
 
 ;;;***
 
-;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (16211
-;;;;;;  27038))
+;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (16377
+;;;;;;  12872))
 ;;; Generated autoloads from play/handwrite.el
 
 (autoload (quote handwrite) "handwrite" "\
@@ -10424,7 +11310,7 @@
 ;;;***
 
 ;;;### (autoloads (hanoi-unix-64 hanoi-unix hanoi) "hanoi" "play/hanoi.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from play/hanoi.el
 
 (autoload (quote hanoi) "hanoi" "\
@@ -10451,9 +11337,110 @@
 
 ;;;***
 
+;;;### (autoloads (scan-buf-previous-region scan-buf-next-region
+;;;;;;  scan-buf-move-to-region help-at-pt-set-timer help-at-pt-cancel-timer
+;;;;;;  display-local-help help-at-pt-kbd-string help-at-pt-string)
+;;;;;;  "help-at-pt" "help-at-pt.el" (16775 26706))
+;;; Generated autoloads from help-at-pt.el
+
+(autoload (quote help-at-pt-string) "help-at-pt" "\
+Return the help-echo string at point.
+Normally, the string produced by the `help-echo' text or overlay
+property, or nil, is returned.
+If KBD is non-nil, `kbd-help' is used instead, and any
+`help-echo' property is ignored.  In this case, the return value
+can also be t, if that is the value of the `kbd-help' property.
+
+\(fn &optional KBD)" nil nil)
+
+(autoload (quote help-at-pt-kbd-string) "help-at-pt" "\
+Return the keyboard help string at point.
+If the `kbd-help' text or overlay property at point produces a
+string, return it.  Otherwise, use the `help-echo' property.  If
+this produces no string either, return nil.
+
+\(fn)" nil nil)
+
+(autoload (quote display-local-help) "help-at-pt" "\
+Display local help in the echo area.
+This displays a short help message, namely the string produced by
+the `kbd-help' property at point.  If `kbd-help' does not produce
+a string, but the `help-echo' property does, then that string is
+printed instead.
+
+A numeric argument ARG prevents display of a message in case
+there is no help.  While ARG can be used interactively, it is
+mainly meant for use from Lisp.
+
+\(fn &optional ARG)" t nil)
+
+(autoload (quote help-at-pt-cancel-timer) "help-at-pt" "\
+Cancel any timer set by `help-at-pt-set-timer'.
+This disables `help-at-pt-display-when-idle'.
+
+\(fn)" t nil)
+
+(autoload (quote help-at-pt-set-timer) "help-at-pt" "\
+Enable `help-at-pt-display-when-idle'.
+This is done by setting a timer, if none is currently active.
+
+\(fn)" t nil)
+
+(autoload (quote scan-buf-move-to-region) "help-at-pt" "\
+Go to the start of the next region with non-nil PROP property.
+Then run HOOK, which should be a quoted symbol that is a normal
+hook.variable, or an expression evaluating to such a symbol.
+Adjacent areas with different non-nil PROP properties are
+considered different regions.
+
+With numeric argument ARG, move to the start of the ARGth next
+such region, then run HOOK.  If ARG is negative, move backward.
+If point is already in a region, then that region does not count
+toward ARG.  If ARG is 0 and point is inside a region, move to
+the start of that region.  If ARG is 0 and point is not in a
+region, print a message to that effect, but do not move point and
+do not run HOOK.  If there are not enough regions to move over,
+an error results and the number of available regions is mentioned
+in the error message.  Point is not moved and HOOK is not run.
+
+\(fn PROP &optional ARG HOOK)" nil nil)
+
+(autoload (quote scan-buf-next-region) "help-at-pt" "\
+Go to the start of the next region with non-nil help-echo.
+Print the help found there using `display-local-help'.  Adjacent
+areas with different non-nil help-echo properties are considered
+different regions.
+
+With numeric argument ARG, move to the start of the ARGth next
+help-echo region.  If ARG is negative, move backward.  If point
+is already in a help-echo region, then that region does not count
+toward ARG.  If ARG is 0 and point is inside a help-echo region,
+move to the start of that region.  If ARG is 0 and point is not
+in such a region, just print a message to that effect.  If there
+are not enough regions to move over, an error results and the
+number of available regions is mentioned in the error message.
+
+A potentially confusing subtlety is that point can be in a
+help-echo region without any local help being available.  This is
+because `help-echo' can be a function evaluating to nil.  This
+rarely happens in practice.
+
+\(fn &optional ARG)" t nil)
+
+(autoload (quote scan-buf-previous-region) "help-at-pt" "\
+Go to the start of the previous region with non-nil help-echo.
+Print the help found there using `display-local-help'.  Adjacent
+areas with different non-nil help-echo properties are considered
+different regions.  With numeric argument ARG, behaves like
+`scan-buf-next-region' with argument -ARG..
+
+\(fn &optional ARG)" t nil)
+
+;;;***
+
 ;;;### (autoloads (describe-categories describe-syntax describe-variable
 ;;;;;;  variable-at-point describe-function-1 describe-function locate-library
-;;;;;;  help-with-tutorial) "help-fns" "help-fns.el" (16211 27016))
+;;;;;;  help-with-tutorial) "help-fns" "help-fns.el" (16784 39521))
 ;;; Generated autoloads from help-fns.el
 
 (autoload (quote help-with-tutorial) "help-fns" "\
@@ -10486,6 +11473,8 @@
 
 \(fn FUNCTION)" t nil)
 
+(defface help-argument-name (quote ((((supports :slant italic)) :inherit italic))) "Face to highlight argument names in *Help* buffers." :group (quote help))
+
 (autoload (quote describe-function-1) "help-fns" "\
 Not documented
 
@@ -10515,13 +11504,15 @@
 (autoload (quote describe-categories) "help-fns" "\
 Describe the category specifications in the current category table.
 The descriptions are inserted in a buffer, which is then displayed.
+If BUFFER is non-nil, then describe BUFFER's category table instead.
+BUFFER should be a buffer or a buffer name.
 
 \(fn &optional BUFFER)" t nil)
 
 ;;;***
 
 ;;;### (autoloads (three-step-help) "help-macro" "help-macro.el"
-;;;;;;  (16211 27016))
+;;;;;;  (16213 43268))
 ;;; Generated autoloads from help-macro.el
 
 (defvar three-step-help nil "\
@@ -10537,7 +11528,7 @@
 
 ;;;### (autoloads (help-xref-on-pp help-insert-xref-button help-xref-button
 ;;;;;;  help-make-xrefs help-setup-xref help-mode-finish help-mode-setup
-;;;;;;  help-mode) "help-mode" "help-mode.el" (16276 26334))
+;;;;;;  help-mode) "help-mode" "help-mode.el" (16654 2763))
 ;;; Generated autoloads from help-mode.el
 
 (autoload (quote help-mode) "help-mode" "\
@@ -10620,7 +11611,7 @@
 ;;;***
 
 ;;;### (autoloads (Helper-help Helper-describe-bindings) "helper"
-;;;;;;  "emacs-lisp/helper.el" (16211 27026))
+;;;;;;  "emacs-lisp/helper.el" (16213 43273))
 ;;; Generated autoloads from emacs-lisp/helper.el
 
 (autoload (quote Helper-describe-bindings) "helper" "\
@@ -10636,7 +11627,7 @@
 ;;;***
 
 ;;;### (autoloads (hexlify-buffer hexl-find-file hexl-mode) "hexl"
-;;;;;;  "hexl.el" (16211 27016))
+;;;;;;  "hexl.el" (16801 58021))
 ;;; Generated autoloads from hexl.el
 
 (autoload (quote hexl-mode) "hexl" "\
@@ -10731,8 +11722,8 @@
 
 ;;;### (autoloads (hi-lock-write-interactive-patterns hi-lock-unface-buffer
 ;;;;;;  hi-lock-face-phrase-buffer hi-lock-face-buffer hi-lock-line-face-buffer
-;;;;;;  hi-lock-mode hi-lock-mode) "hi-lock" "hi-lock.el" (16211
-;;;;;;  27016))
+;;;;;;  hi-lock-mode hi-lock-mode) "hi-lock" "hi-lock.el" (16219
+;;;;;;  35448))
 ;;; Generated autoloads from hi-lock.el
 
 (defvar hi-lock-mode nil "\
@@ -10843,7 +11834,7 @@
 ;;;***
 
 ;;;### (autoloads (hide-ifdef-lines hide-ifdef-read-only hide-ifdef-initially
-;;;;;;  hide-ifdef-mode) "hideif" "progmodes/hideif.el" (16211 27039))
+;;;;;;  hide-ifdef-mode) "hideif" "progmodes/hideif.el" (16213 43281))
 ;;; Generated autoloads from progmodes/hideif.el
 
 (autoload (quote hide-ifdef-mode) "hideif" "\
@@ -10898,7 +11889,7 @@
 ;;;***
 
 ;;;### (autoloads (hs-minor-mode hs-hide-comments-when-hiding-all)
-;;;;;;  "hideshow" "progmodes/hideshow.el" (16274 58117))
+;;;;;;  "hideshow" "progmodes/hideshow.el" (16275 41871))
 ;;; Generated autoloads from progmodes/hideshow.el
 
 (defvar hs-hide-comments-when-hiding-all t "\
@@ -10958,9 +11949,10 @@
 ;;;***
 
 ;;;### (autoloads (global-highlight-changes highlight-compare-with-file
-;;;;;;  highlight-changes-rotate-faces highlight-changes-previous-change
-;;;;;;  highlight-changes-next-change highlight-changes-mode highlight-changes-remove-highlight)
-;;;;;;  "hilit-chg" "hilit-chg.el" (16211 27016))
+;;;;;;  highlight-compare-buffers highlight-changes-rotate-faces
+;;;;;;  highlight-changes-previous-change highlight-changes-next-change
+;;;;;;  highlight-changes-mode highlight-changes-remove-highlight)
+;;;;;;  "hilit-chg" "hilit-chg.el" (16435 26305))
 ;;; Generated autoloads from hilit-chg.el
 
 (defvar highlight-changes-mode nil)
@@ -11031,12 +12023,26 @@
 
 \(fn)" t nil)
 
+(autoload (quote highlight-compare-buffers) "hilit-chg" "\
+Compare two buffers and highlight the differences.
+
+The default is the current buffer and the one in the next window.
+
+If either buffer is modified and is visiting a file, you are prompted
+to save the file.
+
+Unless the buffer is unmodified and visiting a file,  the buffer is
+written to a temporary file for comparison.
+
+If a buffer is read-only, differences will be highlighted but no property
+changes are made, so \\[highlight-changes-next-change] and
+\\[highlight-changes-previous-change] will not work.
+
+\(fn BUF-A BUF-B)" t nil)
+
 (autoload (quote highlight-compare-with-file) "hilit-chg" "\
 Compare this buffer with a file, and highlight differences.
 
-The current buffer must be an unmodified buffer visiting a file,
-and must not be read-only.
-
 If the buffer has a backup filename, it is used as the default when
 this function is called interactively.
 
@@ -11078,7 +12084,7 @@
 ;;;;;;  hippie-expand-ignore-buffers hippie-expand-max-buffers hippie-expand-no-restriction
 ;;;;;;  hippie-expand-dabbrev-as-symbol hippie-expand-dabbrev-skip-space
 ;;;;;;  hippie-expand-verbose hippie-expand-try-functions-list) "hippie-exp"
-;;;;;;  "hippie-exp.el" (16211 27016))
+;;;;;;  "hippie-exp.el" (16213 43268))
 ;;; Generated autoloads from hippie-exp.el
 
 (defvar hippie-expand-try-functions-list (quote (try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-lisp-symbol-partially try-complete-lisp-symbol)) "\
@@ -11151,7 +12157,7 @@
 ;;;***
 
 ;;;### (autoloads (global-hl-line-mode hl-line-mode) "hl-line" "hl-line.el"
-;;;;;;  (16271 3438))
+;;;;;;  (16469 33009))
 ;;; Generated autoloads from hl-line.el
 
 (autoload (quote hl-line-mode) "hl-line" "\
@@ -11191,7 +12197,7 @@
 ;;;***
 
 ;;;### (autoloads (list-holidays holidays) "holidays" "calendar/holidays.el"
-;;;;;;  (16211 27023))
+;;;;;;  (16722 36135))
 ;;; Generated autoloads from calendar/holidays.el
 
 (autoload (quote holidays) "holidays" "\
@@ -11215,7 +12221,7 @@
 ;;;***
 
 ;;;### (autoloads (hscroll-global-mode hscroll-mode turn-on-hscroll)
-;;;;;;  "hscroll" "obsolete/hscroll.el" (16211 27037))
+;;;;;;  "hscroll" "obsolete/hscroll.el" (16213 43281))
 ;;; Generated autoloads from obsolete/hscroll.el
 
 (autoload (quote turn-on-hscroll) "hscroll" "\
@@ -11241,6 +12247,17 @@
 
 ;;;***
 
+;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (16777
+;;;;;;  65418))
+;;; Generated autoloads from gnus/html2text.el
+
+(autoload (quote html2text) "html2text" "\
+Convert HTML to plain text in the current buffer.
+
+\(fn)" t nil)
+
+;;;***
+
 ;;;### (autoloads (ibuffer-do-occur ibuffer-mark-dired-buffers ibuffer-mark-read-only-buffers
 ;;;;;;  ibuffer-mark-special-buffers ibuffer-mark-old-buffers ibuffer-mark-help-buffers
 ;;;;;;  ibuffer-mark-dissociated-buffers ibuffer-mark-unsaved-buffers
@@ -11262,7 +12279,7 @@
 ;;;;;;  ibuffer-backward-filter-group ibuffer-forward-filter-group
 ;;;;;;  ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group
 ;;;;;;  ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode
-;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" (16211 27016))
+;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" (16764 51518))
 ;;; Generated autoloads from ibuf-ext.el
 
 (autoload (quote ibuffer-auto-mode) "ibuf-ext" "\
@@ -11357,7 +12374,7 @@
 Kill the filter group at point.
 See also `ibuffer-kill-filter-group'.
 
-\(fn &optional ARG)" t nil)
+\(fn &optional ARG INTERACTIVE-P)" t nil)
 
 (autoload (quote ibuffer-yank) "ibuf-ext" "\
 Yank the last killed filter group before group at point.
@@ -11522,6 +12539,14 @@
 (autoload (quote ibuffer-jump-to-buffer) "ibuf-ext" "\
 Move point to the buffer whose name is NAME.
 
+If called interactively, prompt for a buffer name and go to the
+corresponding line in the Ibuffer buffer.  If said buffer is in a
+hidden group filter, open it.
+
+If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer
+visible buffers in the completion list.  Calling the command with
+a prefix argument reverses the meaning of that variable.
+
 \(fn NAME)" t nil)
 
 (autoload (quote ibuffer-diff-with-file) "ibuf-ext" "\
@@ -11615,8 +12640,8 @@
 ;;;***
 
 ;;;### (autoloads (define-ibuffer-filter define-ibuffer-op define-ibuffer-sorter
-;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (16211
-;;;;;;  27016))
+;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (16544
+;;;;;;  33333))
 ;;; Generated autoloads from ibuf-macs.el
 
 (autoload (quote define-ibuffer-column) "ibuf-macs" "\
@@ -11639,7 +12664,7 @@
 change its definition, you should explicitly call
 `ibuffer-recompile-formats'.
 
-\(fn SYMBOL (&KEY name inline props summarizer) &rest BODY)" nil (quote macro))
+\(fn SYMBOL (&key NAME INLINE PROPS SUMMARIZER) &rest BODY)" nil (quote macro))
 
 (autoload (quote define-ibuffer-sorter) "ibuf-macs" "\
 Define a method of sorting named NAME.
@@ -11651,7 +12676,7 @@
 buffer object, and `b' bound to another.  BODY should return a non-nil
 value if and only if `a' is \"less than\" `b'.
 
-\(fn NAME DOCUMENTATION (&KEY description) &rest BODY)" nil (quote macro))
+\(fn NAME DOCUMENTATION (&key DESCRIPTION) &rest BODY)" nil (quote macro))
 
 (autoload (quote define-ibuffer-op) "ibuf-macs" "\
 Generate a function which operates on a buffer.
@@ -11684,7 +12709,7 @@
 COMPLEX means this function is special; see the source code of this
 macro for exactly what it does.
 
-\(fn OP ARGS DOCUMENTATION (&KEY interactive mark modifier-p dangerous (opstring operated on) (active-opstring Operate on) complex) &rest BODY)" nil (quote macro))
+\(fn OP ARGS DOCUMENTATION (&key INTERACTIVE MARK MODIFIER-P DANGEROUS OPSTRING ACTIVE-OPSTRING COMPLEX) &rest BODY)" nil (quote macro))
 
 (autoload (quote define-ibuffer-filter) "ibuf-macs" "\
 Define a filter named NAME.
@@ -11697,12 +12722,12 @@
 will be evaluated with BUF bound to the buffer object, and QUALIFIER
 bound to the current value of the filter.
 
-\(fn NAME DOCUMENTATION (&KEY reader description) &rest BODY)" nil (quote macro))
+\(fn NAME DOCUMENTATION (&key READER DESCRIPTION) &rest BODY)" nil (quote macro))
 
 ;;;***
 
 ;;;### (autoloads (ibuffer ibuffer-other-window ibuffer-list-buffers)
-;;;;;;  "ibuffer" "ibuffer.el" (16211 27016))
+;;;;;;  "ibuffer" "ibuffer.el" (16775 26706))
 ;;; Generated autoloads from ibuffer.el
 
 (autoload (quote ibuffer-list-buffers) "ibuffer" "\
@@ -11742,7 +12767,7 @@
 ;;;***
 
 ;;;### (autoloads (icomplete-minibuffer-setup icomplete-mode) "icomplete"
-;;;;;;  "icomplete.el" (16211 27017))
+;;;;;;  "icomplete.el" (16213 43269))
 ;;; Generated autoloads from icomplete.el
 
 (autoload (quote icomplete-mode) "icomplete" "\
@@ -11759,7 +12784,7 @@
 
 ;;;***
 
-;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (16211 27039))
+;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (16435 26306))
 ;;; Generated autoloads from progmodes/icon.el
 
 (autoload (quote icon-mode) "icon" "\
@@ -11800,7 +12825,7 @@
 ;;;***
 
 ;;;### (autoloads (idlwave-shell) "idlw-shell" "progmodes/idlw-shell.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16796 28018))
 ;;; Generated autoloads from progmodes/idlw-shell.el
 
 (autoload (quote idlwave-shell) "idlw-shell" "\
@@ -11826,11 +12851,11 @@
 ;;;***
 
 ;;;### (autoloads (idlwave-mode) "idlwave" "progmodes/idlwave.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16796 28018))
 ;;; Generated autoloads from progmodes/idlwave.el
 
 (autoload (quote idlwave-mode) "idlwave" "\
-Major mode for editing IDL and WAVE CL .pro files.
+Major mode for editing IDL source files (version 5.5).
 
 The main features of this mode are
 
@@ -11857,8 +12882,7 @@
    relative to the first will be retained.  Use
    \\[idlwave-auto-fill-mode] to toggle auto-fill mode for these
    comments.  When the variable `idlwave-fill-comment-line-only' is
-   nil, code can also be auto-filled and auto-indented (not
-   recommended).
+   nil, code can also be auto-filled and auto-indented.
 
    To convert pre-existing IDL code to your formatting style, mark the
    entire buffer with \\[mark-whole-buffer] and execute
@@ -11873,24 +12897,28 @@
    source file of a module.  These commands know about system
    routines, all routines in idlwave-mode buffers and (when the
    idlwave-shell is active) about all modules currently compiled under
-   this shell.  Use \\[idlwave-update-routine-info] to update this
+   this shell.  It also makes use of pre-compiled or custom-scanned
+   user and library catalogs many popular libraries ship with by
+   default.  Use \\[idlwave-update-routine-info] to update this
    information, which is also used for completion (see item 4).
 
 3. Online IDL Help
    ---------------
    \\[idlwave-context-help] displays the IDL documentation relevant
-   for the system variable, keyword, or routine at point.  A single key
-   stroke gets you directly to the right place in the docs.  Two additional
-   files (an ASCII version of the IDL documentation and a topics file) must
-   be installed for this - check the IDLWAVE webpage for these files.
+   for the system variable, keyword, or routine at point.  A single
+   key stroke gets you directly to the right place in the docs.  The
+   HTML help files package must be installed for this to work -- check
+   the IDLWAVE webpage for the correct package for your version.  See
+   the manual to configure where and how the HTML help is displayed.
 
 4. Completion
    ----------
    \\[idlwave-complete] completes the names of procedures, functions
-   class names and keyword parameters.  It is context sensitive and
-   figures out what is expected at point (procedure/function/keyword).
-   Lower case strings are completed in lower case, other strings in
-   mixed or upper case.
+   class names, keyword parameters, system variables and tags, class
+   tags, structure tags, filenames and much more.  It is context
+   sensitive and figures out what is expected at point.  Lower case
+   strings are completed in lower case, other strings in mixed or
+   upper case.
 
 5. Code Templates and Abbreviations
    --------------------------------
@@ -11907,13 +12935,14 @@
    \\i         IF statement template
    \\elif      IF-ELSE statement template
    \\b         BEGIN
-
-   For a full list, use \\[idlwave-list-abbrevs].  Some templates also have
-   direct keybindings - see the list of keybindings below.
-
-   \\[idlwave-doc-header] inserts a documentation header at the beginning of the
-   current program unit (pro, function or main).  Change log entries
-   can be added to the current program unit with \\[idlwave-doc-modification].
+   
+   For a full list, use \\[idlwave-list-abbrevs].  Some templates also
+   have direct keybindings - see the list of keybindings below.
+
+   \\[idlwave-doc-header] inserts a documentation header at the
+   beginning of the current program unit (pro, function or main).
+   Change log entries can be added to the current program unit with
+   \\[idlwave-doc-modification].
 
 6. Automatic Case Conversion
    -------------------------
@@ -11947,17 +12976,19 @@
 \\{idlwave-mode-map}
 
 \(fn)" t nil)
-
-;;;***
-
-;;;### (autoloads (ido-read-directory-name ido-read-file-name ido-dired
-;;;;;;  ido-insert-file ido-write-file ido-find-file-other-frame
-;;;;;;  ido-display-file ido-find-file-read-only-other-frame ido-find-file-read-only-other-window
-;;;;;;  ido-find-file-read-only ido-find-alternate-file ido-find-file-other-window
-;;;;;;  ido-find-file ido-find-file-in-dir ido-switch-buffer-other-frame
-;;;;;;  ido-insert-buffer ido-kill-buffer ido-display-buffer ido-switch-buffer-other-window
-;;;;;;  ido-switch-buffer ido-read-buffer ido-mode ido-mode) "ido"
-;;;;;;  "ido.el" (16211 27017))
+(add-to-list 'auto-mode-alist '("\\.[Pp][Rr][Oo]\\'" . idlwave-mode))
+
+;;;***
+
+;;;### (autoloads (ido-completing-read ido-read-directory-name ido-read-file-name
+;;;;;;  ido-read-buffer ido-dired ido-insert-file ido-write-file
+;;;;;;  ido-find-file-other-frame ido-display-file ido-find-file-read-only-other-frame
+;;;;;;  ido-find-file-read-only-other-window ido-find-file-read-only
+;;;;;;  ido-find-alternate-file ido-find-file-other-window ido-find-file
+;;;;;;  ido-find-file-in-dir ido-switch-buffer-other-frame ido-insert-buffer
+;;;;;;  ido-kill-buffer ido-display-buffer ido-switch-buffer-other-window
+;;;;;;  ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (16804
+;;;;;;  23129))
 ;;; Generated autoloads from ido.el
 
 (defvar ido-mode nil "\
@@ -11986,16 +13017,6 @@
 
 \(fn &optional ARG)" t nil)
 
-(autoload (quote ido-read-buffer) "ido" "\
-Replacement for the built-in `read-buffer'.
-Return the name of a buffer selected.
-PROMPT is the prompt to give to the user.  DEFAULT if given is the default
-buffer to be selected, which will go to the front of the list.
-If REQUIRE-MATCH is non-nil, an existing-buffer must be selected.
-If INITIAL is non-nil, it specifies the initial input string.
-
-\(fn PROMPT &optional DEFAULT REQUIRE-MATCH INITIAL)" nil nil)
-
 (autoload (quote ido-switch-buffer) "ido" "\
 Switch to another buffer.
 The buffer is displayed according to `ido-default-buffer-method' -- the
@@ -12185,21 +13206,50 @@
 
 \(fn)" t nil)
 
+(autoload (quote ido-read-buffer) "ido" "\
+Ido replacement for the built-in `read-buffer'.
+Return the name of a buffer selected.
+PROMPT is the prompt to give to the user.  DEFAULT if given is the default
+buffer to be selected, which will go to the front of the list.
+If REQUIRE-MATCH is non-nil, an existing-buffer must be selected.
+
+\(fn PROMPT &optional DEFAULT REQUIRE-MATCH)" nil nil)
+
 (autoload (quote ido-read-file-name) "ido" "\
+Ido replacement for the built-in `read-file-name'.
 Read file name, prompting with PROMPT and completing in directory DIR.
 See `read-file-name' for additional parameters.
 
 \(fn PROMPT &optional DIR DEFAULT-FILENAME MUSTMATCH INITIAL PREDICATE)" nil nil)
 
 (autoload (quote ido-read-directory-name) "ido" "\
+Ido replacement for the built-in `read-directory-name'.
 Read directory name, prompting with PROMPT and completing in directory DIR.
-See `read-file-name' for additional parameters.
+See `read-directory-name' for additional parameters.
 
 \(fn PROMPT &optional DIR DEFAULT-DIRNAME MUSTMATCH INITIAL)" nil nil)
 
-;;;***
-
-;;;### (autoloads (ielm) "ielm" "ielm.el" (16218 6767))
+(autoload (quote ido-completing-read) "ido" "\
+Ido replacement for the built-in `completing-read'.
+Read a string in the minibuffer with ido-style completion.
+PROMPT is a string to prompt with; normally it ends in a colon and a space.
+CHOICES is a list of strings which are the possible completions.
+PREDICATE is currently ignored; it is included to be compatible
+ with `completing-read'.
+If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless
+ the input is (or completes to) an element of CHOICES or is null.
+ If the input is null, `ido-completing-read' returns DEF, or an empty
+ string if DEF is nil, regardless of the value of REQUIRE-MATCH.
+If INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
+ with point positioned at the end.
+HIST, if non-nil, specifies a history list.
+DEF, if non-nil, is the default value.
+
+\(fn PROMPT CHOICES &optional PREDICATE REQUIRE-MATCH INITIAL-INPUT HIST DEF)" nil nil)
+
+;;;***
+
+;;;### (autoloads (ielm) "ielm" "ielm.el" (16686 1588))
 ;;; Generated autoloads from ielm.el
  (add-hook 'same-window-buffer-names "*ielm*")
 
@@ -12211,11 +13261,40 @@
 
 ;;;***
 
+;;;### (autoloads (iimage-mode turn-on-iimage-mode) "iimage" "iimage.el"
+;;;;;;  (16619 14967))
+;;; Generated autoloads from iimage.el
+
+(autoload (quote turn-on-iimage-mode) "iimage" "\
+Unconditionally turn on iimage mode.
+
+\(fn)" t nil)
+
+(autoload (quote iimage-mode) "iimage" "\
+Toggle inline image minor mode.
+
+\(fn &optional ARG)" t nil)
+
+;;;***
+
 ;;;### (autoloads (defimage find-image remove-images insert-image
 ;;;;;;  put-image create-image image-type-available-p image-type-from-file-header
-;;;;;;  image-type-from-data) "image" "image.el" (16211 27017))
+;;;;;;  image-type-from-data) "image" "image.el" (16722 36133))
 ;;; Generated autoloads from image.el
 
+(defvar image-library-alist nil "\
+Alist of image types vs external libraries needed to display them.
+
+Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol
+representing a supported image type, and the rest are strings giving
+alternate filenames for the corresponding external libraries.
+
+Emacs tries to load the libraries in the order they appear on the
+list; if none is loaded, the running session of Emacs won't
+support the image type.  Types 'pbm and 'xbm don't need to be
+listed; they're always supported.")
+ (put 'image-library-alist 'risky-local-variable t)
+
 (autoload (quote image-type-from-data) "image" "\
 Determine the image type from image data DATA.
 Value is a symbol specifying the image type or nil if type cannot
@@ -12273,8 +13352,13 @@
 display it in the text area, a value of `left-margin' means
 display it in the left marginal area, a value of `right-margin'
 means display it in the right marginal area.
-
-\(fn IMAGE &optional STRING AREA)" nil nil)
+SLICE specifies slice of IMAGE to insert.  SLICE nil or omitted
+means insert whole image.  SLICE is a list (X Y WIDTH HEIGHT)
+specifying the X and Y positions and WIDTH and HEIGHT of image area
+to insert.  A float value 0.0 - 1.0 means relative to the width or
+height of the image; integer values are taken as pixel values.
+
+\(fn IMAGE &optional STRING AREA SLICE)" nil nil)
 
 (autoload (quote remove-images) "image" "\
 Remove images between START and END in BUFFER.
@@ -12328,7 +13412,7 @@
 
 ;;;### (autoloads (auto-image-file-mode insert-image-file image-file-name-regexp
 ;;;;;;  image-file-name-regexps image-file-name-extensions) "image-file"
-;;;;;;  "image-file.el" (16211 27017))
+;;;;;;  "image-file.el" (16213 43269))
 ;;; Generated autoloads from image-file.el
 
 (defvar image-file-name-extensions (quote ("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm" "xpm" "pbm" "pgm" "ppm" "pnm")) "\
@@ -12389,7 +13473,7 @@
 ;;;***
 
 ;;;### (autoloads (imenu imenu-add-menubar-index imenu-add-to-menubar
-;;;;;;  imenu-sort-function) "imenu" "imenu.el" (16252 34050))
+;;;;;;  imenu-sort-function) "imenu" "imenu.el" (16816 23724))
 ;;; Generated autoloads from imenu.el
 
 (defvar imenu-sort-function nil "\
@@ -12435,8 +13519,6 @@
 INDEX points to the substring in REGEXP that contains the name (of the
 function, variable or type) that is to appear in the menu.
 
-The variable is buffer-local.
-
 The variable `imenu-case-fold-search' determines whether or not the
 regexp matches are case sensitive, and `imenu-syntax-alist' can be
 used to alter the syntax table for the search.
@@ -12460,9 +13542,7 @@
 The function `imenu--subalist-p' tests an element and returns t
 if it is a sub-alist.
 
-This function is called within a `save-excursion'.
-
-The variable is buffer-local.")
+This function is called within a `save-excursion'.")
 
 (make-variable-buffer-local (quote imenu-create-index-function))
 
@@ -12475,9 +13555,7 @@
 file.
 
 The function should leave point at the place to be connected to the
-index and it should return nil when it doesn't find another index.
-
-This variable is local in all buffers.")
+index and it should return nil when it doesn't find another index.")
 
 (make-variable-buffer-local (quote imenu-prev-index-position-function))
 
@@ -12486,9 +13564,7 @@
 
 This function is called after `imenu-prev-index-position-function'
 finds a position for an index item, with point at that position.
-It should return the name for that index item.
-
-This variable is local in all buffers.")
+It should return the name for that index item.")
 
 (make-variable-buffer-local (quote imenu-extract-index-name-function))
 
@@ -12501,9 +13577,7 @@
 If nil, comparison is done with `string='.
 Set this to some other function for more advanced comparisons,
 such as \"begins with\" or \"name matches and number of
-arguments match\".
-
-This variable is local in all buffers.")
+arguments match\".")
 
 (make-variable-buffer-local (quote imenu-name-lookup-function))
 
@@ -12542,7 +13616,7 @@
 
 ;;;### (autoloads (indian-char-glyph indian-glyph-char in-is13194-pre-write-conversion
 ;;;;;;  in-is13194-post-read-conversion indian-compose-string indian-compose-region)
-;;;;;;  "ind-util" "language/ind-util.el" (16301 42973))
+;;;;;;  "ind-util" "language/ind-util.el" (16303 21394))
 ;;; Generated autoloads from language/ind-util.el
 
 (autoload (quote indian-compose-region) "ind-util" "\
@@ -12584,7 +13658,7 @@
 ;;;***
 
 ;;;### (autoloads (inferior-lisp) "inf-lisp" "progmodes/inf-lisp.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16213 43282))
 ;;; Generated autoloads from progmodes/inf-lisp.el
 
 (defvar inferior-lisp-filter-regexp "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'" "\
@@ -12640,17 +13714,19 @@
 
 ;;;***
 
-;;;### (autoloads (Info-speedbar-browser Info-goto-emacs-key-command-node
-;;;;;;  Info-goto-emacs-command-node Info-index Info-directory info-standalone
+;;;### (autoloads (Info-restore-desktop-buffer Info-speedbar-browser
+;;;;;;  Info-goto-emacs-key-command-node Info-goto-emacs-command-node
+;;;;;;  info-apropos Info-index Info-directory Info-goto-node info-standalone
 ;;;;;;  info-emacs-manual info info-other-window) "info" "info.el"
-;;;;;;  (16258 10857))
+;;;;;;  (16810 63790))
 ;;; Generated autoloads from info.el
 
 (autoload (quote info-other-window) "info" "\
 Like `info' but show the Info buffer in another window.
 
 \(fn &optional FILE)" t nil)
- (add-hook 'same-window-buffer-names "*info*")
+ (add-hook 'same-window-regexps "\\*info\\*\\(\\|<[0-9]+>\\)")
+ (put 'info 'info-file "emacs")
 
 (autoload (quote info) "info" "\
 Enter Info, the documentation browser.
@@ -12658,15 +13734,21 @@
 the default is the top-level directory of Info.
 Called from a program, FILE may specify an Info node of the form
 `(FILENAME)NODENAME'.
-
-In interactive use, a prefix argument directs this command
-to read a file name from the minibuffer.
+Optional argument BUFFER specifies the Info buffer name;
+the default buffer name is *info*.  If BUFFER exists,
+just switch to BUFFER.  Otherwise, create a new buffer
+with the top-level Info directory.
+
+In interactive use, a non-numeric prefix argument directs
+this command to read a file name from the minibuffer.
+A numeric prefix argument selects an Info buffer with the prefix number
+appended to the Info buffer name.
 
 The search path for Info files is in the variable `Info-directory-list'.
 The top-level Info directory is made by combining all the files named `dir'
 in all the directories in that path.
 
-\(fn &optional FILE)" t nil)
+\(fn &optional FILE BUFFER)" t nil)
 
 (autoload (quote info-emacs-manual) "info" "\
 Display the Emacs manual in Info mode.
@@ -12680,6 +13762,18 @@
 
 \(fn)" nil nil)
 
+(autoload (quote Info-goto-node) "info" "\
+Go to info node named NODENAME.  Give just NODENAME or (FILENAME)NODENAME.
+If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file
+FILENAME; otherwise, NODENAME should be in the current Info file (or one of
+its sub-files).
+Completion is available, but only for node names in the current Info file.
+If FORK is non-nil (interactively with a prefix arg), show the node in
+a new info buffer.
+If FORK is a string, it is the name to use for the new buffer.
+
+\(fn NODENAME &optional FORK)" t nil)
+
 (autoload (quote Info-directory) "info" "\
 Go to the Info directory node.
 
@@ -12687,24 +13781,29 @@
 
 (autoload (quote Info-index) "info" "\
 Look up a string TOPIC in the index for this file.
-The index is defined as the first node in the top level menu whose
-name contains the word \"Index\", plus any immediately following
-nodes whose names also contain the word \"Index\".
 If there are no exact matches to the specified topic, this chooses
 the first match which is a case-insensitive substring of a topic.
-Use the `,' command to see the other matches.
+Use the \\<Info-mode-map>\\[Info-index-next] command to see the other matches.
 Give a blank topic name to go to the Index node itself.
 
 \(fn TOPIC)" t nil)
 
+(autoload (quote info-apropos) "info" "\
+Grovel indices of all known Info files on your system for STRING.
+Build a menu of the possible matches.
+
+\(fn STRING)" t nil)
+ (put 'Info-goto-emacs-command-node 'info-file "emacs")
+
 (autoload (quote Info-goto-emacs-command-node) "info" "\
 Go to the Info node in the Emacs manual for command COMMAND.
 The command is found by looking up in Emacs manual's indices
 or in another manual found via COMMAND's `info-file' property or
-the variable `Info-file-list-for-emacs'. COMMAND must be a symbol
-or string.
+the variable `Info-file-list-for-emacs'.
+COMMAND must be a symbol or string.
 
 \(fn COMMAND)" t nil)
+ (put 'Info-goto-emacs-key-command-node 'info-file "emacs")
 
 (autoload (quote Info-goto-emacs-key-command-node) "info" "\
 Go to the node in the Emacs manual which describes the command bound to KEY.
@@ -12722,11 +13821,16 @@
 
 \(fn)" t nil)
 
+(autoload (quote Info-restore-desktop-buffer) "info" "\
+Restore an info buffer specified in a desktop file.
+
+\(fn DESKTOP-BUFFER-FILE-NAME DESKTOP-BUFFER-NAME DESKTOP-BUFFER-MISC)" nil nil)
+
 ;;;***
 
 ;;;### (autoloads (info-complete-file info-complete-symbol info-lookup-file
 ;;;;;;  info-lookup-symbol info-lookup-reset) "info-look" "info-look.el"
-;;;;;;  (16211 27017))
+;;;;;;  (16783 21520))
 ;;; Generated autoloads from info-look.el
 
 (autoload (quote info-lookup-reset) "info-look" "\
@@ -12736,6 +13840,7 @@
 system.
 
 \(fn)" t nil)
+ (put 'info-lookup-symbol 'info-file "emacs")
 
 (autoload (quote info-lookup-symbol) "info-look" "\
 Display the definition of SYMBOL, as found in the relevant manual.
@@ -12747,6 +13852,7 @@
 With prefix arg a query for the symbol help mode is offered.
 
 \(fn SYMBOL &optional MODE)" t nil)
+ (put 'info-lookup-file 'info-file "emacs")
 
 (autoload (quote info-lookup-file) "info-look" "\
 Display the documentation of a file.
@@ -12771,8 +13877,8 @@
 
 ;;;***
 
-;;;### (autoloads (info-xref-check-all info-xref-check) "info-xref"
-;;;;;;  "info-xref.el" (16211 27017))
+;;;### (autoloads (info-xref-check-all-custom info-xref-check-all
+;;;;;;  info-xref-check) "info-xref" "info-xref.el" (16484 6598))
 ;;; Generated autoloads from info-xref.el
 
 (autoload (quote info-xref-check) "info-xref" "\
@@ -12786,10 +13892,20 @@
 
 \(fn)" t nil)
 
+(autoload (quote info-xref-check-all-custom) "info-xref" "\
+Check info references in all customize groups and variables.
+`custom-manual' and `info-link' entries in the `custom-links' list are checked.
+
+`custom-load' autoloads for all symbols are loaded in order to get all the
+link information.  This will be a lot of lisp packages loaded, and can take
+quite a while.
+
+\(fn)" t nil)
+
 ;;;***
 
 ;;;### (autoloads (batch-info-validate Info-validate Info-split Info-tagify)
-;;;;;;  "informat" "informat.el" (16211 27017))
+;;;;;;  "informat" "informat.el" (16213 43269))
 ;;; Generated autoloads from informat.el
 
 (autoload (quote Info-tagify) "informat" "\
@@ -12830,7 +13946,7 @@
 
 ;;;### (autoloads (isearch-process-search-multibyte-characters isearch-toggle-input-method
 ;;;;;;  isearch-toggle-specified-input-method) "isearch-x" "international/isearch-x.el"
-;;;;;;  (16211 27032))
+;;;;;;  (16213 43274))
 ;;; Generated autoloads from international/isearch-x.el
 
 (autoload (quote isearch-toggle-specified-input-method) "isearch-x" "\
@@ -12850,8 +13966,22 @@
 
 ;;;***
 
+;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (16541
+;;;;;;  47351))
+;;; Generated autoloads from isearchb.el
+
+(autoload (quote isearchb-activate) "isearchb" "\
+Active isearchb mode for subsequent alphanumeric keystrokes.
+Executing this command again will terminate the search; or, if
+the search has not yet begun, will toggle to the last buffer
+accessed via isearchb.
+
+\(fn)" t nil)
+
+;;;***
+
 ;;;### (autoloads (iso-accents-mode) "iso-acc" "international/iso-acc.el"
-;;;;;;  (16211 27032))
+;;;;;;  (16213 43274))
 ;;; Generated autoloads from international/iso-acc.el
 
 (autoload (quote iso-accents-mode) "iso-acc" "\
@@ -12884,7 +14014,7 @@
 ;;;### (autoloads (iso-cvt-define-menu iso-cvt-write-only iso-cvt-read-only
 ;;;;;;  iso-sgml2iso iso-iso2sgml iso-iso2duden iso-iso2gtex iso-gtex2iso
 ;;;;;;  iso-tex2iso iso-iso2tex iso-german iso-spanish) "iso-cvt"
-;;;;;;  "international/iso-cvt.el" (16211 27032))
+;;;;;;  "international/iso-cvt.el" (16795 7139))
 ;;; Generated autoloads from international/iso-cvt.el
 
 (autoload (quote iso-spanish) "iso-cvt" "\
@@ -12961,14 +14091,14 @@
 \(fn)" t nil)
 
 (autoload (quote iso-cvt-define-menu) "iso-cvt" "\
-Add submenus to the Files menu, to convert to and from various formats.
+Add submenus to the File menu, to convert to and from various formats.
 
 \(fn)" t nil)
 
 ;;;***
 
 ;;;### (autoloads nil "iso-transl" "international/iso-transl.el"
-;;;;;;  (16211 27032))
+;;;;;;  (16213 43274))
 ;;; Generated autoloads from international/iso-transl.el
  (or key-translation-map (setq key-translation-map (make-sparse-keymap)))
  (define-key key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
@@ -12981,7 +14111,7 @@
 ;;;;;;  ispell-region ispell-change-dictionary ispell-kill-ispell
 ;;;;;;  ispell-help ispell-pdict-save ispell-word ispell-dictionary-alist
 ;;;;;;  ispell-local-dictionary-alist ispell-personal-dictionary)
-;;;;;;  "ispell" "textmodes/ispell.el" (16211 27044))
+;;;;;;  "ispell" "textmodes/ispell.el" (16805 44925))
 ;;; Generated autoloads from textmodes/ispell.el
 
 (defvar ispell-personal-dictionary nil "\
@@ -13013,7 +14143,7 @@
 
 (setq ispell-dictionary-alist-5 (quote (("norsk" "[A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]" "[^A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]" "[\"]" nil nil "~list" iso-8859-1) ("norsk7-tex" "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]" "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1) ("polish" "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" "" nil nil nil iso-8859-2) ("portugues" "[a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]" "[^a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]" "[']" t ("-C") "~latin1" iso-8859-1))))
 
-(setq ispell-dictionary-alist-6 (quote (("russian" "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" "[^\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" "" nil nil nil koi8-r) ("slovak" "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "" nil ("-B") nil iso-8859-2) ("svenska" "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[']" nil ("-C") "~list" iso-8859-1))))
+(setq ispell-dictionary-alist-6 (quote (("russian" "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" "[^\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" "" nil nil nil koi8-r) ("russianw" "[\300\301\302\303\304\305\250\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\334\333\332\335\336\337\340\341\342\343\344\345\270\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\374\373\372\375\376\377]" "[^\300\301\302\303\304\305\250\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\334\333\332\335\336\337\340\341\342\343\344\345\270\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\374\373\372\375\376\377]" "" nil nil nil windows-1251) ("slovak" "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "" nil ("-B") nil iso-8859-2) ("svenska" "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[']" nil ("-C") "~list" iso-8859-1))))
 
 (defvar ispell-dictionary-alist (append ispell-local-dictionary-alist 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.
@@ -13104,8 +14234,7 @@
 *Lists of start and end keys to skip in HTML buffers.
 Same format as `ispell-skip-region-alist'
 Note - substrings of other matches must come last
- (e.g. \"<[tT][tT]/\" and \"<[^ 	
->]\").")
+ (e.g. \"<[tT][tT]/\" and \"<[^ \\t\\n>]\").")
  (define-key esc-map "$" 'ispell-word)
 
 (autoload (quote ispell-word) "ispell" "\
@@ -13268,61 +14397,10 @@
 
 ;;;***
 
-;;;### (autoloads (iswitchb-mode iswitchb-buffer-other-frame iswitchb-display-buffer
-;;;;;;  iswitchb-buffer-other-window iswitchb-buffer iswitchb-default-keybindings
-;;;;;;  iswitchb-read-buffer) "iswitchb" "iswitchb.el" (16211 27017))
+;;;### (autoloads (iswitchb-mode) "iswitchb" "iswitchb.el" (16681
+;;;;;;  45592))
 ;;; Generated autoloads from iswitchb.el
 
-(autoload (quote iswitchb-read-buffer) "iswitchb" "\
-Replacement for the built-in `read-buffer'.
-Return the name of a buffer selected.
-PROMPT is the prompt to give to the user.  DEFAULT if given is the default
-buffer to be selected, which will go to the front of the list.
-If REQUIRE-MATCH is non-nil, an existing-buffer must be selected.
-
-\(fn PROMPT &optional DEFAULT REQUIRE-MATCH)" nil nil)
-
-(autoload (quote iswitchb-default-keybindings) "iswitchb" "\
-Set up default keybindings for `iswitchb-buffer'.
-Call this function to override the normal bindings.  This function also
-adds a hook to the minibuffer.
-
-Obsolescent.  Use `iswitchb-mode'.
-
-\(fn)" t nil)
-
-(autoload (quote iswitchb-buffer) "iswitchb" "\
-Switch to another buffer.
-
-The buffer name is selected interactively by typing a substring.  The
-buffer is displayed according to `iswitchb-default-method' -- the
-default is to show it in the same window, unless it is already visible
-in another frame.
-For details of keybindings, do `\\[describe-function] iswitchb'.
-
-\(fn)" t nil)
-
-(autoload (quote iswitchb-buffer-other-window) "iswitchb" "\
-Switch to another buffer and show it in another window.
-The buffer name is selected interactively by typing a substring.
-For details of keybindings, do `\\[describe-function] iswitchb'.
-
-\(fn)" t nil)
-
-(autoload (quote iswitchb-display-buffer) "iswitchb" "\
-Display a buffer in another window but don't select it.
-The buffer name is selected interactively by typing a substring.
-For details of keybindings, do `\\[describe-function] iswitchb'.
-
-\(fn)" t nil)
-
-(autoload (quote iswitchb-buffer-other-frame) "iswitchb" "\
-Switch to another buffer and show it in another frame.
-The buffer name is selected interactively by typing a substring.
-For details of keybindings, do `\\[describe-function] iswitchb'.
-
-\(fn)" t nil)
-
 (defvar iswitchb-mode nil "\
 Non-nil if Iswitchb mode is enabled.
 See the command `iswitchb-mode' for a description of this minor-mode.
@@ -13344,7 +14422,7 @@
 ;;;### (autoloads (read-hiragana-string japanese-zenkaku-region japanese-hankaku-region
 ;;;;;;  japanese-hiragana-region japanese-katakana-region japanese-zenkaku
 ;;;;;;  japanese-hankaku japanese-hiragana japanese-katakana setup-japanese-environment-internal)
-;;;;;;  "japan-util" "language/japan-util.el" (16211 27033))
+;;;;;;  "japan-util" "language/japan-util.el" (16213 43280))
 ;;; Generated autoloads from language/japan-util.el
 
 (autoload (quote setup-japanese-environment-internal) "japan-util" "\
@@ -13421,8 +14499,8 @@
 
 ;;;***
 
-;;;### (autoloads (jit-lock-register) "jit-lock" "jit-lock.el" (16211
-;;;;;;  27017))
+;;;### (autoloads (jit-lock-register) "jit-lock" "jit-lock.el" (16484
+;;;;;;  6598))
 ;;; Generated autoloads from jit-lock.el
 
 (autoload (quote jit-lock-register) "jit-lock" "\
@@ -13436,7 +14514,7 @@
 ;;;***
 
 ;;;### (autoloads (with-auto-compression-mode auto-compression-mode)
-;;;;;;  "jka-compr" "jka-compr.el" (16211 27017))
+;;;;;;  "jka-compr" "jka-compr.el" (16484 6598))
 ;;; Generated autoloads from jka-compr.el
 
 (defvar auto-compression-mode nil "\
@@ -13463,7 +14541,7 @@
 
 ;;;### (autoloads (keypad-setup keypad-numlock-shifted-setup keypad-shifted-setup
 ;;;;;;  keypad-numlock-setup keypad-setup) "keypad" "emulation/keypad.el"
-;;;;;;  (16211 27026))
+;;;;;;  (16213 43273))
 ;;; Generated autoloads from emulation/keypad.el
 
 (defvar keypad-setup nil "\
@@ -13519,7 +14597,7 @@
 ;;;***
 
 ;;;### (autoloads (kinsoku) "kinsoku" "international/kinsoku.el"
-;;;;;;  (16211 27032))
+;;;;;;  (16213 43274))
 ;;; Generated autoloads from international/kinsoku.el
 
 (autoload (quote kinsoku) "kinsoku" "\
@@ -13540,8 +14618,8 @@
 
 ;;;***
 
-;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (16211
-;;;;;;  27032))
+;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (16213
+;;;;;;  43274))
 ;;; Generated autoloads from international/kkc.el
 
 (defvar kkc-after-update-conversion-functions nil "\
@@ -13566,7 +14644,7 @@
 ;;;### (autoloads (kmacro-end-call-mouse kmacro-end-and-call-macro
 ;;;;;;  kmacro-end-or-call-macro kmacro-start-macro-or-insert-counter
 ;;;;;;  kmacro-call-macro kmacro-end-macro kmacro-start-macro) "kmacro"
-;;;;;;  "kmacro.el" (16211 27017))
+;;;;;;  "kmacro.el" (16814 63075))
 ;;; Generated autoloads from kmacro.el
  (global-set-key "\C-x(" 'kmacro-start-macro)
  (global-set-key "\C-x)" 'kmacro-end-macro)
@@ -13581,8 +14659,8 @@
 The commands are recorded even as they are executed.
 Use \\[kmacro-end-macro] to finish recording and make the macro available.
 Use \\[kmacro-end-and-call-macro] to execute the macro.
-Use \\[name-last-kbd-macro] to give it a permanent name.
-Non-nil arg (prefix arg) means append to last macro defined;
+
+Non-nil arg (prefix arg) means append to last macro defined.
 
 With \\[universal-argument] prefix, append to last keyboard macro
 defined.  Depending on `kmacro-execute-before-append', this may begin
@@ -13595,13 +14673,16 @@
 The counter value can be set or modified via \\[kmacro-set-counter] and \\[kmacro-add-counter].
 The format of the counter can be modified via \\[kmacro-set-format].
 
+Use \\[kmacro-name-last-macro] to give it a permanent name.
+Use \\[kmacro-bind-to-key] to bind it to a key sequence.
+
 \(fn ARG)" t nil)
 
 (autoload (quote kmacro-end-macro) "kmacro" "\
 Finish defining a keyboard macro.
 The definition was started by \\[kmacro-start-macro].
 The macro is now available for use via \\[kmacro-call-macro],
-or it can be given a name with \\[name-last-kbd-macro] and then invoked
+or it can be given a name with \\[kmacro-name-last-macro] and then invoked
 under that name.
 
 With numeric arg, repeat macro now that many times,
@@ -13620,7 +14701,7 @@
 for details on how to adjust or disable this behaviour.
 
 To make a macro permanent so you can call it even after defining
-others, use M-x name-last-kbd-macro.
+others, use \\[kmacro-name-last-macro].
 
 \(fn ARG &optional NO-REPEAT END-MACRO)" t nil)
 
@@ -13656,7 +14737,7 @@
 Zero argument means repeat until there is an error.
 
 To give a macro a permanent name, so you can call it
-even after defining other macros, use \\[name-last-kbd-macro].
+even after defining other macros, use \\[kmacro-name-last-macro].
 
 \(fn ARG &optional NO-REPEAT)" t nil)
 
@@ -13670,7 +14751,7 @@
 
 ;;;### (autoloads (kannada-post-read-conversion kannada-compose-string
 ;;;;;;  kannada-compose-region) "knd-util" "language/knd-util.el"
-;;;;;;  (16303 32088))
+;;;;;;  (16303 15430))
 ;;; Generated autoloads from language/knd-util.el
 
 (defconst kannada-consonant "[\x51f75-\x51fb9]")
@@ -13693,7 +14774,7 @@
 ;;;***
 
 ;;;### (autoloads (setup-korean-environment-internal) "korea-util"
-;;;;;;  "language/korea-util.el" (16211 27033))
+;;;;;;  "language/korea-util.el" (16213 43280))
 ;;; Generated autoloads from language/korea-util.el
 
 (defvar default-korean-keyboard (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) "3" "") "\
@@ -13708,7 +14789,7 @@
 ;;;***
 
 ;;;### (autoloads (lm lm-test-run) "landmark" "play/landmark.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16478 51573))
 ;;; Generated autoloads from play/landmark.el
 
 (defalias (quote landmark-repeat) (quote lm-test-run))
@@ -13742,8 +14823,8 @@
 
 ;;;### (autoloads (lao-compose-region lao-composition-function lao-post-read-conversion
 ;;;;;;  lao-transcribe-roman-to-lao-string lao-transcribe-single-roman-syllable-to-lao
-;;;;;;  lao-compose-string) "lao-util" "language/lao-util.el" (16211
-;;;;;;  27033))
+;;;;;;  lao-compose-string) "lao-util" "language/lao-util.el" (16213
+;;;;;;  43280))
 ;;; Generated autoloads from language/lao-util.el
 
 (autoload (quote lao-compose-string) "lao-util" "\
@@ -13791,7 +14872,7 @@
 ;;;***
 
 ;;;### (autoloads (latin1-display-ucs-per-lynx latin1-display latin1-display)
-;;;;;;  "latin1-disp" "international/latin1-disp.el" (16313 5697))
+;;;;;;  "latin1-disp" "international/latin1-disp.el" (16680 26004))
 ;;; Generated autoloads from international/latin1-disp.el
 
 (defvar latin1-display nil "\
@@ -13835,7 +14916,7 @@
 ;;;***
 
 ;;;### (autoloads (turn-on-lazy-lock lazy-lock-mode) "lazy-lock"
-;;;;;;  "lazy-lock.el" (16211 27017))
+;;;;;;  "lazy-lock.el" (16213 43269))
 ;;; Generated autoloads from lazy-lock.el
 
 (autoload (quote lazy-lock-mode) "lazy-lock" "\
@@ -13903,7 +14984,7 @@
 ;;;***
 
 ;;;### (autoloads (ld-script-mode) "ld-script" "progmodes/ld-script.el"
-;;;;;;  (16238 60560))
+;;;;;;  (16239 25259))
 ;;; Generated autoloads from progmodes/ld-script.el
 
 (add-to-list (quote auto-mode-alist) (quote ("\\.lds" . ld-script-mode)))
@@ -13916,7 +14997,7 @@
 ;;;***
 
 ;;;### (autoloads (ledit-from-lisp-mode ledit-mode) "ledit" "ledit.el"
-;;;;;;  (16211 27017))
+;;;;;;  (16213 43269))
 ;;; Generated autoloads from ledit.el
 
 (defconst ledit-save-files t "\
@@ -13950,7 +15031,7 @@
 
 ;;;***
 
-;;;### (autoloads (life) "life" "play/life.el" (16211 27038))
+;;;### (autoloads (life) "life" "play/life.el" (16793 54110))
 ;;; Generated autoloads from play/life.el
 
 (autoload (quote life) "life" "\
@@ -13963,8 +15044,8 @@
 
 ;;;***
 
-;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (16256
-;;;;;;  53161))
+;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (16435
+;;;;;;  26305))
 ;;; Generated autoloads from loadhist.el
 
 (autoload (quote unload-feature) "loadhist" "\
@@ -13972,14 +15053,30 @@
 If the feature is required by any other loaded code, and prefix arg FORCE
 is nil, raise an error.
 
+This function tries to undo modifications made by the package to
+hooks.  Packages may define a hook FEATURE-unload-hook that is called
+instead of the normal heuristics for doing this.  Such a hook should
+undo all the relevant global state changes that may have been made by
+loading the package or executing functions in it.  It has access to
+the package's feature list (before anything is unbound) in the
+variable `unload-hook-features-list' and could remove features from it
+in the event that the package has done something normally-ill-advised,
+such as redefining an Emacs function.
+
 \(fn FEATURE &optional FORCE)" t nil)
 
 ;;;***
 
-;;;### (autoloads (locate-with-filter locate) "locate" "locate.el"
-;;;;;;  (16211 27017))
+;;;### (autoloads (locate-with-filter locate locate-ls-subdir-switches)
+;;;;;;  "locate" "locate.el" (16580 11202))
 ;;; Generated autoloads from locate.el
 
+(defvar locate-ls-subdir-switches "-al" "\
+`ls' switches for inserting subdirectories in `*Locate*' buffers.
+This should contain the \"-l\" switch, but not the \"-F\" or \"-b\" switches.")
+
+(custom-autoload (quote locate-ls-subdir-switches) "locate")
+
 (autoload (quote locate) "locate" "\
 Run the program `locate', putting results in `*Locate*' buffer.
 With prefix arg, prompt for the locate command to run.
@@ -13996,7 +15093,7 @@
 
 ;;;***
 
-;;;### (autoloads (log-edit) "log-edit" "log-edit.el" (16258 10857))
+;;;### (autoloads (log-edit) "log-edit" "log-edit.el" (16680 26002))
 ;;; Generated autoloads from log-edit.el
 
 (autoload (quote log-edit) "log-edit" "\
@@ -14017,8 +15114,8 @@
 
 ;;;***
 
-;;;### (autoloads (log-view-mode) "log-view" "log-view.el" (16211
-;;;;;;  27017))
+;;;### (autoloads (log-view-mode) "log-view" "log-view.el" (16534
+;;;;;;  3808))
 ;;; Generated autoloads from log-view.el
 
 (autoload (quote log-view-mode) "log-view" "\
@@ -14029,8 +15126,8 @@
 ;;;***
 
 ;;;### (autoloads (print-region lpr-region print-buffer lpr-buffer
-;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (16211
-;;;;;;  27017))
+;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (16213
+;;;;;;  43269))
 ;;; Generated autoloads from lpr.el
 
 (defvar lpr-windows-system (memq system-type (quote (emx win32 w32 mswindows ms-dos windows-nt))))
@@ -14124,7 +15221,7 @@
 ;;;***
 
 ;;;### (autoloads (ls-lisp-support-shell-wildcards) "ls-lisp" "ls-lisp.el"
-;;;;;;  (16277 42321))
+;;;;;;  (16727 56921))
 ;;; Generated autoloads from ls-lisp.el
 
 (defvar ls-lisp-support-shell-wildcards t "\
@@ -14135,8 +15232,8 @@
 
 ;;;***
 
-;;;### (autoloads (phases-of-moon) "lunar" "calendar/lunar.el" (16211
-;;;;;;  27023))
+;;;### (autoloads (phases-of-moon) "lunar" "calendar/lunar.el" (16213
+;;;;;;  43272))
 ;;; Generated autoloads from calendar/lunar.el
 
 (autoload (quote phases-of-moon) "lunar" "\
@@ -14149,8 +15246,8 @@
 
 ;;;***
 
-;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (16211
-;;;;;;  27039))
+;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (16213
+;;;;;;  43282))
 ;;; Generated autoloads from progmodes/m4-mode.el
 
 (autoload (quote m4-mode) "m4-mode" "\
@@ -14161,8 +15258,22 @@
 
 ;;;***
 
+;;;### (autoloads (macroexpand-all) "macroexp" "emacs-lisp/macroexp.el"
+;;;;;;  (16424 14687))
+;;; Generated autoloads from emacs-lisp/macroexp.el
+
+(autoload (quote macroexpand-all) "macroexp" "\
+Return result of expanding macros at all levels in FORM.
+If no macros are expanded, FORM is returned unchanged.
+The second optional arg ENVIRONMENT specifies an environment of macro
+definitions to shadow the loaded ones for use in file byte-compilation.
+
+\(fn FORM &optional ENVIRONMENT)" nil nil)
+
+;;;***
+
 ;;;### (autoloads (apply-macro-to-region-lines kbd-macro-query insert-kbd-macro
-;;;;;;  name-last-kbd-macro) "macros" "macros.el" (16211 27017))
+;;;;;;  name-last-kbd-macro) "macros" "macros.el" (16810 63790))
 ;;; Generated autoloads from macros.el
 
 (autoload (quote name-last-kbd-macro) "macros" "\
@@ -14205,8 +15316,9 @@
 \(fn FLAG)" t nil)
 
 (autoload (quote apply-macro-to-region-lines) "macros" "\
-For each complete line between point and mark, move to the beginning
-of the line, and run the last keyboard macro.
+Apply last keyboard macro to all lines in the region.
+For each line that begins in the region, move to the beginning of
+the line, and run the last keyboard macro.
 
 When called from lisp, this function takes two arguments TOP and
 BOTTOM, describing the current region.  TOP must be before BOTTOM.
@@ -14250,14 +15362,14 @@
 ;;;***
 
 ;;;### (autoloads (what-domain mail-extract-address-components) "mail-extr"
-;;;;;;  "mail/mail-extr.el" (16281 48394))
+;;;;;;  "mail/mail-extr.el" (16746 18215))
 ;;; Generated autoloads from mail/mail-extr.el
 
 (autoload (quote mail-extract-address-components) "mail-extr" "\
 Given an RFC-822 address ADDRESS, extract full name and canonical address.
 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).
 If no name can be extracted, FULL-NAME will be nil.  Also see
-`mail-extr-ignore-single-names'.
+`mail-extr-ignore-single-names' and `mail-extr-ignore-realname-equals-mailbox-name'.
 
 If the optional argument ALL is non-nil, then ADDRESS can contain zero
 or more recipients, separated by commas, and we return a list of
@@ -14281,7 +15393,7 @@
 
 ;;;### (autoloads (mail-hist-put-headers-into-history mail-hist-keep-history
 ;;;;;;  mail-hist-enable mail-hist-define-keys) "mail-hist" "mail/mail-hist.el"
-;;;;;;  (16211 27033))
+;;;;;;  (16213 43280))
 ;;; Generated autoloads from mail/mail-hist.el
 
 (autoload (quote mail-hist-define-keys) "mail-hist" "\
@@ -14312,8 +15424,8 @@
 
 ;;;### (autoloads (mail-fetch-field mail-unquote-printable-region
 ;;;;;;  mail-unquote-printable mail-quote-printable mail-file-babyl-p
-;;;;;;  mail-use-rfc822) "mail-utils" "mail/mail-utils.el" (16211
-;;;;;;  27033))
+;;;;;;  mail-use-rfc822) "mail-utils" "mail/mail-utils.el" (16456
+;;;;;;  21757))
 ;;; Generated autoloads from mail/mail-utils.el
 
 (defvar mail-use-rfc822 nil "\
@@ -14346,8 +15458,12 @@
 Undo the \"quoted printable\" encoding in buffer from BEG to END.
 If the optional argument WRAPPER is non-nil,
 we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=.
-
-\(fn BEG END &optional WRAPPER)" t nil)
+If NOERROR is non-nil, return t if successful.
+If UNIBYTE is non-nil, insert converted characters as unibyte.
+That is useful if you are going to character code decoding afterward,
+as Rmail does.
+
+\(fn BEG END &optional WRAPPER NOERROR UNIBYTE)" t nil)
 
 (autoload (quote mail-fetch-field) "mail-utils" "\
 Return the value of the header field whose type is FIELD-NAME.
@@ -14361,7 +15477,7 @@
 ;;;***
 
 ;;;### (autoloads (define-mail-abbrev build-mail-abbrevs mail-abbrevs-setup)
-;;;;;;  "mailabbrev" "mail/mailabbrev.el" (16249 31429))
+;;;;;;  "mailabbrev" "mail/mailabbrev.el" (16250 35353))
 ;;; Generated autoloads from mail/mailabbrev.el
 
 (autoload (quote mail-abbrevs-setup) "mailabbrev" "\
@@ -14384,8 +15500,8 @@
 ;;;***
 
 ;;;### (autoloads (mail-complete define-mail-alias expand-mail-aliases
-;;;;;;  mail-complete-style) "mailalias" "mail/mailalias.el" (16211
-;;;;;;  27034))
+;;;;;;  mail-complete-style) "mailalias" "mail/mailalias.el" (16213
+;;;;;;  43280))
 ;;; Generated autoloads from mail/mailalias.el
 
 (defvar mail-complete-style (quote angles) "\
@@ -14431,7 +15547,7 @@
 ;;;***
 
 ;;;### (autoloads (makefile-mode) "make-mode" "progmodes/make-mode.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16719 60888))
 ;;; Generated autoloads from progmodes/make-mode.el
 
 (autoload (quote makefile-mode) "make-mode" "\
@@ -14512,8 +15628,8 @@
 
 ;;;***
 
-;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (16211
-;;;;;;  27017))
+;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (16213
+;;;;;;  43269))
 ;;; Generated autoloads from makesum.el
 
 (autoload (quote make-command-summary) "makesum" "\
@@ -14524,7 +15640,7 @@
 
 ;;;***
 
-;;;### (autoloads (man-follow man) "man" "man.el" (16246 39964))
+;;;### (autoloads (man-follow man) "man" "man.el" (16816 23724))
 ;;; Generated autoloads from man.el
 
 (defalias (quote manual-entry) (quote man))
@@ -14551,7 +15667,7 @@
 
 ;;;***
 
-;;;### (autoloads (master-mode) "master" "master.el" (16211 27017))
+;;;### (autoloads (master-mode) "master" "master.el" (16213 43269))
 ;;; Generated autoloads from master.el
 
 (autoload (quote master-mode) "master" "\
@@ -14573,8 +15689,8 @@
 
 ;;;***
 
-;;;### (autoloads (menu-bar-mode) "menu-bar" "menu-bar.el" (16211
-;;;;;;  37994))
+;;;### (autoloads (menu-bar-mode) "menu-bar" "menu-bar.el" (16810
+;;;;;;  63790))
 ;;; Generated autoloads from menu-bar.el
 
 (put (quote menu-bar-mode) (quote standard-value) (quote (t)))
@@ -14603,11 +15719,18 @@
 ;;;;;;  message-bounce message-resend message-insinuate-rmail message-forward-rmail-make-body
 ;;;;;;  message-forward-make-body message-forward message-recover
 ;;;;;;  message-supersede message-cancel-news message-followup message-wide-reply
-;;;;;;  message-reply message-news message-mail message-mode message-signature-file
+;;;;;;  message-reply message-news message-mail message-mode message-reduce-to-to-cc
+;;;;;;  message-cross-post-followup-to message-cross-post-insert-note
+;;;;;;  message-cross-post-followup-to-header message-add-archive-header
+;;;;;;  message-mark-insert-file message-mark-inserted-region message-change-subject
+;;;;;;  message-signature-insert-empty-line message-signature-file
 ;;;;;;  message-signature message-indent-citation-function message-cite-function
 ;;;;;;  message-yank-prefix message-citation-line-function message-send-mail-function
 ;;;;;;  message-user-organization-file message-signature-separator
-;;;;;;  message-from-style) "message" "gnus/message.el" (16211 27028))
+;;;;;;  message-cross-post-note-function message-followup-to-note
+;;;;;;  message-cross-post-note message-cross-post-default message-archive-note
+;;;;;;  message-archive-header message-mark-insert-end message-mark-insert-begin
+;;;;;;  message-from-style) "message" "gnus/message.el" (16775 26713))
 ;;; Generated autoloads from gnus/message.el
 
 (defvar message-from-style (quote default) "\
@@ -14625,6 +15748,54 @@
 
 (custom-autoload (quote message-from-style) "message")
 
+(defvar message-mark-insert-begin "--8<---------------cut here---------------start------------->8---\n" "\
+How to mark the beginning of some inserted text.")
+
+(custom-autoload (quote message-mark-insert-begin) "message")
+
+(defvar message-mark-insert-end "--8<---------------cut here---------------end--------------->8---\n" "\
+How to mark the end of some inserted text.")
+
+(custom-autoload (quote message-mark-insert-end) "message")
+
+(defvar message-archive-header "X-No-Archive: Yes\n" "\
+Header to insert when you don't want your article to be archived.
+Archives (such as groups.google.com) respect this header.")
+
+(custom-autoload (quote message-archive-header) "message")
+
+(defvar message-archive-note "X-No-Archive: Yes - save http://groups.google.com/" "\
+Note to insert why you wouldn't want this posting archived.
+If nil, don't insert any text in the body.")
+
+(custom-autoload (quote message-archive-note) "message")
+
+(defvar message-cross-post-default t "\
+When non-nil `message-cross-post-followup-to' will perform a crosspost.
+If nil, `message-cross-post-followup-to' will only do a followup.  Note that
+you can explicitly override this setting by calling
+`message-cross-post-followup-to' with a prefix.")
+
+(custom-autoload (quote message-cross-post-default) "message")
+
+(defvar message-cross-post-note "Crosspost & Followup-To: " "\
+Note to insert before signature to notify of cross-post and follow-up.")
+
+(custom-autoload (quote message-cross-post-note) "message")
+
+(defvar message-followup-to-note "Followup-To: " "\
+Note to insert before signature to notify of follow-up only.")
+
+(custom-autoload (quote message-followup-to-note) "message")
+
+(defvar message-cross-post-note-function (quote message-cross-post-insert-note) "\
+Function to use to insert note about Crosspost or Followup-To.
+The function will be called with four arguments.  The function should not only
+insert a note, but also ensure old notes are deleted.  See the documentation
+for `message-cross-post-insert-note'.")
+
+(custom-autoload (quote message-cross-post-note-function) "message")
+
 (defvar message-signature-separator "^-- *$" "\
 Regexp matching the signature separator.")
 
@@ -14642,19 +15813,26 @@
 
 Valid values include `message-send-mail-with-sendmail' (the default),
 `message-send-mail-with-mh', `message-send-mail-with-qmail',
-`smtpmail-send-it' and `feedmail-send-it'.
+`message-smtpmail-send-it', `smtpmail-send-it' and `feedmail-send-it'.
 
 See also `send-mail-function'.")
 
 (custom-autoload (quote message-send-mail-function) "message")
 
 (defvar message-citation-line-function (quote message-insert-citation-line) "\
-*Function called to insert the \"Whomever writes:\" line.")
+*Function called to insert the \"Whomever writes:\" line.
+
+Note that Gnus provides a feature where the reader can click on
+`writes:' to hide the cited text.  If you change this line too much,
+people who read your message will have to change their Gnus
+configuration.  See the variable `gnus-cite-attribution-suffix'.")
 
 (custom-autoload (quote message-citation-line-function) "message")
 
 (defvar message-yank-prefix "> " "\
-*Prefix inserted on the lines of yanked messages.")
+*Prefix inserted on the lines of yanked messages.
+Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
+See also `message-yank-cited-prefix'.")
 
 (custom-autoload (quote message-yank-prefix) "message")
 
@@ -14689,8 +15867,65 @@
 
 (custom-autoload (quote message-signature-file) "message")
 
+(defvar message-signature-insert-empty-line t "\
+*If non-nil, insert an empty line before the signature separator.")
+
+(custom-autoload (quote message-signature-insert-empty-line) "message")
+
 (define-mail-user-agent (quote message-user-agent) (quote message-mail) (quote message-send-and-exit) (quote message-kill-buffer) (quote message-send-hook))
 
+(autoload (quote message-change-subject) "message" "\
+Ask for NEW-SUBJECT header, append (was: <Old Subject>).
+
+\(fn NEW-SUBJECT)" t nil)
+
+(autoload (quote message-mark-inserted-region) "message" "\
+Mark some region in the current article with enclosing tags.
+See `message-mark-insert-begin' and `message-mark-insert-end'.
+
+\(fn BEG END)" t nil)
+
+(autoload (quote message-mark-insert-file) "message" "\
+Insert FILE at point, marking it with enclosing tags.
+See `message-mark-insert-begin' and `message-mark-insert-end'.
+
+\(fn FILE)" t nil)
+
+(autoload (quote message-add-archive-header) "message" "\
+Insert \"X-No-Archive: Yes\" in the header and a note in the body.
+The note can be customized using `message-archive-note'.  When called with a
+prefix argument, ask for a text to insert.  If you don't want the note in the
+body, set  `message-archive-note' to nil.
+
+\(fn)" t nil)
+
+(autoload (quote message-cross-post-followup-to-header) "message" "\
+Mangles FollowUp-To and Newsgroups header to point to TARGET-GROUP.
+With prefix-argument just set Follow-Up, don't cross-post.
+
+\(fn TARGET-GROUP)" t nil)
+
+(autoload (quote message-cross-post-insert-note) "message" "\
+Insert a in message body note about a set Followup or Crosspost.
+If there have been previous notes, delete them.  TARGET-GROUP specifies the
+group to Followup-To.  When CROSS-POST is t, insert note about
+crossposting.  IN-OLD specifies whether TARGET-GROUP is a member of
+OLD-GROUPS.  OLD-GROUPS lists the old-groups the posting would have
+been made to before the user asked for a Crosspost.
+
+\(fn TARGET-GROUP CROSS-POST IN-OLD OLD-GROUPS)" nil nil)
+
+(autoload (quote message-cross-post-followup-to) "message" "\
+Crossposts message and set Followup-To to TARGET-GROUP.
+With prefix-argument just set Follow-Up, don't cross-post.
+
+\(fn TARGET-GROUP)" t nil)
+
+(autoload (quote message-reduce-to-to-cc) "message" "\
+Replace contents of To: header with contents of Cc: or Bcc: header.
+
+\(fn)" t nil)
+
 (autoload (quote message-mode) "message" "\
 Major mode for editing mail and news to be sent.
 Like Text Mode but with these additional commands:\\<message-mode-map>
@@ -14702,8 +15937,16 @@
 	 C-c C-f C-w  move to Fcc	C-c C-f C-r  move to Reply-To
 	 C-c C-f C-u  move to Summary	C-c C-f C-n  move to Newsgroups
 	 C-c C-f C-k  move to Keywords	C-c C-f C-d  move to Distribution
+         C-c C-f C-o  move to From (\"Originator\")
 	 C-c C-f C-f  move to Followup-To
+	 C-c C-f C-m  move to Mail-Followup-To
+	 C-c C-f C-i  cycle through Importance values
+	 C-c C-f s    change subject and append \"(was: <Old Subject>)\"
+	 C-c C-f x    crossposting with FollowUp-To header and note in body
+	 C-c C-f t    replace To: header with contents of Cc: or Bcc:
+	 C-c C-f a    Insert X-No-Archive: header and a note in the body
 C-c C-t  `message-insert-to' (add a To header to a news followup)
+C-c C-l  `message-to-list-only' (removes all but list address in to/cc)
 C-c C-n  `message-insert-newsgroups' (add a Newsgroup header to a news reply)
 C-c C-b  `message-goto-body' (move to beginning of message text).
 C-c C-i  `message-goto-signature' (move to the beginning of the signature).
@@ -14715,6 +15958,10 @@
 C-c C-z  `message-kill-to-signature' (kill the text up to the signature).
 C-c C-r  `message-caesar-buffer-body' (rot13 the message body).
 C-c C-a  `mml-attach-file' (attach a file as MIME).
+C-c C-u  `message-insert-or-toggle-importance'  (insert or cycle importance).
+C-c M-n  `message-insert-disposition-notification-to'  (request receipt).
+C-c M-m  `message-mark-inserted-region' (mark region with enclosing tags).
+C-c M-f  `message-mark-insert-file' (insert file marked with enclosing tags).
 M-RET    `message-newline-and-reformat' (break the line and reformat).
 
 \(fn)" t nil)
@@ -14782,7 +16029,7 @@
 \(fn FORWARD-BUFFER)" nil nil)
 
 (autoload (quote message-insinuate-rmail) "message" "\
-Let RMAIL uses message to forward.
+Let RMAIL use message to forward.
 
 \(fn)" t nil)
 
@@ -14837,7 +16084,7 @@
 ;;;***
 
 ;;;### (autoloads (metapost-mode metafont-mode) "meta-mode" "progmodes/meta-mode.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16681 45593))
 ;;; Generated autoloads from progmodes/meta-mode.el
 
 (autoload (quote metafont-mode) "meta-mode" "\
@@ -14864,7 +16111,7 @@
 
 ;;;### (autoloads (metamail-region metamail-buffer metamail-interpret-body
 ;;;;;;  metamail-interpret-header) "metamail" "mail/metamail.el"
-;;;;;;  (16211 27034))
+;;;;;;  (16507 41097))
 ;;; Generated autoloads from mail/metamail.el
 
 (autoload (quote metamail-interpret-header) "metamail" "\
@@ -14908,26 +16155,26 @@
 ;;;***
 
 ;;;### (autoloads (mh-letter-mode mh-smail-other-window mh-user-agent-compose
-;;;;;;  mh-smail-batch mh-smail) "mh-comp" "mh-e/mh-comp.el" (16211
-;;;;;;  27036))
+;;;;;;  mh-smail-batch mh-smail) "mh-comp" "mh-e/mh-comp.el" (16684
+;;;;;;  26435))
 ;;; Generated autoloads from mh-e/mh-comp.el
 
 (autoload (quote mh-smail) "mh-comp" "\
 Compose and send mail with the MH mail system.
-This function is an entry point to MH-E, the Emacs front end
-to the MH mail system.
-
-See documentation of `\\[mh-send]' for more details on composing mail.
+This function is an entry point to MH-E, the Emacs interface to the MH mail
+system.
+
+See `mh-send' for more details on composing mail.
 
 \(fn)" t nil)
 
 (autoload (quote mh-smail-batch) "mh-comp" "\
 Set up a mail composition draft with the MH mail system.
-This function is an entry point to MH-E, the Emacs front end
-to the MH mail system.  This function does not prompt the user
-for any header fields, and thus is suitable for use by programs
-that want to create a mail buffer.
-Users should use `\\[mh-smail]' to compose mail.
+This function is an entry point to MH-E, the Emacs interface to the MH mail
+system. This function does not prompt the user for any header fields, and thus
+is suitable for use by programs that want to create a mail buffer. Users
+should use `mh-smail' to compose mail.
+
 Optional arguments for setting certain fields include TO, SUBJECT, and
 OTHER-HEADERS. Additional arguments are IGNORED.
 
@@ -14950,10 +16197,10 @@
 
 (autoload (quote mh-smail-other-window) "mh-comp" "\
 Compose and send mail in other window with the MH mail system.
-This function is an entry point to MH-E, the Emacs front end
-to the MH mail system.
-
-See documentation of `\\[mh-send]' for more details on composing mail.
+This function is an entry point to MH-E, the Emacs interface to the MH mail
+system.
+
+See `mh-send' for more details on composing mail.
 
 \(fn)" t nil)
 
@@ -14984,21 +16231,21 @@
 
 ;;;***
 
-;;;### (autoloads (mh-version mh-nmail mh-rmail) "mh-e" "mh-e/mh-e.el"
-;;;;;;  (16211 27037))
+;;;### (autoloads (mh-restore-desktop-buffer mh-version mh-nmail
+;;;;;;  mh-rmail) "mh-e" "mh-e/mh-e.el" (16684 26435))
 ;;; Generated autoloads from mh-e/mh-e.el
 
 (autoload (quote mh-rmail) "mh-e" "\
 Inc(orporate) new mail with MH.
 Scan an MH folder if ARG is non-nil. This function is an entry point to MH-E,
-the Emacs front end to the MH mail system.
+the Emacs interface to the MH mail system.
 
 \(fn &optional ARG)" t nil)
 
 (autoload (quote mh-nmail) "mh-e" "\
 Check for new mail in inbox folder.
 Scan an MH folder if ARG is non-nil. This function is an entry point to MH-E,
-the Emacs front end to the MH mail system.
+the Emacs interface to the MH mail system.
 
 \(fn &optional ARG)" t nil)
 
@@ -15007,10 +16254,19 @@
 
 \(fn)" t nil)
 
-;;;***
-
-;;;### (autoloads nil "mh-utils" "mh-e/mh-utils.el" (16211 27037))
-;;; Generated autoloads from mh-e/mh-utils.el
+(autoload (quote mh-restore-desktop-buffer) "mh-e" "\
+Restore an MH folder buffer specified in a desktop file.
+When desktop creates a buffer, DESKTOP-BUFFER-FILE-NAME holds the file name to
+visit, DESKTOP-BUFFER-NAME holds the desired buffer name, and
+DESKTOP-BUFFER-MISC holds a list of miscellaneous info used by the
+`desktop-buffer-handlers' functions.
+
+\(fn DESKTOP-BUFFER-FILE-NAME DESKTOP-BUFFER-NAME DESKTOP-BUFFER-MISC)" nil nil)
+
+;;;***
+
+;;;### (autoloads nil "mh-init" "mh-e/mh-init.el" (16684 26435))
+;;; Generated autoloads from mh-e/mh-init.el
 
 (put (quote mh-progs) (quote risky-local-variable) t)
 
@@ -15018,12 +16274,10 @@
 
 (put (quote mh-lib-progs) (quote risky-local-variable) t)
 
-(put (quote mh-nmh-flag) (quote risky-local-variable) t)
-
 ;;;***
 
 ;;;### (autoloads (midnight-delay-set clean-buffer-list) "midnight"
-;;;;;;  "midnight.el" (16211 27017))
+;;;;;;  "midnight.el" (16423 23568))
 ;;; Generated autoloads from midnight.el
 
 (autoload (quote clean-buffer-list) "midnight" "\
@@ -15050,7 +16304,7 @@
 ;;;***
 
 ;;;### (autoloads (minibuffer-electric-default-mode) "minibuf-eldef"
-;;;;;;  "minibuf-eldef.el" (16211 27017))
+;;;;;;  "minibuf-eldef.el" (16575 1356))
 ;;; Generated autoloads from minibuf-eldef.el
 
 (defvar minibuffer-electric-default-mode nil "\
@@ -15077,7 +16331,7 @@
 ;;;***
 
 ;;;### (autoloads (mixal-mode) "mixal-mode" "progmodes/mixal-mode.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16213 43282))
 ;;; Generated autoloads from progmodes/mixal-mode.el
 
 (autoload (quote mixal-mode) "mixal-mode" "\
@@ -15092,7 +16346,7 @@
 
 ;;;### (autoloads (malayalam-composition-function malayalam-post-read-conversion
 ;;;;;;  malayalam-compose-region) "mlm-util" "language/mlm-util.el"
-;;;;;;  (16232 560))
+;;;;;;  (16233 29568))
 ;;; Generated autoloads from language/mlm-util.el
 
 (autoload (quote malayalam-compose-region) "mlm-util" "\
@@ -15114,8 +16368,22 @@
 
 ;;;***
 
+;;;### (autoloads (mm-inline-external-body) "mm-extern" "gnus/mm-extern.el"
+;;;;;;  (16697 49031))
+;;; Generated autoloads from gnus/mm-extern.el
+
+(autoload (quote mm-inline-external-body) "mm-extern" "\
+Show the external-body part of HANDLE.
+This function replaces the buffer of HANDLE with a buffer contains
+the entire message.
+If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing.
+
+\(fn HANDLE &optional NO-DISPLAY)" nil nil)
+
+;;;***
+
 ;;;### (autoloads (mm-inline-partial) "mm-partial" "gnus/mm-partial.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16698 21928))
 ;;; Generated autoloads from gnus/mm-partial.el
 
 (autoload (quote mm-inline-partial) "mm-partial" "\
@@ -15128,8 +16396,25 @@
 
 ;;;***
 
-;;;### (autoloads (mm-uu-test mm-uu-dissect) "mm-uu" "gnus/mm-uu.el"
-;;;;;;  (16211 27028))
+;;;### (autoloads (mm-url-insert-file-contents-external mm-url-insert-file-contents)
+;;;;;;  "mm-url" "gnus/mm-url.el" (16775 26713))
+;;; Generated autoloads from gnus/mm-url.el
+
+(autoload (quote mm-url-insert-file-contents) "mm-url" "\
+Insert file contents of URL.
+If `mm-url-use-external' is non-nil, use `mm-url-program'.
+
+\(fn URL)" nil nil)
+
+(autoload (quote mm-url-insert-file-contents-external) "mm-url" "\
+Insert file contents of URL using `mm-url-program'.
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (mm-uu-dissect) "mm-uu" "gnus/mm-uu.el" (16775
+;;;;;;  26713))
 ;;; Generated autoloads from gnus/mm-uu.el
 
 (autoload (quote mm-uu-dissect) "mm-uu" "\
@@ -15137,15 +16422,68 @@
 
 \(fn)" nil nil)
 
-(autoload (quote mm-uu-test) "mm-uu" "\
-Check whether the current buffer contains uu stuff.
+;;;***
+
+;;;### (autoloads (mml1991-sign mml1991-encrypt) "mml1991" "gnus/mml1991.el"
+;;;;;;  (16697 49031))
+;;; Generated autoloads from gnus/mml1991.el
+
+(autoload (quote mml1991-encrypt) "mml1991" "\
+Not documented
+
+\(fn CONT &optional SIGN)" nil nil)
+
+(autoload (quote mml1991-sign) "mml1991" "\
+Not documented
+
+\(fn CONT)" nil nil)
+
+;;;***
+
+;;;### (autoloads (mml2015-self-encrypt mml2015-sign mml2015-encrypt
+;;;;;;  mml2015-verify-test mml2015-verify mml2015-decrypt-test mml2015-decrypt)
+;;;;;;  "mml2015" "gnus/mml2015.el" (16775 26713))
+;;; Generated autoloads from gnus/mml2015.el
+
+(autoload (quote mml2015-decrypt) "mml2015" "\
+Not documented
+
+\(fn HANDLE CTL)" nil nil)
+
+(autoload (quote mml2015-decrypt-test) "mml2015" "\
+Not documented
+
+\(fn HANDLE CTL)" nil nil)
+
+(autoload (quote mml2015-verify) "mml2015" "\
+Not documented
+
+\(fn HANDLE CTL)" nil nil)
+
+(autoload (quote mml2015-verify-test) "mml2015" "\
+Not documented
+
+\(fn HANDLE CTL)" nil nil)
+
+(autoload (quote mml2015-encrypt) "mml2015" "\
+Not documented
+
+\(fn CONT &optional SIGN)" nil nil)
+
+(autoload (quote mml2015-sign) "mml2015" "\
+Not documented
+
+\(fn CONT)" nil nil)
+
+(autoload (quote mml2015-self-encrypt) "mml2015" "\
+Not documented
 
 \(fn)" nil nil)
 
 ;;;***
 
 ;;;### (autoloads (modula-2-mode) "modula2" "progmodes/modula2.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16213 43282))
 ;;; Generated autoloads from progmodes/modula2.el
 
 (autoload (quote modula-2-mode) "modula2" "\
@@ -15177,7 +16515,7 @@
 ;;;***
 
 ;;;### (autoloads (unmorse-region morse-region) "morse" "play/morse.el"
-;;;;;;  (16211 27038))
+;;;;;;  (16442 4954))
 ;;; Generated autoloads from play/morse.el
 
 (autoload (quote morse-region) "morse" "\
@@ -15192,8 +16530,8 @@
 
 ;;;***
 
-;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (16211
-;;;;;;  27017))
+;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (16770
+;;;;;;  10720))
 ;;; Generated autoloads from mouse-sel.el
 
 (defvar mouse-sel-mode nil "\
@@ -15244,7 +16582,7 @@
 
 ;;;***
 
-;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (16211 27038))
+;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (16213 43281))
 ;;; Generated autoloads from play/mpuz.el
 
 (autoload (quote mpuz) "mpuz" "\
@@ -15254,7 +16592,7 @@
 
 ;;;***
 
-;;;### (autoloads (msb-mode) "msb" "msb.el" (16211 27017))
+;;;### (autoloads (msb-mode) "msb" "msb.el" (16764 51518))
 ;;; Generated autoloads from msb.el
 
 (defvar msb-mode nil "\
@@ -15280,7 +16618,7 @@
 ;;;;;;  describe-current-coding-system describe-current-coding-system-briefly
 ;;;;;;  describe-coding-system describe-character-set list-charset-chars
 ;;;;;;  read-charset list-character-sets) "mule-diag" "international/mule-diag.el"
-;;;;;;  (16259 31301))
+;;;;;;  (16515 33869))
 ;;; Generated autoloads from international/mule-diag.el
 
 (defvar non-iso-charset-alist (\` ((mac-roman (ascii latin-iso8859-1 mule-unicode-2500-33ff mule-unicode-0100-24ff mule-unicode-e000-ffff) mac-roman-decoder ((0 255))) (viscii (ascii vietnamese-viscii-lower vietnamese-viscii-upper) viet-viscii-nonascii-translation-table ((0 255))) (vietnamese-tcvn (ascii vietnamese-viscii-lower vietnamese-viscii-upper) viet-tcvn-nonascii-translation-table ((0 255))) (koi8-r (ascii cyrillic-iso8859-5) cyrillic-koi8-r-nonascii-translation-table ((32 255))) (alternativnyj (ascii cyrillic-iso8859-5) cyrillic-alternativnyj-nonascii-translation-table ((32 255))) (koi8-u (ascii cyrillic-iso8859-5 mule-unicode-0100-24ff) cyrillic-koi8-u-nonascii-translation-table ((32 255))) (big5 (ascii chinese-big5-1 chinese-big5-2) decode-big5-char ((32 127) ((161 254) 64 126 161 254))) (sjis (ascii katakana-jisx0201 japanese-jisx0208) decode-sjis-char ((32 127 161 223) ((129 159 224 239) 64 126 128 252))))) "\
@@ -15449,11 +16787,11 @@
 ;;;***
 
 ;;;### (autoloads (char-displayable-p detect-coding-with-language-environment
-;;;;;;  detect-coding-with-priority coding-system-equal coding-system-translation-table-for-encode
+;;;;;;  detect-coding-with-priority coding-system-translation-table-for-encode
 ;;;;;;  coding-system-translation-table-for-decode coding-system-pre-write-conversion
 ;;;;;;  coding-system-post-read-conversion lookup-nested-alist set-nested-alist
 ;;;;;;  truncate-string-to-width store-substring string-to-sequence)
-;;;;;;  "mule-util" "international/mule-util.el" (16211 37839))
+;;;;;;  "mule-util" "international/mule-util.el" (16747 61767))
 ;;; Generated autoloads from international/mule-util.el
 
 (autoload (quote string-to-sequence) "mule-util" "\
@@ -15560,13 +16898,6 @@
 
 \(fn CODING-SYSTEM)" nil nil)
 
-(autoload (quote coding-system-equal) "mule-util" "\
-Return t if and only if CODING-SYSTEM-1 and CODING-SYSTEM-2 are identical.
-Two coding systems are identical if two symbols are equal
-or one is an alias of the other.
-
-\(fn CODING-SYSTEM-1 CODING-SYSTEM-2)" nil nil)
-
 (autoload (quote detect-coding-with-priority) "mule-util" "\
 Detect a coding system of the text between FROM and TO with PRIORITY-LIST.
 PRIORITY-LIST is an alist of coding categories vs the corresponding
@@ -15593,7 +16924,7 @@
 ;;;***
 
 ;;;### (autoloads (mwheel-install mouse-wheel-mode) "mwheel" "mwheel.el"
-;;;;;;  (16211 27017))
+;;;;;;  (16788 34909))
 ;;; Generated autoloads from mwheel.el
 
 (defvar mouse-wheel-mode nil "\
@@ -15621,7 +16952,7 @@
 ;;;### (autoloads (network-connection network-connection-to-service
 ;;;;;;  whois-reverse-lookup whois finger ftp dig dns-lookup-host
 ;;;;;;  nslookup nslookup-host route arp netstat ipconfig ping traceroute)
-;;;;;;  "net-utils" "net/net-utils.el" (16211 27037))
+;;;;;;  "net-utils" "net/net-utils.el" (16719 60888))
 ;;; Generated autoloads from net/net-utils.el
 
 (autoload (quote traceroute) "net-utils" "\
@@ -15712,11 +17043,12 @@
 
 ;;;***
 
-;;;### (autoloads (comment-indent-new-line comment-dwim comment-or-uncomment-region
-;;;;;;  comment-region uncomment-region comment-kill comment-set-column
-;;;;;;  comment-indent comment-indent-default comment-normalize-vars
-;;;;;;  comment-multi-line comment-padding comment-style comment-column)
-;;;;;;  "newcomment" "newcomment.el" (16281 48394))
+;;;### (autoloads (comment-indent-new-line comment-auto-fill-only-comments
+;;;;;;  comment-dwim comment-or-uncomment-region comment-region uncomment-region
+;;;;;;  comment-kill comment-set-column comment-indent comment-indent-default
+;;;;;;  comment-normalize-vars comment-multi-line comment-padding
+;;;;;;  comment-style comment-column) "newcomment" "newcomment.el"
+;;;;;;  (16764 51518))
 ;;; Generated autoloads from newcomment.el
 
 (defalias (quote indent-for-comment) (quote comment-indent))
@@ -15765,6 +17097,13 @@
 column indentation or nil.
 If nil is returned, indentation is delegated to `indent-according-to-mode'.")
 
+(defvar comment-insert-comment-function nil "\
+Function to insert a comment when a line doesn't contain one.
+The function has no args.
+
+Applicable at least in modes for languages like fixed-format Fortran where
+comments always start in column zero.")
+
 (defvar comment-style (quote plain) "\
 *Style to be used for `comment-region'.
 See `comment-styles' for a list of available styles.")
@@ -15782,8 +17121,13 @@
 (custom-autoload (quote comment-padding) "newcomment")
 
 (defvar comment-multi-line nil "\
-*Non-nil means \\[comment-indent-new-line] continues comments, with no new terminator or starter.
-This is obsolete because you might as well use \\[newline-and-indent].")
+*Non-nil means `comment-indent-new-line' continues comments.
+That is, it inserts no new terminator or starter.
+This affects `auto-fill-mode', which is the main reason to
+customize this variable.
+
+It also affects \\[indent-new-comment-line].  However, if you want this
+behavior for explicit filling, you might as well use \\[newline-and-indent].")
 
 (custom-autoload (quote comment-multi-line) "newcomment")
 
@@ -15801,7 +17145,7 @@
 \(fn)" nil nil)
 
 (autoload (quote comment-indent) "newcomment" "\
-Indent this line's comment to comment column, or insert an empty comment.
+Indent this line's comment to `comment-column', or insert an empty comment.
 If CONTINUE is non-nil, use the `comment-continue' markers if any.
 
 \(fn &optional CONTINUE)" t nil)
@@ -15831,7 +17175,7 @@
 (autoload (quote comment-region) "newcomment" "\
 Comment or uncomment each line in the region.
 With just \\[universal-argument] prefix arg, uncomment each line in region BEG .. END.
-Numeric prefix arg ARG means use ARG comment characters.
+Numeric prefix ARG means use ARG comment characters.
 If ARG is negative, delete that many comment characters instead.
 By default, comments start at the left margin, are terminated on each line,
 even for syntax in which newline does not end the comment and blank lines
@@ -15860,6 +17204,12 @@
 
 \(fn ARG)" t nil)
 
+(defvar comment-auto-fill-only-comments nil "\
+Non-nil means to only auto-fill inside comments.
+This has no effect in modes that do not define a comment syntax.")
+
+(custom-autoload (quote comment-auto-fill-only-comments) "newcomment")
+
 (autoload (quote comment-indent-new-line) "newcomment" "\
 Break line at point and indent, continuing comment if within one.
 This indents the body of the continued comment
@@ -15879,8 +17229,19 @@
 
 ;;;***
 
-;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (16211
-;;;;;;  27028))
+;;;### (autoloads (nndiary-generate-nov-databases) "nndiary" "gnus/nndiary.el"
+;;;;;;  (16775 26713))
+;;; Generated autoloads from gnus/nndiary.el
+
+(autoload (quote nndiary-generate-nov-databases) "nndiary" "\
+Generate NOV databases in all nndiary directories.
+
+\(fn &optional SERVER)" t nil)
+
+;;;***
+
+;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (16698
+;;;;;;  21928))
 ;;; Generated autoloads from gnus/nndoc.el
 
 (autoload (quote nndoc-add-type) "nndoc" "\
@@ -15895,7 +17256,7 @@
 ;;;***
 
 ;;;### (autoloads (nnfolder-generate-active-file) "nnfolder" "gnus/nnfolder.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16792 36614))
 ;;; Generated autoloads from gnus/nnfolder.el
 
 (autoload (quote nnfolder-generate-active-file) "nnfolder" "\
@@ -15907,7 +17268,7 @@
 ;;;***
 
 ;;;### (autoloads (nnkiboze-generate-groups) "nnkiboze" "gnus/nnkiboze.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16698 21928))
 ;;; Generated autoloads from gnus/nnkiboze.el
 
 (autoload (quote nnkiboze-generate-groups) "nnkiboze" "\
@@ -15919,18 +17280,18 @@
 ;;;***
 
 ;;;### (autoloads (nnml-generate-nov-databases) "nnml" "gnus/nnml.el"
-;;;;;;  (16211 27028))
+;;;;;;  (16792 36614))
 ;;; Generated autoloads from gnus/nnml.el
 
 (autoload (quote nnml-generate-nov-databases) "nnml" "\
 Generate NOV databases in all nnml directories.
 
-\(fn)" t nil)
+\(fn &optional SERVER)" t nil)
 
 ;;;***
 
 ;;;### (autoloads (nnsoup-revert-variables nnsoup-set-variables nnsoup-pack-replies)
-;;;;;;  "nnsoup" "gnus/nnsoup.el" (16211 27029))
+;;;;;;  "nnsoup" "gnus/nnsoup.el" (16698 21929))
 ;;; Generated autoloads from gnus/nnsoup.el
 
 (autoload (quote nnsoup-pack-replies) "nnsoup" "\
@@ -15950,29 +17311,31 @@
 
 ;;;***
 
-;;;### (autoloads (disable-command enable-command disabled-command-hook)
-;;;;;;  "novice" "novice.el" (16211 27017))
+;;;### (autoloads (disable-command enable-command disabled-command-function)
+;;;;;;  "novice" "novice.el" (16710 51031))
 ;;; Generated autoloads from novice.el
 
-(defvar disabled-command-hook (quote disabled-command-hook) "\
+(defvar disabled-command-function (quote disabled-command-function) "\
 Function to call to handle disabled commands.
 If nil, the feature is disabled, i.e., all commands work normally.")
 
-(autoload (quote disabled-command-hook) "novice" "\
+(autoload (quote disabled-command-function) "novice" "\
 Not documented
 
 \(fn &rest IGNORE)" nil nil)
 
 (autoload (quote enable-command) "novice" "\
 Allow COMMAND to be executed without special confirmation from now on.
-The user's .emacs file is altered so that this will apply
+COMMAND must be a symbol.
+This command alters the user's .emacs file so that this will apply
 to future sessions.
 
 \(fn COMMAND)" t nil)
 
 (autoload (quote disable-command) "novice" "\
 Require special confirmation to execute COMMAND from now on.
-The user's .emacs file is altered so that this will apply
+COMMAND must be a symbol.
+This command alters the user's .emacs file so that this will apply
 to future sessions.
 
 \(fn COMMAND)" t nil)
@@ -15980,7 +17343,7 @@
 ;;;***
 
 ;;;### (autoloads (nroff-mode) "nroff-mode" "textmodes/nroff-mode.el"
-;;;;;;  (16211 27044))
+;;;;;;  (16213 43283))
 ;;; Generated autoloads from textmodes/nroff-mode.el
 
 (autoload (quote nroff-mode) "nroff-mode" "\
@@ -15995,7 +17358,7 @@
 ;;;***
 
 ;;;### (autoloads (octave-help) "octave-hlp" "progmodes/octave-hlp.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16213 43282))
 ;;; Generated autoloads from progmodes/octave-hlp.el
 
 (autoload (quote octave-help) "octave-hlp" "\
@@ -16009,7 +17372,7 @@
 ;;;***
 
 ;;;### (autoloads (inferior-octave) "octave-inf" "progmodes/octave-inf.el"
-;;;;;;  (16288 23099))
+;;;;;;  (16288 58564))
 ;;; Generated autoloads from progmodes/octave-inf.el
 
 (autoload (quote inferior-octave) "octave-inf" "\
@@ -16032,7 +17395,7 @@
 ;;;***
 
 ;;;### (autoloads (octave-mode) "octave-mod" "progmodes/octave-mod.el"
-;;;;;;  (16281 48394))
+;;;;;;  (16284 63121))
 ;;; Generated autoloads from progmodes/octave-mod.el
 
 (autoload (quote octave-mode) "octave-mod" "\
@@ -16131,7 +17494,7 @@
 ;;;***
 
 ;;;### (autoloads (edit-options list-options) "options" "obsolete/options.el"
-;;;;;;  (16211 27037))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from obsolete/options.el
 
 (autoload (quote list-options) "options" "\
@@ -16152,8 +17515,153 @@
 
 ;;;***
 
+;;;### (autoloads (org-remember-handler org-remember-annotation org-store-link
+;;;;;;  org-diary org-agenda org-agenda-mode org-mode) "org" "textmodes/org.el"
+;;;;;;  (16819 61740))
+;;; Generated autoloads from textmodes/org.el
+
+(autoload (quote org-mode) "org" "\
+Outline-based notes management and organizer, alias 
+\"Carstens outline-mode for keeping track of everything.\"
+
+Org-mode develops organizational tasks around a NOTES file which
+contains information about projects as plain text.  Org-mode is
+implemented on top of outline-mode, which is ideal to keep the content
+of large files well structured.  It supports ToDo items, deadlines and
+time stamps, which magically appear in the diary listing of the Emacs
+calendar.  Tables are easily created with a built-in table editor.
+Plain text URL-like links connect to websites, emails (VM), Usenet
+messages (Gnus), BBDB entries, and any files related to the project.
+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:
+
+\\{org-mode-map}
+
+\(fn &optional ARG)" t nil)
+
+(autoload (quote org-agenda-mode) "org" "\
+Mode for time-sorted view on action items in Org-mode files.
+
+\(fn)" t nil)
+
+(autoload (quote org-agenda) "org" "\
+Produce a weekly view from all files in variable `org-agenda-files'.
+The view will be for the current week, but from the overview buffer you
+will be able to go to other weeks.
+With one C-u prefix argument INCLUDE-ALL, all unfinished TODO items will
+also be shown, under the current date.
+START-DAY defaults to TODAY, or to the most recent match for the weekday
+given in `org-agenda-start-on-weekday'.
+NDAYS defaults to `org-agenda-ndays'.
+
+\(fn &optional INCLUDE-ALL START-DAY NDAYS)" t nil)
+
+(autoload (quote org-diary) "org" "\
+Returns diary information from org-files.
+This function can be used in an \"sexp\" diary entry in the Emacs calendar.
+It accesses org files and extracts information from those files to be
+listed in the diary.  The function accepts arguments specifying what
+items should be listed.  The following arguments are allowed:
+
+   :timestamp    List the headlines of items containing a date stamp or
+                 date range matching the selected date.  Deadlines will
+                 also be listed, on the expiration day.
+
+   :deadline     List any deadlines past due, or due within
+                 `org-deadline-warning-days'.  The listing occurs only
+                 in the diary for *today*, not at any other date.  If
+                 an entry is marked DONE, it is no longer listed.
+
+   :scheduled    List all items which are scheduled for the given date.
+                 The diary for *today* also contains items which were
+                 scheduled earlier and are not yet marked DONE.
+
+   :todo         List all TODO items from the org-file.  This may be a
+                 long list - so this is not turned on by default.
+                 Like deadlines, these entires only show up in the
+                 diary for *today*, not at any other date.
+
+The call in the diary file should look like this:
+
+   &%%(org-diary) ~/path/to/some/orgfile.org
+
+Use a separate line for each org file to check.  Or, if you omit the file name,
+all files listed in `org-agenda-files' will be checked automatically:
+
+   &%%(org-diary)
+
+If you don't give any arguments (as in the example above), the default
+arguments (:deadline :scheduled :timestamp) are used.  So the example above may
+also be written as
+
+   &%%(org-diary :deadline :timestamp :scheduled)
+
+The function expects the lisp variables `entry' and `date' to be provided
+by the caller, because this is how the calendar works.  Don't use this
+function from a program - use `org-agenda-get-day-entries' instead.
+
+\(fn &rest ARGS)" nil nil)
+
+(autoload (quote org-store-link) "org" "\
+\\<org-mode-map>Store an org-link to the current location.
+This link can later be inserted into an org-buffer with
+\\[org-insert-link].
+For some link types, a prefix arg is interpreted:
+For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
+For file links, arg negates `org-line-numbers-in-file-links'.
+
+\(fn ARG)" t nil)
+
+(autoload (quote org-remember-annotation) "org" "\
+Return a link to the current location as an annotation for remember.el.
+If you are using Org-mode files as target for data storage with
+remember.el, then the annotations should include a link compatible with the
+conventions in Org-mode.  This function returns such a link.
+
+\(fn)" nil nil)
+
+(autoload (quote org-remember-handler) "org" "\
+Store stuff from remember.el into an org file.
+First prompts for an org file.  If the user just presses return, the value
+of `org-default-notes-file' is used.
+Then the command offers the headings tree of the selected file in order to
+file the text at a specific location.
+You can either immediately press RET to get the note appended to the
+file.  Or you can use vertical cursor motion and visibility cycling (TAB) to
+find a better place.  Then press RET or <left> or <right> in insert the note.
+
+Key      Cursor position   Note gets inserted
+-----------------------------------------------------------------------------
+RET      buffer-start      as level 2 heading at end of file
+RET      on headline       as sublevel of the heading at cursor
+RET      no heading        at cursor position, level taken from context.
+                           Or use prefix arg to specify level manually.
+<left>   on headline       as same level, before current heading
+<right>  on headline       as same level, after current heading
+
+So the fastest way to store the note is to press RET RET to append it to
+the default file.  This way your current train of thought is not
+interrupted, in accordance with the principles of remember.el.  But with
+little extra effort, you can push it directly to the correct location.
+
+Before being stored away, the function ensures that the text has a
+headline, i.e. a first line that starts with a \"*\".  If not, a headline
+is constructed from the current date and some additional data.
+
+If the variable `org-adapt-indentation' is non-nil, the entire text is
+also indented so that it starts in the same column as the headline
+\(i.e. after the stars).
+
+See also the variable `org-reverse-note-order'.
+
+\(fn)" nil nil)
+
+;;;***
+
 ;;;### (autoloads (outline-minor-mode outline-mode) "outline" "outline.el"
-;;;;;;  (16211 27017))
+;;;;;;  (16780 55376))
 ;;; Generated autoloads from outline.el
 
 (autoload (quote outline-mode) "outline" "\
@@ -16208,7 +17716,7 @@
 
 ;;;***
 
-;;;### (autoloads (show-paren-mode) "paren" "paren.el" (16211 27017))
+;;;### (autoloads (show-paren-mode) "paren" "paren.el" (16816 23724))
 ;;; Generated autoloads from paren.el
 
 (defvar show-paren-mode nil "\
@@ -16232,7 +17740,7 @@
 ;;;***
 
 ;;;### (autoloads (parse-time-string) "parse-time" "calendar/parse-time.el"
-;;;;;;  (16243 59668))
+;;;;;;  (16243 62806))
 ;;; Generated autoloads from calendar/parse-time.el
 
 (autoload (quote parse-time-string) "parse-time" "\
@@ -16244,8 +17752,8 @@
 
 ;;;***
 
-;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (16211
-;;;;;;  27039))
+;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (16213
+;;;;;;  43282))
 ;;; Generated autoloads from progmodes/pascal.el
 
 (autoload (quote pascal-mode) "pascal" "\
@@ -16298,7 +17806,7 @@
 ;;;***
 
 ;;;### (autoloads (pc-bindings-mode) "pc-mode" "emulation/pc-mode.el"
-;;;;;;  (16211 27026))
+;;;;;;  (16213 43273))
 ;;; Generated autoloads from emulation/pc-mode.el
 
 (autoload (quote pc-bindings-mode) "pc-mode" "\
@@ -16316,7 +17824,7 @@
 ;;;***
 
 ;;;### (autoloads (pc-selection-mode pc-selection-mode) "pc-select"
-;;;;;;  "emulation/pc-select.el" (16211 27026))
+;;;;;;  "emulation/pc-select.el" (16589 26258))
 ;;; Generated autoloads from emulation/pc-select.el
 
 (defvar pc-selection-mode nil "\
@@ -16345,7 +17853,7 @@
 S-M-LEFT and S-M-RIGHT move back or forward one word or sexp, leaving the mark
 behind.  To control whether these keys move word-wise or sexp-wise set the
 variable `pc-select-meta-moves-sexps' after loading pc-select.el but before
-turning `pc-selection-mode' on.
+turning PC Selection mode on.
 
 C-DOWN and C-UP move back or forward a paragraph, disabling the mark.
 S-C-DOWN and S-C-UP move back or forward a paragraph, leaving the mark behind.
@@ -16367,7 +17875,7 @@
 
 In addition, certain other PC bindings are imitated (to avoid this, set
 the variable `pc-select-selection-keys-only' to t after loading pc-select.el
-but before calling `pc-selection-mode'):
+but before calling PC Selection mode):
 
   F6           other-window
   DELETE       delete-char
@@ -16384,14 +17892,15 @@
 Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style,
 and cursor movement commands.
 This mode enables Delete Selection mode and Transient Mark mode.
-You must modify via \\[customize] for this variable to have an effect.")
+Setting this variable directly does not take effect;
+you must modify it using \\[customize] or \\[pc-selection-mode].")
 
 (custom-autoload (quote pc-selection-mode) "pc-select")
 
 ;;;***
 
-;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (16211
-;;;;;;  27017))
+;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (16213
+;;;;;;  43269))
 ;;; Generated autoloads from pcmpl-cvs.el
 
 (autoload (quote pcomplete/cvs) "pcmpl-cvs" "\
@@ -16402,7 +17911,7 @@
 ;;;***
 
 ;;;### (autoloads (pcomplete/tar pcomplete/make pcomplete/bzip2 pcomplete/gzip)
-;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (16211 27017))
+;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (16213 43269))
 ;;; Generated autoloads from pcmpl-gnu.el
 
 (autoload (quote pcomplete/gzip) "pcmpl-gnu" "\
@@ -16430,7 +17939,7 @@
 ;;;***
 
 ;;;### (autoloads (pcomplete/mount pcomplete/umount pcomplete/kill)
-;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (16211 27017))
+;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (16213 43269))
 ;;; Generated autoloads from pcmpl-linux.el
 
 (autoload (quote pcomplete/kill) "pcmpl-linux" "\
@@ -16450,8 +17959,8 @@
 
 ;;;***
 
-;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (16211
-;;;;;;  27017))
+;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (16213
+;;;;;;  43269))
 ;;; Generated autoloads from pcmpl-rpm.el
 
 (autoload (quote pcomplete/rpm) "pcmpl-rpm" "\
@@ -16467,7 +17976,7 @@
 
 ;;;### (autoloads (pcomplete/chgrp pcomplete/chown pcomplete/which
 ;;;;;;  pcomplete/xargs pcomplete/rm pcomplete/rmdir pcomplete/cd)
-;;;;;;  "pcmpl-unix" "pcmpl-unix.el" (16211 27017))
+;;;;;;  "pcmpl-unix" "pcmpl-unix.el" (16213 43269))
 ;;; Generated autoloads from pcmpl-unix.el
 
 (autoload (quote pcomplete/cd) "pcmpl-unix" "\
@@ -16513,8 +18022,8 @@
 
 ;;;### (autoloads (pcomplete-shell-setup pcomplete-comint-setup pcomplete-list
 ;;;;;;  pcomplete-help pcomplete-expand pcomplete-continue pcomplete-expand-and-complete
-;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (16211
-;;;;;;  27017))
+;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (16768
+;;;;;;  48631))
 ;;; Generated autoloads from pcomplete.el
 
 (autoload (quote pcomplete) "pcomplete" "\
@@ -16522,7 +18031,7 @@
 To use this function, just bind the TAB key to it, or add it to your
 completion functions list (it should occur fairly early in the list).
 
-\(fn)" t nil)
+\(fn &optional INTERACTIVELY)" t nil)
 
 (autoload (quote pcomplete-reverse) "pcomplete" "\
 If cycling completion is in use, cycle backwards.
@@ -16559,8 +18068,8 @@
 (autoload (quote pcomplete-comint-setup) "pcomplete" "\
 Setup a comint buffer to use pcomplete.
 COMPLETEF-SYM should be the symbol where the
-dynamic-complete-functions are kept.  For comint mode itself, this is
-`comint-dynamic-complete-functions'.
+dynamic-complete-functions are kept.  For comint mode itself,
+this is `comint-dynamic-complete-functions'.
 
 \(fn COMPLETEF-SYM)" nil nil)
 
@@ -16573,7 +18082,7 @@
 
 ;;;### (autoloads (cvs-dired-use-hook cvs-dired-action cvs-status
 ;;;;;;  cvs-update cvs-examine cvs-quickdir cvs-checkout) "pcvs"
-;;;;;;  "pcvs.el" (16248 17500))
+;;;;;;  "pcvs.el" (16814 63075))
 ;;; Generated autoloads from pcvs.el
 
 (autoload (quote cvs-checkout) "pcvs" "\
@@ -16650,7 +18159,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "pcvs-defs" "pcvs-defs.el" (16211 27018))
+;;;### (autoloads nil "pcvs-defs" "pcvs-defs.el" (16764 51518))
 ;;; Generated autoloads from pcvs-defs.el
 
 (defvar cvs-global-menu (let ((m (make-sparse-keymap "PCL-CVS"))) (define-key m [status] (quote (menu-item "Directory Status" cvs-status :help "A more verbose status of a workarea"))) (define-key m [checkout] (quote (menu-item "Checkout Module" cvs-checkout :help "Check out a module from the repository"))) (define-key m [update] (quote (menu-item "Update Directory" cvs-update :help "Fetch updates from the repository"))) (define-key m [examine] (quote (menu-item "Examine Directory" cvs-examine :help "Examine the current state of a workarea"))) (fset (quote cvs-global-menu) m)))
@@ -16658,7 +18167,7 @@
 ;;;***
 
 ;;;### (autoloads (perl-mode) "perl-mode" "progmodes/perl-mode.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16213 43282))
 ;;; Generated autoloads from progmodes/perl-mode.el
 
 (autoload (quote perl-mode) "perl-mode" "\
@@ -16713,8 +18222,98 @@
 
 ;;;***
 
+;;;### (autoloads (pgg-snarf-keys pgg-snarf-keys-region pgg-insert-key
+;;;;;;  pgg-verify pgg-verify-region pgg-sign pgg-sign-region pgg-decrypt
+;;;;;;  pgg-decrypt-region pgg-encrypt pgg-encrypt-region) "pgg"
+;;;;;;  "gnus/pgg.el" (16697 49031))
+;;; Generated autoloads from gnus/pgg.el
+
+(autoload (quote pgg-encrypt-region) "pgg" "\
+Encrypt the current region between START and END for RCPTS.
+If optional argument SIGN is non-nil, do a combined sign and encrypt.
+
+\(fn START END RCPTS &optional SIGN)" t nil)
+
+(autoload (quote pgg-encrypt) "pgg" "\
+Encrypt the current buffer for RCPTS.
+If optional argument SIGN is non-nil, do a combined sign and encrypt.
+If optional arguments START and END are specified, only encrypt within
+the region.
+
+\(fn RCPTS &optional SIGN START END)" t nil)
+
+(autoload (quote pgg-decrypt-region) "pgg" "\
+Decrypt the current region between START and END.
+
+\(fn START END)" t nil)
+
+(autoload (quote pgg-decrypt) "pgg" "\
+Decrypt the current buffer.
+If optional arguments START and END are specified, only decrypt within
+the region.
+
+\(fn &optional START END)" t nil)
+
+(autoload (quote pgg-sign-region) "pgg" "\
+Make the signature from text between START and END.
+If the optional 3rd argument CLEARTEXT is non-nil, it does not create
+a detached signature.
+If this function is called interactively, CLEARTEXT is enabled
+and the the output is displayed.
+
+\(fn START END &optional CLEARTEXT)" t nil)
+
+(autoload (quote pgg-sign) "pgg" "\
+Sign the current buffer.
+If the optional argument CLEARTEXT is non-nil, it does not create a
+detached signature.
+If optional arguments START and END are specified, only sign data
+within the region.
+If this function is called interactively, CLEARTEXT is enabled
+and the the output is displayed.
+
+\(fn &optional CLEARTEXT START END)" t nil)
+
+(autoload (quote pgg-verify-region) "pgg" "\
+Verify the current region between START and END.
+If the optional 3rd argument SIGNATURE is non-nil, it is treated as
+the detached signature of the current region.
+
+If the optional 4th argument FETCH is non-nil, we attempt to fetch the
+signer's public key from `pgg-default-keyserver-address'.
+
+\(fn START END &optional SIGNATURE FETCH)" t nil)
+
+(autoload (quote pgg-verify) "pgg" "\
+Verify the current buffer.
+If the optional argument SIGNATURE is non-nil, it is treated as
+the detached signature of the current region.
+If the optional argument FETCH is non-nil, we attempt to fetch the
+signer's public key from `pgg-default-keyserver-address'.
+If optional arguments START and END are specified, only verify data
+within the region.
+
+\(fn &optional SIGNATURE FETCH START END)" t nil)
+
+(autoload (quote pgg-insert-key) "pgg" "\
+Insert the ASCII armored public key.
+
+\(fn)" t nil)
+
+(autoload (quote pgg-snarf-keys-region) "pgg" "\
+Import public keys in the current region between START and END.
+
+\(fn START END)" t nil)
+
+(autoload (quote pgg-snarf-keys) "pgg" "\
+Import public keys in the current buffer.
+
+\(fn)" t nil)
+
+;;;***
+
 ;;;### (autoloads (picture-mode) "picture" "textmodes/picture.el"
-;;;;;;  (16211 27044))
+;;;;;;  (16534 3822))
 ;;; Generated autoloads from textmodes/picture.el
 
 (autoload (quote picture-mode) "picture" "\
@@ -16786,7 +18385,7 @@
 ;;;***
 
 ;;;### (autoloads (po-find-file-coding-system) "po" "textmodes/po.el"
-;;;;;;  (16211 27044))
+;;;;;;  (16213 43283))
 ;;; Generated autoloads from textmodes/po.el
 
 (autoload (quote po-find-file-coding-system) "po" "\
@@ -16797,7 +18396,7 @@
 
 ;;;***
 
-;;;### (autoloads (pong) "pong" "play/pong.el" (16211 27038))
+;;;### (autoloads (pong) "pong" "play/pong.el" (16213 43281))
 ;;; Generated autoloads from play/pong.el
 
 (autoload (quote pong) "pong" "\
@@ -16813,8 +18412,8 @@
 
 ;;;***
 
-;;;### (autoloads (pp-eval-last-sexp pp-eval-expression pp pp-to-string)
-;;;;;;  "pp" "emacs-lisp/pp.el" (16211 27026))
+;;;### (autoloads (pp-eval-last-sexp pp-eval-expression pp pp-buffer
+;;;;;;  pp-to-string) "pp" "emacs-lisp/pp.el" (16609 26453))
 ;;; Generated autoloads from emacs-lisp/pp.el
 
 (autoload (quote pp-to-string) "pp" "\
@@ -16824,6 +18423,11 @@
 
 \(fn OBJECT)" nil nil)
 
+(autoload (quote pp-buffer) "pp" "\
+Prettify the current buffer with printed representation of a Lisp object.
+
+\(fn)" nil nil)
+
 (autoload (quote pp) "pp" "\
 Output the pretty-printed representation of OBJECT, any Lisp object.
 Quoting characters are printed as needed to make output that `read'
@@ -16867,15 +18471,15 @@
 ;;;;;;  pr-ps-buffer-print pr-ps-buffer-using-ghostscript pr-ps-buffer-preview
 ;;;;;;  pr-ps-directory-ps-print pr-ps-directory-print pr-ps-directory-using-ghostscript
 ;;;;;;  pr-ps-directory-preview pr-interface) "printing" "printing.el"
-;;;;;;  (16211 27018))
+;;;;;;  (16801 58022))
 ;;; Generated autoloads from printing.el
 
 (autoload (quote pr-interface) "printing" "\
 Activate the printing interface buffer.
 
-If BUFFER is nil, it uses the current buffer for printing.
-
-For more informations, type \\[pr-interface-help].
+If BUFFER is nil, the current buffer is used for printing.
+
+For more information, type \\[pr-interface-help].
 
 \(fn &optional BUFFER)" t nil)
 
@@ -17319,32 +18923,32 @@
 \(fn)" t nil)
 
 (autoload (quote pr-customize) "printing" "\
-Customization of `printing' group.
+Customization of the `printing' group.
 
 \(fn &rest IGNORE)" t nil)
 
 (autoload (quote lpr-customize) "printing" "\
-Customization of `lpr' group.
+Customization of the `lpr' group.
 
 \(fn &rest IGNORE)" t nil)
 
 (autoload (quote pr-help) "printing" "\
-Help for printing package.
+Help for the printing package.
 
 \(fn &rest IGNORE)" t nil)
 
 (autoload (quote pr-ps-name) "printing" "\
-Select interactively a PostScript printer.
+Interactively select a PostScript printer.
 
 \(fn)" t nil)
 
 (autoload (quote pr-txt-name) "printing" "\
-Select interactively a text printer.
+Interactively select a text printer.
 
 \(fn)" t nil)
 
 (autoload (quote pr-ps-utility) "printing" "\
-Select interactively a PostScript utility.
+Interactively select a PostScript utility.
 
 \(fn)" t nil)
 
@@ -17455,7 +19059,7 @@
 ;;;***
 
 ;;;### (autoloads (run-prolog prolog-mode) "prolog" "progmodes/prolog.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16814 63075))
 ;;; Generated autoloads from progmodes/prolog.el
 
 (autoload (quote prolog-mode) "prolog" "\
@@ -17475,7 +19079,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "ps-bdf" "ps-bdf.el" (16211 27018))
+;;;### (autoloads nil "ps-bdf" "ps-bdf.el" (16213 43271))
 ;;; Generated autoloads from ps-bdf.el
 
 (defvar bdf-directory-list (if (memq system-type (quote (ms-dos windows-nt))) (list (expand-file-name "fonts/bdf" installation-directory)) (quote ("/usr/local/share/emacs/fonts/bdf"))) "\
@@ -17484,8 +19088,8 @@
 
 ;;;***
 
-;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (16211
-;;;;;;  27039))
+;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (16213
+;;;;;;  43282))
 ;;; Generated autoloads from progmodes/ps-mode.el
 
 (autoload (quote ps-mode) "ps-mode" "\
@@ -17534,7 +19138,7 @@
 ;;;### (autoloads (ps-mule-begin-page ps-mule-begin-job ps-mule-header-string-charsets
 ;;;;;;  ps-mule-encode-header-string ps-mule-initialize ps-mule-plot-composition
 ;;;;;;  ps-mule-plot-string ps-mule-set-ascii-font ps-mule-prepare-ascii-font
-;;;;;;  ps-multibyte-buffer) "ps-mule" "ps-mule.el" (16211 27018))
+;;;;;;  ps-multibyte-buffer) "ps-mule" "ps-mule.el" (16702 49514))
 ;;; Generated autoloads from ps-mule.el
 
 (defvar ps-multibyte-buffer nil "\
@@ -17660,8 +19264,8 @@
 ;;;;;;  ps-spool-region ps-spool-buffer-with-faces ps-spool-buffer
 ;;;;;;  ps-print-region-with-faces ps-print-region ps-print-buffer-with-faces
 ;;;;;;  ps-print-buffer ps-print-customize ps-print-color-p ps-paper-type
-;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (16211
-;;;;;;  27018))
+;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (16801
+;;;;;;  58023))
 ;;; Generated autoloads from ps-print.el
 
 (defvar ps-page-dimensions-database (list (list (quote a4) (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54) "A4") (list (quote a3) (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54) "A3") (list (quote letter) (* 72 8.5) (* 72 11.0) "Letter") (list (quote legal) (* 72 8.5) (* 72 14.0) "Legal") (list (quote letter-small) (* 72 7.68) (* 72 10.16) "LetterSmall") (list (quote tabloid) (* 72 11.0) (* 72 17.0) "Tabloid") (list (quote ledger) (* 72 17.0) (* 72 11.0) "Ledger") (list (quote statement) (* 72 5.5) (* 72 8.5) "Statement") (list (quote executive) (* 72 7.5) (* 72 10.0) "Executive") (list (quote a4small) (* 72 7.47) (* 72 10.85) "A4Small") (list (quote b4) (* 72 10.125) (* 72 14.33) "B4") (list (quote b5) (* 72 7.16) (* 72 10.125) "B5")) "\
@@ -17857,11 +19461,95 @@
 
 ;;;***
 
+;;;### (autoloads (jython-mode python-mode run-python) "python" "progmodes/python.el"
+;;;;;;  (16816 23742))
+;;; Generated autoloads from progmodes/python.el
+
+(add-to-list (quote interpreter-mode-alist) (quote ("jython" . jython-mode)))
+
+(add-to-list (quote interpreter-mode-alist) (quote ("python" . python-mode)))
+
+(add-to-list (quote auto-mode-alist) (quote ("\\.py\\'" . python-mode)))
+
+(autoload (quote run-python) "python" "\
+Run an inferior Python process, input and output via buffer *Python*.
+CMD is the Python command to run.  NOSHOW non-nil means don't show the
+buffer automatically.
+If there is a process already running in `*Python*', switch to
+that buffer.  Interactively, a prefix arg allows you to edit the initial
+command line (default is `python-command'); `-i' etc.  args will be added
+to this as appropriate.  Runs the hook `inferior-python-mode-hook'
+\(after the `comint-mode-hook' is run).
+\(Type \\[describe-mode] in the process buffer for a list of commands.)
+
+\(fn &optional CMD NOSHOW)" t nil)
+
+(autoload (quote python-mode) "python" "\
+Major mode for editing Python files.
+Turns on Font Lock mode unconditionally since it is required for correct
+parsing of the source.
+See also `jython-mode', which is actually invoked if the buffer appears to
+contain Jython code.  See also `run-python' and associated Python mode
+commands for running Python under Emacs.
+
+The Emacs commands which work with `defun's, e.g. \\[beginning-of-defun], deal
+with nested `def' and `class' blocks.  They take the innermost one as
+current without distinguishing method and class definitions.  Used multiple
+times, they move over others at the same indentation level until they reach
+the end of definitions at that level, when they move up a level.
+\\<python-mode-map>
+Colon is electric: it outdents the line if appropriate, e.g. for
+an else statement.  \\[python-backspace] at the beginning of an indented statement
+deletes a level of indentation to close the current block; otherwise it
+deletes a charcter backward.  TAB indents the current line relative to
+the preceding code.  Successive TABs, with no intervening command, cycle
+through the possibilities for indentation on the basis of enclosing blocks.
+
+\\[fill-paragraph] fills comments and multiline strings appropriately, but has no
+effect outside them.
+
+Supports Eldoc mode (only for functions, using a Python process),
+Info-Look and Imenu.  In Outline minor mode, `class' and `def'
+lines count as headers.
+
+\\{python-mode-map}
+
+\(fn)" t nil)
+
+(autoload (quote jython-mode) "python" "\
+Major mode for editing Jython files.
+Like `python-mode', but sets up parameters for Jython subprocesses.
+Runs `jython-mode-hook' after `python-mode-hook'.
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (quoted-printable-decode-region) "qp" "gnus/qp.el"
+;;;;;;  (16698 21929))
+;;; Generated autoloads from gnus/qp.el
+
+(autoload (quote quoted-printable-decode-region) "qp" "\
+Decode quoted-printable in the region between FROM and TO, per RFC 2045.
+If CODING-SYSTEM is non-nil, decode bytes into characters with that
+coding-system.
+
+Interactively, you can supply the CODING-SYSTEM argument
+with \\[universal-coding-system-argument].
+
+The CODING-SYSTEM argument is a historical hangover and is deprecated.
+QP encodes raw bytes and should be decoded into raw bytes.  Decoding
+them into characters should be done separately.
+
+\(fn FROM TO &optional CODING-SYSTEM)" t nil)
+
+;;;***
+
 ;;;### (autoloads (quail-update-leim-list-file quail-defrule-internal
 ;;;;;;  quail-defrule quail-install-decode-map quail-install-map
 ;;;;;;  quail-define-rules quail-show-keyboard-layout quail-set-keyboard-layout
 ;;;;;;  quail-define-package quail-use-package quail-title) "quail"
-;;;;;;  "international/quail.el" (16303 32090))
+;;;;;;  "international/quail.el" (16547 17258))
 ;;; Generated autoloads from international/quail.el
 
 (autoload (quote quail-title) "quail" "\
@@ -18092,8 +19780,8 @@
 
 ;;;### (autoloads (quickurl-list quickurl-list-mode quickurl-edit-urls
 ;;;;;;  quickurl-browse-url-ask quickurl-browse-url quickurl-add-url
-;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (16211
-;;;;;;  27037))
+;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (16543
+;;;;;;  16567))
 ;;; Generated autoloads from net/quickurl.el
 
 (defconst quickurl-reread-hook-postfix "\n;; Local Variables:\n;; eval: (progn (require 'quickurl) (add-hook 'local-write-file-hooks (lambda () (quickurl-read) nil)))\n;; End:\n" "\
@@ -18114,7 +19802,7 @@
 buffer, this default action can be modifed via
 `quickurl-grab-lookup-function'.
 
-\(fn &optional (LOOKUP (funcall quickurl-grab-lookup-function)))" t nil)
+\(fn &optional LOOKUP)" t nil)
 
 (autoload (quote quickurl-ask) "quickurl" "\
 Insert an URL, with `completing-read' prompt, based on LOOKUP.
@@ -18136,7 +19824,7 @@
 current buffer, this default action can be modifed via
 `quickurl-grab-lookup-function'.
 
-\(fn &optional (LOOKUP (funcall quickurl-grab-lookup-function)))" t nil)
+\(fn &optional LOOKUP)" t nil)
 
 (autoload (quote quickurl-browse-url-ask) "quickurl" "\
 Browse the URL, with `completing-read' prompt, associated with LOOKUP.
@@ -18164,8 +19852,8 @@
 
 ;;;***
 
-;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (16211
-;;;;;;  27037))
+;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (16213
+;;;;;;  43280))
 ;;; Generated autoloads from net/rcompile.el
 
 (autoload (quote remote-compile) "rcompile" "\
@@ -18177,7 +19865,7 @@
 ;;;***
 
 ;;;### (autoloads (re-builder) "re-builder" "emacs-lisp/re-builder.el"
-;;;;;;  (16211 27026))
+;;;;;;  (16675 7397))
 ;;; Generated autoloads from emacs-lisp/re-builder.el
 
 (autoload (quote re-builder) "re-builder" "\
@@ -18187,7 +19875,7 @@
 
 ;;;***
 
-;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (16246 40636))
+;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (16783 21521))
 ;;; Generated autoloads from recentf.el
 
 (defvar recentf-mode nil "\
@@ -18213,8 +19901,8 @@
 ;;;### (autoloads (clear-rectangle string-insert-rectangle string-rectangle
 ;;;;;;  delete-whitespace-rectangle open-rectangle insert-rectangle
 ;;;;;;  yank-rectangle kill-rectangle extract-rectangle delete-extract-rectangle
-;;;;;;  delete-rectangle move-to-column-force) "rect" "rect.el" (16211
-;;;;;;  27018))
+;;;;;;  delete-rectangle move-to-column-force) "rect" "rect.el" (16213
+;;;;;;  43271))
 ;;; Generated autoloads from rect.el
 
 (autoload (quote move-to-column-force) "rect" "\
@@ -18336,8 +20024,8 @@
 
 ;;;***
 
-;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (16211
-;;;;;;  27044))
+;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (16213
+;;;;;;  43283))
 ;;; Generated autoloads from textmodes/refill.el
 
 (autoload (quote refill-mode) "refill" "\
@@ -18353,7 +20041,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-reset-scanning-information reftex-mode
-;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (16211 27044))
+;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (16213 43284))
 ;;; Generated autoloads from textmodes/reftex.el
 
 (autoload (quote turn-on-reftex) "reftex" "\
@@ -18403,7 +20091,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-citation) "reftex-cite" "textmodes/reftex-cite.el"
-;;;;;;  (16211 27044))
+;;;;;;  (16213 43283))
 ;;; Generated autoloads from textmodes/reftex-cite.el
 
 (autoload (quote reftex-citation) "reftex-cite" "\
@@ -18432,7 +20120,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-index-phrases-mode) "reftex-index" "textmodes/reftex-index.el"
-;;;;;;  (16211 27044))
+;;;;;;  (16213 43283))
 ;;; Generated autoloads from textmodes/reftex-index.el
 
 (autoload (quote reftex-index-phrases-mode) "reftex-index" "\
@@ -18465,7 +20153,7 @@
 ;;;***
 
 ;;;### (autoloads (reftex-all-document-files) "reftex-parse" "textmodes/reftex-parse.el"
-;;;;;;  (16211 27044))
+;;;;;;  (16213 43283))
 ;;; Generated autoloads from textmodes/reftex-parse.el
 
 (autoload (quote reftex-all-document-files) "reftex-parse" "\
@@ -18478,7 +20166,7 @@
 ;;;***
 
 ;;;### (autoloads (regexp-opt-depth regexp-opt) "regexp-opt" "emacs-lisp/regexp-opt.el"
-;;;;;;  (16211 27026))
+;;;;;;  (16213 43273))
 ;;; Generated autoloads from emacs-lisp/regexp-opt.el
 
 (autoload (quote regexp-opt) "regexp-opt" "\
@@ -18505,7 +20193,7 @@
 
 ;;;***
 
-;;;### (autoloads (repeat) "repeat" "repeat.el" (16211 27018))
+;;;### (autoloads (repeat) "repeat" "repeat.el" (16213 43271))
 ;;; Generated autoloads from repeat.el
 
 (autoload (quote repeat) "repeat" "\
@@ -18523,7 +20211,7 @@
 ;;;***
 
 ;;;### (autoloads (reporter-submit-bug-report) "reporter" "mail/reporter.el"
-;;;;;;  (16211 27034))
+;;;;;;  (16213 43280))
 ;;; Generated autoloads from mail/reporter.el
 
 (autoload (quote reporter-submit-bug-report) "reporter" "\
@@ -18555,7 +20243,7 @@
 ;;;***
 
 ;;;### (autoloads (reposition-window) "reposition" "reposition.el"
-;;;;;;  (16211 27018))
+;;;;;;  (16213 43271))
 ;;; Generated autoloads from reposition.el
 
 (autoload (quote reposition-window) "reposition" "\
@@ -18582,8 +20270,8 @@
 
 ;;;***
 
-;;;### (autoloads (resume-suspend-hook) "resume" "resume.el" (16211
-;;;;;;  27018))
+;;;### (autoloads (resume-suspend-hook) "resume" "resume.el" (16213
+;;;;;;  43271))
 ;;; Generated autoloads from resume.el
 
 (autoload (quote resume-suspend-hook) "resume" "\
@@ -18594,7 +20282,7 @@
 ;;;***
 
 ;;;### (autoloads (global-reveal-mode reveal-mode) "reveal" "reveal.el"
-;;;;;;  (16211 27018))
+;;;;;;  (16804 23129))
 ;;; Generated autoloads from reveal.el
 
 (autoload (quote reveal-mode) "reveal" "\
@@ -18629,7 +20317,7 @@
 
 ;;;### (autoloads (file-name-shadow-mode file-name-shadow-tty-properties
 ;;;;;;  file-name-shadow-properties) "rfn-eshadow" "rfn-eshadow.el"
-;;;;;;  (16211 27018))
+;;;;;;  (16213 43271))
 ;;; Generated autoloads from rfn-eshadow.el
 
 (defvar file-name-shadow-properties (quote (face file-name-shadow field shadow)) "\
@@ -18672,7 +20360,7 @@
 ;;;***
 
 ;;;### (autoloads (make-ring ring-p) "ring" "emacs-lisp/ring.el"
-;;;;;;  (16211 27026))
+;;;;;;  (16213 43273))
 ;;; Generated autoloads from emacs-lisp/ring.el
 
 (autoload (quote ring-p) "ring" "\
@@ -18687,7 +20375,7 @@
 
 ;;;***
 
-;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (16211 27037))
+;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (16507 41097))
 ;;; Generated autoloads from net/rlogin.el
  (add-hook 'same-window-regexps "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)")
 
@@ -18732,13 +20420,13 @@
 
 ;;;***
 
-;;;### (autoloads (rmail-set-pop-password rmail-input rmail-mode
-;;;;;;  rmail rmail-enable-mime rmail-show-message-hook rmail-confirm-expunge
-;;;;;;  rmail-secondary-file-regexp rmail-secondary-file-directory
+;;;### (autoloads (rmail-restore-desktop-buffer rmail-set-pop-password
+;;;;;;  rmail-input rmail-mode rmail rmail-enable-mime rmail-show-message-hook
+;;;;;;  rmail-confirm-expunge rmail-secondary-file-regexp rmail-secondary-file-directory
 ;;;;;;  rmail-mail-new-frame rmail-primary-inbox-list rmail-delete-after-output
 ;;;;;;  rmail-highlight-face rmail-highlighted-headers rmail-retry-ignored-headers
 ;;;;;;  rmail-displayed-headers rmail-ignored-headers rmail-dont-reply-to-names)
-;;;;;;  "rmail" "mail/rmail.el" (16296 8718))
+;;;;;;  "rmail" "mail/rmail.el" (16792 36615))
 ;;; Generated autoloads from mail/rmail.el
 
 (defvar rmail-dont-reply-to-names nil "\
@@ -18748,9 +20436,9 @@
 
 (custom-autoload (quote rmail-dont-reply-to-names) "rmail")
 
-(defvar rmail-default-dont-reply-to-names "info-" "\
-A regular expression specifying part of the value of the default value of
-the variable `rmail-dont-reply-to-names', for when the user does not set
+(defvar rmail-default-dont-reply-to-names "\\`info-" "\
+A regular expression specifying part of the default value of the
+variable `rmail-dont-reply-to-names', for when the user does not set
 `rmail-dont-reply-to-names' explicitly.  (The other part of the default
 value is the user's email address and name.)
 It is useful to set this variable in the site customization file.")
@@ -18804,7 +20492,9 @@
 (custom-autoload (quote rmail-primary-inbox-list) "rmail")
 
 (defvar rmail-mail-new-frame nil "\
-*Non-nil means Rmail makes a new frame for composing outgoing mail.")
+*Non-nil means Rmail makes a new frame for composing outgoing mail.
+This is handy if you want to preserve the window configuration of
+the frame where you have the RMAIL buffer displayed.")
 
 (custom-autoload (quote rmail-mail-new-frame) "rmail")
 
@@ -18903,7 +20593,7 @@
 ignored, and all the decoding work is done by a feature specified by
 the variable `rmail-mime-feature'.")
 
-(defvar rmail-mime-charset-pattern "^content-type:[ ]*text/plain;[ 	\n]*charset=\"?\\([^ 	\n\"]+\\)\"?" "\
+(defvar rmail-mime-charset-pattern "^content-type:[ ]*text/plain;[ 	\n]*charset=\"?\\([^ 	\n\";]+\\)\"?" "\
 Regexp to match MIME-charset specification in a header of message.
 The first parenthesized expression should match the MIME-charset name.")
 
@@ -18983,10 +20673,15 @@
 
 \(fn PASSWORD)" t nil)
 
+(autoload (quote rmail-restore-desktop-buffer) "rmail" "\
+Restore an rmail buffer specified in a desktop file.
+
+\(fn DESKTOP-BUFFER-FILE-NAME DESKTOP-BUFFER-NAME DESKTOP-BUFFER-MISC)" nil nil)
+
 ;;;***
 
 ;;;### (autoloads (rmail-edit-current-message) "rmailedit" "mail/rmailedit.el"
-;;;;;;  (16211 27034))
+;;;;;;  (16213 43280))
 ;;; Generated autoloads from mail/rmailedit.el
 
 (autoload (quote rmail-edit-current-message) "rmailedit" "\
@@ -18998,7 +20693,7 @@
 
 ;;;### (autoloads (rmail-next-labeled-message rmail-previous-labeled-message
 ;;;;;;  rmail-read-label rmail-kill-label rmail-add-label) "rmailkwd"
-;;;;;;  "mail/rmailkwd.el" (16211 27034))
+;;;;;;  "mail/rmailkwd.el" (16213 43280))
 ;;; Generated autoloads from mail/rmailkwd.el
 
 (autoload (quote rmail-add-label) "rmailkwd" "\
@@ -19037,7 +20732,7 @@
 ;;;***
 
 ;;;### (autoloads (set-rmail-inbox-list) "rmailmsc" "mail/rmailmsc.el"
-;;;;;;  (16211 27035))
+;;;;;;  (16213 43280))
 ;;; Generated autoloads from mail/rmailmsc.el
 
 (autoload (quote set-rmail-inbox-list) "rmailmsc" "\
@@ -19051,7 +20746,7 @@
 
 ;;;### (autoloads (rmail-output-body-to-file rmail-output rmail-fields-not-to-output
 ;;;;;;  rmail-output-to-rmail-file rmail-output-file-alist) "rmailout"
-;;;;;;  "mail/rmailout.el" (16211 27035))
+;;;;;;  "mail/rmailout.el" (16213 43280))
 ;;; Generated autoloads from mail/rmailout.el
 
 (defvar rmail-output-file-alist nil "\
@@ -19118,8 +20813,8 @@
 
 ;;;### (autoloads (rmail-sort-by-labels rmail-sort-by-lines rmail-sort-by-correspondent
 ;;;;;;  rmail-sort-by-recipient rmail-sort-by-author rmail-sort-by-subject
-;;;;;;  rmail-sort-by-date) "rmailsort" "mail/rmailsort.el" (16211
-;;;;;;  27036))
+;;;;;;  rmail-sort-by-date) "rmailsort" "mail/rmailsort.el" (16213
+;;;;;;  43280))
 ;;; Generated autoloads from mail/rmailsort.el
 
 (autoload (quote rmail-sort-by-date) "rmailsort" "\
@@ -19171,7 +20866,7 @@
 ;;;;;;  rmail-summary-by-senders rmail-summary-by-topic rmail-summary-by-regexp
 ;;;;;;  rmail-summary-by-recipients rmail-summary-by-labels rmail-summary
 ;;;;;;  rmail-summary-line-count-flag rmail-summary-scroll-between-messages)
-;;;;;;  "rmailsum" "mail/rmailsum.el" (16292 22309))
+;;;;;;  "rmailsum" "mail/rmailsum.el" (16294 21153))
 ;;; Generated autoloads from mail/rmailsum.el
 
 (defvar rmail-summary-scroll-between-messages t "\
@@ -19253,7 +20948,7 @@
 ;;;***
 
 ;;;### (autoloads (news-post-news) "rnewspost" "obsolete/rnewspost.el"
-;;;;;;  (16211 27037))
+;;;;;;  (16213 43281))
 ;;; Generated autoloads from obsolete/rnewspost.el
 
 (autoload (quote news-post-news) "rnewspost" "\
@@ -19266,7 +20961,7 @@
 ;;;***
 
 ;;;### (autoloads (toggle-rot13-mode rot13-other-window rot13-region
-;;;;;;  rot13-string rot13) "rot13" "rot13.el" (16211 27018))
+;;;;;;  rot13-string rot13) "rot13" "rot13.el" (16213 43271))
 ;;; Generated autoloads from rot13.el
 
 (autoload (quote rot13) "rot13" "\
@@ -19307,7 +21002,7 @@
 ;;;;;;  resize-minibuffer-frame-max-height resize-minibuffer-frame
 ;;;;;;  resize-minibuffer-window-exactly resize-minibuffer-window-max-height
 ;;;;;;  resize-minibuffer-mode) "rsz-mini" "obsolete/rsz-mini.el"
-;;;;;;  (16211 27037))
+;;;;;;  (16507 41097))
 ;;; Generated autoloads from obsolete/rsz-mini.el
 
 (defvar resize-minibuffer-mode nil "\
@@ -19347,8 +21042,8 @@
 
 ;;;***
 
-;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (16277
-;;;;;;  42321))
+;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (16478
+;;;;;;  51572))
 ;;; Generated autoloads from ruler-mode.el
 
 (autoload (quote ruler-mode) "ruler-mode" "\
@@ -19358,8 +21053,8 @@
 
 ;;;***
 
-;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (16292
-;;;;;;  22309))
+;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (16534
+;;;;;;  3808))
 ;;; Generated autoloads from emacs-lisp/rx.el
 
 (autoload (quote rx-to-string) "rx" "\
@@ -19370,7 +21065,8 @@
 \(fn FORM &optional NO-GROUP)" nil nil)
 
 (autoload (quote rx) "rx" "\
-Translate a regular expression REGEXP in sexp form to a regexp string.
+Translate regular expressions REGEXPS in sexp form to a regexp string.
+REGEXPS is a non-empty sequence of forms of the sort listed below.
 See also `rx-to-string' for how to do such a translation at run-time.
 
 The following are valid subforms of regular expressions in sexp
@@ -19382,53 +21078,58 @@
 CHAR
      matches character CHAR literally.
 
-`not-newline'
+`not-newline', `nonl'
      matches any character except a newline.
 			.
 `anything'
      matches any character
 
-`(any SET)'
-     matches any character in SET.  SET may be a character or string.
+`(any SET ...)'
+`(in SET ...)'
+`(char SET ...)'
+     matches any character in SET ....  SET may be a character or string.
      Ranges of characters can be specified as `A-Z' in strings.
-
-'(in SET)'
-     like `any'.
-
-`(not (any SET))'
-     matches any character not in SET
-
-`line-start'
+     Ranges may also be specified as conses like `(?A . ?Z)'.
+
+     SET may also be the name of a character class: `digit',
+     `control', `hex-digit', `blank', `graph', `print', `alnum',
+     `alpha', `ascii', `nonascii', `lower', `punct', `space', `upper',
+     `word', or one of their synonyms.
+
+`(not (any SET ...))'
+     matches any character not in SET ...
+
+`line-start', `bol'
      matches the empty string, but only at the beginning of a line
      in the text being matched
 
-`line-end'
+`line-end', `eol'
      is similar to `line-start' but matches only at the end of a line
 
-`string-start'
+`string-start', `bos', `bot'
      matches the empty string, but only at the beginning of the
      string being matched against.
 
-`string-end'
+`string-end', `eos', `eot'
      matches the empty string, but only at the end of the
      string being matched against.
 
 `buffer-start'
      matches the empty string, but only at the beginning of the
-     buffer being matched against.
+     buffer being matched against.  Actually equivalent to `string-start'.
 
 `buffer-end'
      matches the empty string, but only at the end of the
-     buffer being matched against.
+     buffer being matched against.  Actually equivalent to `string-end'.
 
 `point'
      matches the empty string, but only at point.
 
-`word-start'
+`word-start', `bow'
      matches the empty string, but only at the beginning or end of a
      word.
 
-`word-end'
+`word-end', `eow'
      matches the empty string, but only at the end of a word.
 
 `word-boundary'
@@ -19436,34 +21137,35 @@
      word.
 
 `(not word-boundary)'
+`not-word-boundary'
      matches the empty string, but not at the beginning or end of a
      word.
 
-`digit'
+`digit', `numeric', `num'
      matches 0 through 9.
 
-`control'
+`control', `cntrl'
      matches ASCII control characters.
 
-`hex-digit'
+`hex-digit', `hex', `xdigit'
      matches 0 through 9, a through f and A through F.
 
 `blank'
      matches space and tab only.
 
-`graphic'
+`graphic', `graph'
      matches graphic characters--everything except ASCII control chars,
      space, and DEL.
 
-`printing'
+`printing', `print'
      matches printing characters--everything except ASCII control chars
      and DEL.
 
-`alphanumeric'
+`alphanumeric', `alnum'
      matches letters and digits.  (But at present, for multibyte characters,
      it matches anything that has word syntax.)
 
-`letter'
+`letter', `alphabetic', `alpha'
      matches letters.  (But at present, for multibyte characters,
      it matches anything that has word syntax.)
 
@@ -19473,25 +21175,29 @@
 `nonascii'
      matches non-ASCII (multibyte) characters.
 
-`lower'
+`lower', `lower-case'
      matches anything lower-case.
 
-`upper'
+`upper', `upper-case'
      matches anything upper-case.
 
-`punctuation'
+`punctuation', `punct'
      matches punctuation.  (But at present, for multibyte characters,
      it matches anything that has non-word syntax.)
 
-`space'
+`space', `whitespace', `white'
      matches anything that has whitespace syntax.
 
-`word'
+`word', `wordchar'
      matches anything that has word syntax.
 
+`not-wordchar'
+     matches anything that has non-word syntax.
+
 `(syntax SYNTAX)'
      matches a character with syntax SYNTAX.  SYNTAX must be one
-     of the following symbols.
+     of the following symbols, or a symbol corresponding to the syntax
+     character, e.g. `\\.' for `\\s.'.
 
      `whitespace'		(\\s- in string notation)
      `punctuation'		(\\s.)
@@ -19506,9 +21212,11 @@
      `character-quote'		(\\s/)
      `comment-start'		(\\s<)
      `comment-end'		(\\s>)
+     `string-delimiter'		(\\s|)
+     `comment-delimiter'	(\\s!)
 
 `(not (syntax SYNTAX))'
-     matches a character that has not syntax SYNTAX.
+     matches a character that doesn't have syntax SYNTAX.
 
 `(category CATEGORY)'
      matches a character with category CATEGORY.  CATEGORY must be
@@ -19534,6 +21242,7 @@
      `japanese-katakana-two-byte'	(\\cK)
      `korean-hangul-two-byte'		(\\cN)
      `cyrillic-two-byte'		(\\cY)
+     `combining-diacritic'		(\\c^)
      `ascii'				(\\ca)
      `arabic'				(\\cb)
      `chinese'				(\\cc)
@@ -19554,12 +21263,16 @@
      `can-break'			(\\c|)
 
 `(not (category CATEGORY))'
-     matches a character that has not category CATEGORY.
+     matches a character that doesn't have category CATEGORY.
 
 `(and SEXP1 SEXP2 ...)'
+`(: SEXP1 SEXP2 ...)'
+`(seq SEXP1 SEXP2 ...)'
+`(sequence SEXP1 SEXP2 ...)'
      matches what SEXP1 matches, followed by what SEXP2 matches, etc.
 
 `(submatch SEXP1 SEXP2 ...)'
+`(group SEXP1 SEXP2 ...)'
      like `and', but makes the match accessible with `match-end',
      `match-beginning', and `match-string'.
 
@@ -19567,74 +21280,89 @@
      another name for `submatch'.
 
 `(or SEXP1 SEXP2 ...)'
+`(| SEXP1 SEXP2 ...)'
      matches anything that matches SEXP1 or SEXP2, etc.  If all
      args are strings, use `regexp-opt' to optimize the resulting
      regular expression.
 
 `(minimal-match SEXP)'
      produce a non-greedy regexp for SEXP.  Normally, regexps matching
-     zero or more occurrances of something are \"greedy\" in that they
+     zero or more occurrences of something are \"greedy\" in that they
      match as much as they can, as long as the overall regexp can
      still match.  A non-greedy regexp matches as little as possible.
 
 `(maximal-match SEXP)'
      produce a greedy regexp for SEXP.  This is the default.
 
-`(zero-or-more SEXP)'
-     matches zero or more occurrences of what SEXP matches.
-
-`(0+ SEXP)'
-     like `zero-or-more'.
-
-`(* SEXP)'
-     like `zero-or-more', but always produces a greedy regexp.
-
-`(*? SEXP)'
-     like `zero-or-more', but always produces a non-greedy regexp.
-
-`(one-or-more SEXP)'
-     matches one or more occurrences of A.
-
-`(1+ SEXP)'
-     like `one-or-more'.
-
-`(+ SEXP)'
+Below, `SEXP ...' represents a sequence of regexp forms, treated as if
+enclosed in `(and ...)'.
+
+`(zero-or-more SEXP ...)'
+`(0+ SEXP ...)'
+     matches zero or more occurrences of what SEXP ... matches.
+
+`(* SEXP ...)'
+     like `zero-or-more', but always produces a greedy regexp, independent
+     of `rx-greedy-flag'.
+
+`(*? SEXP ...)'
+     like `zero-or-more', but always produces a non-greedy regexp,
+     independent of `rx-greedy-flag'.
+
+`(one-or-more SEXP ...)'
+`(1+ SEXP ...)'
+     matches one or more occurrences of SEXP ...
+
+`(+ SEXP ...)'
      like `one-or-more', but always produces a greedy regexp.
 
-`(+? SEXP)'
+`(+? SEXP ...)'
      like `one-or-more', but always produces a non-greedy regexp.
 
-`(zero-or-one SEXP)'
+`(zero-or-one SEXP ...)'
+`(optional SEXP ...)'
+`(opt SEXP ...)'
      matches zero or one occurrences of A.
 
-`(optional SEXP)'
-     like `zero-or-one'.
-
-`(? SEXP)'
+`(? SEXP ...)'
      like `zero-or-one', but always produces a greedy regexp.
 
-`(?? SEXP)'
+`(?? SEXP ...)'
      like `zero-or-one', but always produces a non-greedy regexp.
 
 `(repeat N SEXP)'
-     matches N occurrences of what SEXP matches.
+`(= N SEXP ...)'
+     matches N occurrences.
+
+`(>= N SEXP ...)'
+     matches N or more occurrences.
 
 `(repeat N M SEXP)'
-     matches N to M occurrences of what SEXP matches.
+`(** N M SEXP ...)'
+     matches N to M occurrences.
+
+`(backref N)'
+    matches what was matched previously by submatch N.
+
+`(backref N)'
+     matches what was matched previously by submatch N.
+
+`(backref N)'
+    matches what was matched previously by submatch N.
 
 `(eval FORM)'
-      evaluate FORM and insert result.  If result is a string,
-      `regexp-quote' it.
+     evaluate FORM and insert result.  If result is a string,
+     `regexp-quote' it.
 
 `(regexp REGEXP)'
-      include REGEXP in string notation in the result.
-
-\(fn REGEXP)" nil (quote macro))
+     include REGEXP in string notation in the result.
+
+\(fn &rest REGEXPS)" nil (quote macro))
 
 ;;;***
 
 ;;;### (autoloads (dsssl-mode scheme-mode) "scheme" "progmodes/scheme.el"
-;;;;;;  (16249 27909))
+;;;;;;  (16391 49851))
 ;;; Generated autoloads from progmodes/scheme.el
 
 (autoload (quote scheme-mode) "scheme" "\
@@ -19676,7 +21404,7 @@
 ;;;***
 
 ;;;### (autoloads (gnus-score-mode) "score-mode" "gnus/score-mode.el"
-;;;;;;  (16211 27031))
+;;;;;;  (16698 21929))
 ;;; Generated autoloads from gnus/score-mode.el
 
 (autoload (quote gnus-score-mode) "score-mode" "\
@@ -19689,8 +21417,8 @@
 
 ;;;***
 
-;;;### (autoloads (scribe-mode) "scribe" "obsolete/scribe.el" (16211
-;;;;;;  27037))
+;;;### (autoloads (scribe-mode) "scribe" "obsolete/scribe.el" (16213
+;;;;;;  43281))
 ;;; Generated autoloads from obsolete/scribe.el
 
 (autoload (quote scribe-mode) "scribe" "\
@@ -19715,7 +21443,7 @@
 ;;;***
 
 ;;;### (autoloads (scroll-all-mode) "scroll-all" "scroll-all.el"
-;;;;;;  (16211 27018))
+;;;;;;  (16213 43271))
 ;;; Generated autoloads from scroll-all.el
 
 (defvar scroll-all-mode nil "\
@@ -19741,7 +21469,7 @@
 ;;;;;;  mail-alias-file mail-default-reply-to mail-archive-file-name
 ;;;;;;  mail-header-separator send-mail-function mail-yank-ignored-headers
 ;;;;;;  mail-interactive mail-self-blind mail-specify-envelope-from
-;;;;;;  mail-from-style) "sendmail" "mail/sendmail.el" (16249 31404))
+;;;;;;  mail-from-style) "sendmail" "mail/sendmail.el" (16534 3809))
 ;;; Generated autoloads from mail/sendmail.el
 
 (defvar mail-from-style (quote angles) "\
@@ -19949,7 +21677,7 @@
 ;;;***
 
 ;;;### (autoloads (server-mode server-start) "server" "server.el"
-;;;;;;  (16211 27018))
+;;;;;;  (16764 51518))
 ;;; Generated autoloads from server.el
 
 (autoload (quote server-start) "server" "\
@@ -19981,11 +21709,12 @@
 
 ;;;***
 
-;;;### (autoloads (ses-mode) "ses" "ses.el" (16211 27018))
+;;;### (autoloads (ses-mode) "ses" "ses.el" (16801 58023))
 ;;; Generated autoloads from ses.el
 
 (autoload (quote ses-mode) "ses" "\
-Major mode for Simple Emacs Spreadsheet.  See \"ses-readme.txt\" for more info.
+Major mode for Simple Emacs Spreadsheet.
+See \"ses-example.ses\" (in the etc data directory) for more info.
 
 Key definitions:
 \\{ses-mode-map}
@@ -19999,7 +21728,7 @@
 ;;;***
 
 ;;;### (autoloads (html-mode sgml-mode) "sgml-mode" "textmodes/sgml-mode.el"
-;;;;;;  (16211 27044))
+;;;;;;  (16787 16350))
 ;;; Generated autoloads from textmodes/sgml-mode.el
 
 (autoload (quote sgml-mode) "sgml-mode" "\
@@ -20067,7 +21796,7 @@
 ;;;***
 
 ;;;### (autoloads (sh-mode) "sh-script" "progmodes/sh-script.el"
-;;;;;;  (16256 53160))
+;;;;;;  (16820 16328))
 ;;; Generated autoloads from progmodes/sh-script.el
 
 (autoload (quote sh-mode) "sh-script" "\
@@ -20130,8 +21859,22 @@
 
 ;;;***
 
+;;;### (autoloads (sha1) "sha1" "gnus/sha1.el" (16775 26713))
+;;; Generated autoloads from gnus/sha1.el
+
+(autoload (quote sha1) "sha1" "\
+Return the SHA1 (Secure Hash Algorithm) of an object.
+OBJECT is either a string or a buffer.
+Optional arguments BEG and END denote buffer positions for computing the
+hash of a portion of OBJECT.
+If BINARY is non-nil, return a string in binary form.
+
+\(fn OBJECT &optional BEG END BINARY)" nil nil)
+
+;;;***
+
 ;;;### (autoloads (list-load-path-shadows) "shadow" "emacs-lisp/shadow.el"
-;;;;;;  (16211 27026))
+;;;;;;  (16377 12872))
 ;;; Generated autoloads from emacs-lisp/shadow.el
 
 (autoload (quote list-load-path-shadows) "shadow" "\
@@ -20178,8 +21921,8 @@
 ;;;***
 
 ;;;### (autoloads (shadow-initialize shadow-define-regexp-group shadow-define-literal-group
-;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (16211
-;;;;;;  27018))
+;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (16768
+;;;;;;  48631))
 ;;; Generated autoloads from shadowfile.el
 
 (autoload (quote shadow-define-cluster) "shadowfile" "\
@@ -20218,7 +21961,7 @@
 ;;;***
 
 ;;;### (autoloads (shell shell-dumb-shell-regexp) "shell" "shell.el"
-;;;;;;  (16211 27018))
+;;;;;;  (16377 12872))
 ;;; Generated autoloads from shell.el
 
 (defvar shell-dumb-shell-regexp "cmd\\(proxy\\)?\\.exe" "\
@@ -20264,8 +22007,45 @@
 
 ;;;***
 
-;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (16211
-;;;;;;  27039))
+;;;### (autoloads (sieve-upload-and-bury sieve-upload sieve-manage)
+;;;;;;  "sieve" "gnus/sieve.el" (16775 26714))
+;;; Generated autoloads from gnus/sieve.el
+
+(autoload (quote sieve-manage) "sieve" "\
+Not documented
+
+\(fn SERVER &optional PORT)" t nil)
+
+(autoload (quote sieve-upload) "sieve" "\
+Not documented
+
+\(fn &optional NAME)" t nil)
+
+(autoload (quote sieve-upload-and-bury) "sieve" "\
+Not documented
+
+\(fn &optional NAME)" t nil)
+
+;;;***
+
+;;;### (autoloads (sieve-mode) "sieve-mode" "gnus/sieve-mode.el"
+;;;;;;  (16697 49031))
+;;; Generated autoloads from gnus/sieve-mode.el
+
+(autoload (quote sieve-mode) "sieve-mode" "\
+Major mode for editing Sieve code.
+This is much like C mode except for the syntax of comments.  Its keymap
+inherits from C mode's and it has the same variables for customizing
+indentation.  It has its own abbrev table and its own syntax table.
+
+Turning on Sieve mode runs `sieve-mode-hook'.
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (16213
+;;;;;;  43282))
 ;;; Generated autoloads from progmodes/simula.el
 
 (autoload (quote simula-mode) "simula" "\
@@ -20314,7 +22094,7 @@
 ;;;***
 
 ;;;### (autoloads (skeleton-pair-insert-maybe skeleton-insert skeleton-proxy-new
-;;;;;;  define-skeleton) "skeleton" "skeleton.el" (16211 27018))
+;;;;;;  define-skeleton) "skeleton" "skeleton.el" (16213 43271))
 ;;; Generated autoloads from skeleton.el
 
 (defvar skeleton-filter (quote identity) "\
@@ -20424,7 +22204,7 @@
 ;;;***
 
 ;;;### (autoloads (smerge-mode smerge-ediff) "smerge-mode" "smerge-mode.el"
-;;;;;;  (16258 10857))
+;;;;;;  (16534 3808))
 ;;; Generated autoloads from smerge-mode.el
 
 (autoload (quote smerge-ediff) "smerge-mode" "\
@@ -20442,22 +22222,26 @@
 
 ;;;***
 
-;;;### (autoloads (smiley-region) "smiley-ems" "gnus/smiley-ems.el"
-;;;;;;  (16211 27031))
-;;; Generated autoloads from gnus/smiley-ems.el
-
-(autoload (quote smiley-region) "smiley-ems" "\
-Display textual smileys as images.
-START and END specify the region; interactively, use the values
-of point and mark.  The value of `smiley-regexp-alist' determines
-which smileys to operate on and which images to use for them.
+;;;### (autoloads (smiley-buffer smiley-region) "smiley" "gnus/smiley.el"
+;;;;;;  (16719 60886))
+;;; Generated autoloads from gnus/smiley.el
+
+(autoload (quote smiley-region) "smiley" "\
+Replace in the region `smiley-regexp-alist' matches with corresponding images.
+A list of images is returned.
 
 \(fn START END)" t nil)
 
+(autoload (quote smiley-buffer) "smiley" "\
+Run `smiley-region' at the buffer, specified in the argument or
+interactively. If there's no argument, do it at the current buffer
+
+\(fn &optional BUFFER)" t nil)
+
 ;;;***
 
 ;;;### (autoloads (smtpmail-send-queued-mail smtpmail-send-it) "smtpmail"
-;;;;;;  "mail/smtpmail.el" (16246 41418))
+;;;;;;  "mail/smtpmail.el" (16747 61767))
 ;;; Generated autoloads from mail/smtpmail.el
 
 (autoload (quote smtpmail-send-it) "smtpmail" "\
@@ -20472,7 +22256,7 @@
 
 ;;;***
 
-;;;### (autoloads (snake) "snake" "play/snake.el" (16211 27038))
+;;;### (autoloads (snake) "snake" "play/snake.el" (16213 43281))
 ;;; Generated autoloads from play/snake.el
 
 (autoload (quote snake) "snake" "\
@@ -20496,7 +22280,7 @@
 ;;;***
 
 ;;;### (autoloads (snmpv2-mode snmp-mode) "snmp-mode" "net/snmp-mode.el"
-;;;;;;  (16211 27037))
+;;;;;;  (16213 43280))
 ;;; Generated autoloads from net/snmp-mode.el
 
 (autoload (quote snmp-mode) "snmp-mode" "\
@@ -20527,7 +22311,7 @@
 
 ;;;### (autoloads (solar-equinoxes-solstices sunrise-sunset calendar-location-name
 ;;;;;;  calendar-longitude calendar-latitude calendar-time-display-form)
-;;;;;;  "solar" "calendar/solar.el" (16211 27023))
+;;;;;;  "solar" "calendar/solar.el" (16213 43272))
 ;;; Generated autoloads from calendar/solar.el
 
 (defvar calendar-time-display-form (quote (12-hours ":" minutes am-pm (if time-zone " (") time-zone (if time-zone ")"))) "\
@@ -20598,8 +22382,8 @@
 
 ;;;***
 
-;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (16211
-;;;;;;  27038))
+;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (16213
+;;;;;;  43281))
 ;;; Generated autoloads from play/solitaire.el
 
 (autoload (quote solitaire) "solitaire" "\
@@ -20676,7 +22460,7 @@
 
 ;;;### (autoloads (reverse-region sort-columns sort-regexp-fields
 ;;;;;;  sort-fields sort-numeric-fields sort-pages sort-paragraphs
-;;;;;;  sort-lines sort-subr) "sort" "sort.el" (16211 27018))
+;;;;;;  sort-lines sort-subr) "sort" "sort.el" (16460 18645))
 ;;; Generated autoloads from sort.el
 
 (autoload (quote sort-subr) "sort" "\
@@ -20818,8 +22602,19 @@
 
 ;;;***
 
+;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (16777
+;;;;;;  65418))
+;;; Generated autoloads from gnus/spam.el
+
+(autoload (quote spam-initialize) "spam" "\
+Install the spam.el hooks and do other initialization
+
+\(fn)" t nil)
+
+;;;***
+
 ;;;### (autoloads (speedbar-get-focus speedbar-frame-mode) "speedbar"
-;;;;;;  "speedbar.el" (16211 27019))
+;;;;;;  "speedbar.el" (16775 26708))
 ;;; Generated autoloads from speedbar.el
 
 (defalias (quote speedbar) (quote speedbar-frame-mode))
@@ -20844,7 +22639,7 @@
 ;;;***
 
 ;;;### (autoloads (spell-string spell-region spell-word spell-buffer)
-;;;;;;  "spell" "textmodes/spell.el" (16211 27044))
+;;;;;;  "spell" "textmodes/spell.el" (16213 43284))
 ;;; Generated autoloads from textmodes/spell.el
 
 (put (quote spell-filter) (quote risky-local-variable) t)
@@ -20880,8 +22675,8 @@
 
 ;;;***
 
-;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (16211
-;;;;;;  27038))
+;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (16213
+;;;;;;  43281))
 ;;; Generated autoloads from play/spook.el
 
 (autoload (quote spook) "spook" "\
@@ -20899,15 +22694,30 @@
 ;;;### (autoloads (sql-linter sql-db2 sql-interbase sql-postgres
 ;;;;;;  sql-ms sql-ingres sql-solid sql-mysql sql-sqlite sql-informix
 ;;;;;;  sql-sybase sql-oracle sql-product-interactive sql-mode sql-help
-;;;;;;  sql-add-product-keywords) "sql" "progmodes/sql.el" (16225
-;;;;;;  6527))
+;;;;;;  sql-add-product-keywords) "sql" "progmodes/sql.el" (16536
+;;;;;;  52890))
 ;;; Generated autoloads from progmodes/sql.el
 
 (autoload (quote sql-add-product-keywords) "sql" "\
-Append a `font-lock-keywords' entry to the existing entries defined
-  for the specified `product'.
-
-\(fn PRODUCT KEYWORDS)" nil nil)
+Add highlighting KEYWORDS for SQL PRODUCT.
+
+PRODUCT should be a symbol, the name of a sql product, such as
+`oracle'.  KEYWORDS should be a list; see the variable
+`font-lock-keywords'.  By default they are added at the beginning
+of the current highlighting list.  If optional argument APPEND is
+`set', they are used to replace the current highlighting list.
+If APPEND is any other non-nil value, they are added at the end
+of the current highlighting list.
+
+For example:
+
+ (sql-add-product-keywords 'ms
+  '((\"\\\\b\\\\w+_t\\\\b\" . font-lock-type-face)))
+
+adds a fontification pattern to fontify identifiers ending in
+`_t' as data types.
+
+\(fn PRODUCT KEYWORDS &optional APPEND)" nil nil)
 
 (autoload (quote sql-help) "sql" "\
 Show short help for the SQL modes.
@@ -21316,8 +23126,8 @@
 ;;;;;;  strokes-mode strokes-list-strokes strokes-load-user-strokes
 ;;;;;;  strokes-help strokes-describe-stroke strokes-do-complex-stroke
 ;;;;;;  strokes-do-stroke strokes-read-complex-stroke strokes-read-stroke
-;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (16258
-;;;;;;  10857))
+;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (16768
+;;;;;;  48632))
 ;;; Generated autoloads from strokes.el
 
 (autoload (quote strokes-global-set-stroke) "strokes" "\
@@ -21327,6 +23137,8 @@
 is a list of sampled positions on the stroke grid as described in the
 documentation for the `strokes-define-stroke' function.
 
+See also `strokes-global-set-stroke-string'.
+
 \(fn STROKE COMMAND)" t nil)
 
 (autoload (quote strokes-read-stroke) "strokes" "\
@@ -21424,7 +23236,7 @@
 ;;;***
 
 ;;;### (autoloads (studlify-buffer studlify-word studlify-region)
-;;;;;;  "studly" "play/studly.el" (16211 27038))
+;;;;;;  "studly" "play/studly.el" (16213 43281))
 ;;; Generated autoloads from play/studly.el
 
 (autoload (quote studlify-region) "studly" "\
@@ -21445,7 +23257,7 @@
 ;;;***
 
 ;;;### (autoloads (sc-cite-original) "supercite" "mail/supercite.el"
-;;;;;;  (16211 27036))
+;;;;;;  (16808 48569))
 ;;; Generated autoloads from mail/supercite.el
 
 (autoload (quote sc-cite-original) "supercite" "\
@@ -21477,8 +23289,8 @@
 
 ;;;***
 
-;;;### (autoloads (syntax-ppss) "syntax" "emacs-lisp/syntax.el" (16211
-;;;;;;  27026))
+;;;### (autoloads (syntax-ppss) "syntax" "emacs-lisp/syntax.el" (16213
+;;;;;;  43273))
 ;;; Generated autoloads from emacs-lisp/syntax.el
 
 (autoload (quote syntax-ppss) "syntax" "\
@@ -21491,7 +23303,7 @@
 
 ;;;***
 
-;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (16211 27021))
+;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (16213 43271))
 ;;; Generated autoloads from tabify.el
 
 (autoload (quote untabify) "tabify" "\
@@ -21526,7 +23338,7 @@
 ;;;;;;  table-recognize table-insert-row-column table-insert-column
 ;;;;;;  table-insert-row table-insert table-point-left-cell-hook
 ;;;;;;  table-point-entered-cell-hook table-load-hook table-cell-map-hook)
-;;;;;;  "table" "textmodes/table.el" (16211 27044))
+;;;;;;  "table" "textmodes/table.el" (16779 20952))
 ;;; Generated autoloads from textmodes/table.el
 
 (defvar table-cell-map-hook nil "\
@@ -22114,7 +23926,7 @@
 
 ;;;***
 
-;;;### (autoloads (talk-connect) "talk" "talk.el" (16211 27021))
+;;;### (autoloads (talk-connect) "talk" "talk.el" (16213 43271))
 ;;; Generated autoloads from talk.el
 
 (autoload (quote talk-connect) "talk" "\
@@ -22124,7 +23936,7 @@
 
 ;;;***
 
-;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (16211 27021))
+;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (16768 48632))
 ;;; Generated autoloads from tar-mode.el
 
 (autoload (quote tar-mode) "tar-mode" "\
@@ -22148,7 +23960,7 @@
 ;;;***
 
 ;;;### (autoloads (tcl-help-on-word inferior-tcl tcl-mode) "tcl"
-;;;;;;  "progmodes/tcl.el" (16211 27039))
+;;;;;;  "progmodes/tcl.el" (16808 48570))
 ;;; Generated autoloads from progmodes/tcl.el
 
 (autoload (quote tcl-mode) "tcl" "\
@@ -22199,19 +24011,22 @@
 
 ;;;***
 
-;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (16211 27037))
+;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (16548 34615))
 ;;; Generated autoloads from net/telnet.el
  (add-hook 'same-window-regexps "\\*telnet-.*\\*\\(\\|<[0-9]+>\\)")
 
 (autoload (quote telnet) "telnet" "\
 Open a network login connection to host named HOST (a string).
+Optional arg PORT specifies alternative port to connect to.
+Interactively, use \\[universal-argument] prefix to be prompted for port number.
+
 Communication with HOST is recorded in a buffer `*PROGRAM-HOST*'
 where PROGRAM is the telnet program being used.  This program
 is controlled by the contents of the global variable `telnet-host-properties',
 falling back on the value of the global variable `telnet-program'.
 Normally input is edited in Emacs and sent a line at a time.
 
-\(fn HOST)" t nil)
+\(fn HOST &optional PORT)" t nil)
  (add-hook 'same-window-regexps "\\*rsh-[^-]*\\*\\(\\|<[0-9]*>\\)")
 
 (autoload (quote rsh) "telnet" "\
@@ -22223,8 +24038,8 @@
 
 ;;;***
 
-;;;### (autoloads (ansi-term term make-term) "term" "term.el" (16211
-;;;;;;  27021))
+;;;### (autoloads (ansi-term term make-term) "term" "term.el" (16805
+;;;;;;  44920))
 ;;; Generated autoloads from term.el
 
 (autoload (quote make-term) "term" "\
@@ -22252,8 +24067,8 @@
 
 ;;;***
 
-;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (16211
-;;;;;;  27021))
+;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (16698
+;;;;;;  21926))
 ;;; Generated autoloads from terminal.el
 
 (autoload (quote terminal-emulator) "terminal" "\
@@ -22289,18 +24104,10 @@
 
 ;;;***
 
-;;;### (autoloads (testcover-this-defun testcover-start) "testcover"
-;;;;;;  "emacs-lisp/testcover.el" (16211 27026))
+;;;### (autoloads (testcover-this-defun) "testcover" "emacs-lisp/testcover.el"
+;;;;;;  (16635 35907))
 ;;; Generated autoloads from emacs-lisp/testcover.el
 
-(autoload (quote testcover-start) "testcover" "\
-Uses edebug to instrument all macros and functions in FILENAME, then
-changes the instrumentation from edebug to testcover--much faster, no
-problems with type-ahead or post-command-hook, etc.  If BYTE-COMPILE is
-non-nil, byte-compiles each function after instrumenting.
-
-\(fn FILENAME &optional BYTE-COMPILE)" t nil)
-
 (autoload (quote testcover-this-defun) "testcover" "\
 Start coverage on function under point.
 
@@ -22308,7 +24115,7 @@
 
 ;;;***
 
-;;;### (autoloads (tetris) "tetris" "play/tetris.el" (16211 27038))
+;;;### (autoloads (tetris) "tetris" "play/tetris.el" (16213 43281))
 ;;; Generated autoloads from play/tetris.el
 
 (autoload (quote tetris) "tetris" "\
@@ -22339,7 +24146,7 @@
 ;;;;;;  tex-start-commands tex-start-options slitex-run-command latex-run-command
 ;;;;;;  tex-run-command tex-offer-save tex-main-file tex-first-line-header-regexp
 ;;;;;;  tex-directory tex-shell-file-name) "tex-mode" "textmodes/tex-mode.el"
-;;;;;;  (16291 51938))
+;;;;;;  (16820 16329))
 ;;; Generated autoloads from textmodes/tex-mode.el
 
 (defvar tex-shell-file-name nil "\
@@ -22448,7 +24255,7 @@
 
 (custom-autoload (quote tex-alt-dvi-print-command) "tex-mode")
 
-(defvar tex-dvi-view-command (quote (if (eq window-system (quote x)) "xdvi" "dvi2tty * | cat -s")) "\
+(defvar tex-dvi-view-command (quote (cond ((eq window-system (quote x)) "xdvi") ((eq window-system (quote w32)) "yap") (t "dvi2tty * | cat -s"))) "\
 *Command used by \\[tex-view] to display a `.dvi' file.
 If it is a string, that specifies the command directly.
 If this string contains an asterisk (`*'), that is replaced by the file name;
@@ -22641,7 +24448,7 @@
 ;;;***
 
 ;;;### (autoloads (texi2info texinfo-format-region texinfo-format-buffer)
-;;;;;;  "texinfmt" "textmodes/texinfmt.el" (16292 22308))
+;;;;;;  "texinfmt" "textmodes/texinfmt.el" (16565 48737))
 ;;; Generated autoloads from textmodes/texinfmt.el
 
 (autoload (quote texinfo-format-buffer) "texinfmt" "\
@@ -22681,7 +24488,7 @@
 ;;;***
 
 ;;;### (autoloads (texinfo-mode texinfo-close-quote texinfo-open-quote)
-;;;;;;  "texinfo" "textmodes/texinfo.el" (16211 27044))
+;;;;;;  "texinfo" "textmodes/texinfo.el" (16777 65419))
 ;;; Generated autoloads from textmodes/texinfo.el
 
 (defvar texinfo-open-quote "``" "\
@@ -22767,7 +24574,7 @@
 
 ;;;### (autoloads (thai-composition-function thai-post-read-conversion
 ;;;;;;  thai-compose-buffer thai-compose-string thai-compose-region)
-;;;;;;  "thai-util" "language/thai-util.el" (16211 27033))
+;;;;;;  "thai-util" "language/thai-util.el" (16213 43280))
 ;;; Generated autoloads from language/thai-util.el
 
 (autoload (quote thai-compose-region) "thai-util" "\
@@ -22806,7 +24613,7 @@
 
 ;;;### (autoloads (list-at-point number-at-point symbol-at-point
 ;;;;;;  sexp-at-point thing-at-point bounds-of-thing-at-point forward-thing)
-;;;;;;  "thingatpt" "thingatpt.el" (16211 27021))
+;;;;;;  "thingatpt" "thingatpt.el" (16213 43271))
 ;;; Generated autoloads from thingatpt.el
 
 (autoload (quote forward-thing) "thingatpt" "\
@@ -22861,12 +24668,48 @@
 
 ;;;***
 
+;;;### (autoloads (thumbs-dired-setroot thumbs-dired-show-all thumbs-dired-show-marked
+;;;;;;  thumbs-show-all-from-dir thumbs-find-thumb) "thumbs" "thumbs.el"
+;;;;;;  (16775 26708))
+;;; Generated autoloads from thumbs.el
+
+(autoload (quote thumbs-find-thumb) "thumbs" "\
+Display the thumbnail for IMG.
+
+\(fn IMG)" t nil)
+
+(autoload (quote thumbs-show-all-from-dir) "thumbs" "\
+Make a preview buffer for all images in DIR.
+Optional argument REG to select file matching a regexp,
+and SAME-WINDOW to show thumbs in the same window.
+
+\(fn DIR &optional REG SAME-WINDOW)" t nil)
+
+(autoload (quote thumbs-dired-show-marked) "thumbs" "\
+In Dired, make a thumbs buffer with all marked files.
+
+\(fn)" t nil)
+
+(autoload (quote thumbs-dired-show-all) "thumbs" "\
+In dired, make a thumbs buffer with all files in current directory.
+
+\(fn)" t nil)
+
+(defalias (quote thumbs) (quote thumbs-show-all-from-dir))
+
+(autoload (quote thumbs-dired-setroot) "thumbs" "\
+In dired, Call the setroot program on the image at point.
+
+\(fn)" t nil)
+
+;;;***
+
 ;;;### (autoloads (tibetan-pre-write-canonicalize-for-unicode tibetan-pre-write-conversion
 ;;;;;;  tibetan-post-read-conversion tibetan-compose-buffer tibetan-decompose-buffer
 ;;;;;;  tibetan-composition-function tibetan-decompose-string tibetan-decompose-region
 ;;;;;;  tibetan-compose-region tibetan-compose-string tibetan-transcription-to-tibetan
 ;;;;;;  tibetan-tibetan-to-transcription tibetan-char-p) "tibet-util"
-;;;;;;  "language/tibet-util.el" (16211 27033))
+;;;;;;  "language/tibet-util.el" (16213 43280))
 ;;; Generated autoloads from language/tibet-util.el
 
 (autoload (quote tibetan-char-p) "tibet-util" "\
@@ -22945,7 +24788,7 @@
 ;;;***
 
 ;;;### (autoloads (tildify-buffer tildify-region) "tildify" "textmodes/tildify.el"
-;;;;;;  (16211 27044))
+;;;;;;  (16213 43284))
 ;;; Generated autoloads from textmodes/tildify.el
 
 (autoload (quote tildify-region) "tildify" "\
@@ -22969,7 +24812,7 @@
 ;;;***
 
 ;;;### (autoloads (display-time-mode display-time display-time-day-and-date)
-;;;;;;  "time" "time.el" (16211 27021))
+;;;;;;  "time" "time.el" (16484 6599))
 ;;; Generated autoloads from time.el
 
 (defvar display-time-day-and-date nil "\
@@ -23009,8 +24852,9 @@
 
 ;;;### (autoloads (safe-date-to-time time-to-days time-to-day-in-year
 ;;;;;;  date-leap-year-p days-between date-to-day time-add time-subtract
-;;;;;;  time-since days-to-time time-less-p seconds-to-time date-to-time)
-;;;;;;  "time-date" "calendar/time-date.el" (16211 27023))
+;;;;;;  time-since days-to-time time-less-p seconds-to-time time-to-seconds
+;;;;;;  date-to-time) "time-date" "calendar/time-date.el" (16698
+;;;;;;  21926))
 ;;; Generated autoloads from calendar/time-date.el
 
 (autoload (quote date-to-time) "time-date" "\
@@ -23018,6 +24862,12 @@
 
 \(fn DATE)" nil nil)
 
+(autoload (quote time-to-seconds) "time-date" "\
+Convert time value TIME to a floating point number.
+You can use `float-time' instead.
+
+\(fn TIME)" nil nil)
+
 (autoload (quote seconds-to-time) "time-date" "\
 Convert SECONDS (a floating point number) to a time value.
 
@@ -23070,7 +24920,7 @@
 \(fn YEAR)" nil nil)
 
 (autoload (quote time-to-day-in-year) "time-date" "\
-Return the day number within the year of the date month/day/year.
+Return the day number within the year corresponding to TIME.
 
 \(fn TIME)" nil nil)
 
@@ -23090,14 +24940,15 @@
 ;;;***
 
 ;;;### (autoloads (time-stamp-toggle-active time-stamp) "time-stamp"
-;;;;;;  "time-stamp.el" (16211 27021))
+;;;;;;  "time-stamp.el" (16589 26258))
 ;;; Generated autoloads from time-stamp.el
 
 (autoload (quote time-stamp) "time-stamp" "\
 Update the time stamp string(s) in the buffer.
 A template in a file can be automatically updated with a new time stamp
 every time you save the file.  Add this line to your .emacs file:
-    (add-hook 'write-file-hooks 'time-stamp)
+    (add-hook 'before-save-hook 'time-stamp)
+or customize `before-save-hook' through Custom.
 Normally the template must appear in the first 8 lines of a file and
 look like one of the following:
       Time-stamp: <>
@@ -23124,7 +24975,7 @@
 ;;;;;;  timeclock-workday-remaining-string timeclock-reread-log timeclock-query-out
 ;;;;;;  timeclock-change timeclock-status-string timeclock-out timeclock-in
 ;;;;;;  timeclock-modeline-display) "timeclock" "calendar/timeclock.el"
-;;;;;;  (16211 27023))
+;;;;;;  (16534 3808))
 ;;; Generated autoloads from calendar/timeclock.el
 
 (autoload (quote timeclock-modeline-display) "timeclock" "\
@@ -23148,7 +24999,7 @@
 _seconds_ worked today*.  This feature only has effect the first time
 this function is called within a day.
 
-PROJECT as the project being clocked into.  If PROJECT is nil, and
+PROJECT is the project being clocked into.  If PROJECT is nil, and
 FIND-PROJECT is non-nil -- or the user calls `timeclock-in'
 interactively -- call the function `timeclock-get-project-function' to
 discover the name of the project.
@@ -23176,15 +25027,16 @@
 \(fn &optional SHOW-SECONDS TODAY-ONLY)" t nil)
 
 (autoload (quote timeclock-change) "timeclock" "\
-Change to working on a different project, by clocking in then out.
-With a prefix ARG, consider the previous project as having been
-finished at the time of changeover.  PROJECT is the name of the last
-project you were working on.
+Change to working on a different project.
+This clocks out of the current project, then clocks in on a new one.
+With a prefix ARG, consider the previous project as finished at the
+time of changeover.  PROJECT is the name of the last project you were
+working on.
 
 \(fn &optional ARG PROJECT)" t nil)
 
 (autoload (quote timeclock-query-out) "timeclock" "\
-Ask the user before clocking out.
+Ask the user whether to clock out.
 This is a useful function for adding to `kill-emacs-query-functions'.
 
 \(fn)" nil nil)
@@ -23212,7 +25064,7 @@
 \(fn &optional SHOW-SECONDS)" t nil)
 
 (autoload (quote timeclock-when-to-leave-string) "timeclock" "\
-Return a string representing at what time the workday ends today.
+Return a string representing the end of today's workday.
 This string is relative to the value of `timeclock-workday'.  If
 SHOW-SECONDS is non-nil, the value printed/returned will include
 seconds.  If TODAY-ONLY is non-nil, the value returned will be
@@ -23224,7 +25076,7 @@
 
 ;;;### (autoloads (with-timeout run-with-idle-timer add-timeout run-with-timer
 ;;;;;;  run-at-time cancel-function-timers cancel-timer) "timer"
-;;;;;;  "emacs-lisp/timer.el" (16211 27026))
+;;;;;;  "emacs-lisp/timer.el" (16552 32697))
 ;;; Generated autoloads from emacs-lisp/timer.el
 
 (defalias (quote disable-timeout) (quote cancel-timer))
@@ -23297,7 +25149,7 @@
 ;;;***
 
 ;;;### (autoloads (batch-titdic-convert titdic-convert) "titdic-cnv"
-;;;;;;  "international/titdic-cnv.el" (16213 6000))
+;;;;;;  "international/titdic-cnv.el" (16534 3808))
 ;;; Generated autoloads from international/titdic-cnv.el
 
 (autoload (quote titdic-convert) "titdic-cnv" "\
@@ -23320,8 +25172,8 @@
 ;;;***
 
 ;;;### (autoloads (tamil-composition-function tamil-post-read-conversion
-;;;;;;  tamil-compose-region) "tml-util" "language/tml-util.el" (16232
-;;;;;;  585))
+;;;;;;  tamil-compose-region) "tml-util" "language/tml-util.el" (16233
+;;;;;;  29568))
 ;;; Generated autoloads from language/tml-util.el
 
 (autoload (quote tamil-compose-region) "tml-util" "\
@@ -23344,7 +25196,7 @@
 ;;;***
 
 ;;;### (autoloads (tmm-prompt tmm-menubar-mouse tmm-menubar) "tmm"
-;;;;;;  "tmm.el" (16211 27021))
+;;;;;;  "tmm.el" (16213 43271))
 ;;; Generated autoloads from tmm.el
  (define-key global-map "\M-`" 'tmm-menubar)
  (define-key global-map [f10] 'tmm-menubar)
@@ -23385,7 +25237,7 @@
 
 ;;;### (autoloads (todo-show todo-cp todo-mode todo-print todo-top-priorities
 ;;;;;;  todo-insert-item todo-add-item-non-interactively todo-add-category)
-;;;;;;  "todo-mode" "calendar/todo-mode.el" (16211 27023))
+;;;;;;  "todo-mode" "calendar/todo-mode.el" (16507 41097))
 ;;; Generated autoloads from calendar/todo-mode.el
 
 (autoload (quote todo-add-category) "todo-mode" "\
@@ -23446,7 +25298,7 @@
 
 ;;;### (autoloads (tool-bar-local-item-from-menu tool-bar-add-item-from-menu
 ;;;;;;  tool-bar-local-item tool-bar-add-item tool-bar-mode) "tool-bar"
-;;;;;;  "toolbar/tool-bar.el" (16211 27044))
+;;;;;;  "toolbar/tool-bar.el" (16775 26718))
 ;;; Generated autoloads from toolbar/tool-bar.el
 
 (defvar tool-bar-mode nil "\
@@ -23476,7 +25328,8 @@
 Info node `(elisp)Tool Bar'.  Items are added from left to right.
 
 ICON is the base name of a file containing the image to use.  The
-function will first try to use ICON.xpm, then ICON.pbm, and finally
+function will first try to use lc-ICON.xpm if display-color-cells
+is less or equal to 256, then ICON.xpm, then ICON.pbm, and finally
 ICON.xbm, using `find-image'.
 
 Use this function only to make bindings in the global value of `tool-bar-map'.
@@ -23492,7 +25345,8 @@
 Info node `(elisp)Tool Bar'.  Items are added from left to right.
 
 ICON is the base name of a file containing the image to use.  The
-function will first try to use ICON.xpm, then ICON.pbm, and finally
+function will first try to use lc-ICON.xpm if display-color-cells
+is less or equal to 256, then ICON.xpm, then ICON.pbm, and finally
 ICON.xbm, using `find-image'.
 
 \(fn ICON DEF KEY MAP &rest PROPS)" nil nil)
@@ -23527,7 +25381,7 @@
 ;;;***
 
 ;;;### (autoloads (tooltip-mode tooltip-mode) "tooltip" "tooltip.el"
-;;;;;;  (16211 27021))
+;;;;;;  (16805 44920))
 ;;; Generated autoloads from tooltip.el
 
 (autoload (quote tooltip-mode) "tooltip" "\
@@ -23537,7 +25391,7 @@
 \(fn &optional ARG)" t nil)
 
 (defvar tooltip-mode nil "\
-Toggle tooltip-mode.
+Non-nil if Tooltip mode is enabled.
 Setting this variable directly does not take effect;
 use either \\[customize] or the function `tooltip-mode'.")
 
@@ -23545,8 +25399,8 @@
 
 ;;;***
 
-;;;### (autoloads (tpu-edt-on) "tpu-edt" "emulation/tpu-edt.el" (16211
-;;;;;;  27026))
+;;;### (autoloads (tpu-edt-on) "tpu-edt" "emulation/tpu-edt.el" (16812
+;;;;;;  26772))
 ;;; Generated autoloads from emulation/tpu-edt.el
 
 (defalias (quote tpu-edt-mode) (quote tpu-edt-on))
@@ -23561,7 +25415,7 @@
 ;;;***
 
 ;;;### (autoloads (tpu-set-cursor-bound tpu-set-cursor-free tpu-set-scroll-margins)
-;;;;;;  "tpu-extras" "emulation/tpu-extras.el" (16211 27026))
+;;;;;;  "tpu-extras" "emulation/tpu-extras.el" (16213 43273))
 ;;; Generated autoloads from emulation/tpu-extras.el
 
 (autoload (quote tpu-set-scroll-margins) "tpu-extras" "\
@@ -23581,7 +25435,7 @@
 
 ;;;***
 
-;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (16225 60547))
+;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (16227 13384))
 ;;; Generated autoloads from emacs-lisp/tq.el
 
 (autoload (quote tq-create) "tq" "\
@@ -23595,7 +25449,7 @@
 ;;;***
 
 ;;;### (autoloads (trace-function-background trace-function trace-buffer)
-;;;;;;  "trace" "emacs-lisp/trace.el" (16211 27026))
+;;;;;;  "trace" "emacs-lisp/trace.el" (16213 43273))
 ;;; Generated autoloads from emacs-lisp/trace.el
 
 (defvar trace-buffer "*trace-output*" "\
@@ -23628,7 +25482,7 @@
 
 ;;;### (autoloads (tramp-completion-file-name-handler tramp-file-name-handler
 ;;;;;;  tramp-completion-file-name-regexp tramp-file-name-regexp)
-;;;;;;  "tramp" "net/tramp.el" (16211 27037))
+;;;;;;  "tramp" "net/tramp.el" (16820 16328))
 ;;; Generated autoloads from net/tramp.el
 
 (defvar tramp-unified-filenames (not (featurep (quote xemacs))) "\
@@ -23663,7 +25517,7 @@
 
 (custom-autoload (quote tramp-file-name-regexp) "tramp")
 
-(defconst tramp-completion-file-name-regexp-unified "^/[^/]*$" "\
+(defconst tramp-completion-file-name-regexp-unified "^/$\\|^/[^/:][^/]*$" "\
 Value for `tramp-completion-file-name-regexp' for unified remoting.
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
 Tramp.  See `tramp-file-name-structure-unified' for more explanations.")
@@ -23692,8 +25546,6 @@
 
 \(fn OPERATION &rest ARGS)" nil nil)
 
-(put (quote tramp-file-name-handler) (quote file-remote-p) t)
-
 (autoload (quote tramp-completion-file-name-handler) "tramp" "\
 Invoke tramp file name completion handler.
 Falls back to normal file name handler if no tramp file name handler exists.
@@ -23707,7 +25559,7 @@
 ;;;***
 
 ;;;### (autoloads (2C-split 2C-associate-buffer 2C-two-columns) "two-column"
-;;;;;;  "textmodes/two-column.el" (16211 27044))
+;;;;;;  "textmodes/two-column.el" (16213 43285))
 ;;; Generated autoloads from textmodes/two-column.el
  (autoload '2C-command "two-column" () t 'keymap)
  (global-set-key "\C-x6" '2C-command)
@@ -23756,8 +25608,9 @@
 
 ;;;### (autoloads (type-break-guesstimate-keystroke-threshold type-break-statistics
 ;;;;;;  type-break type-break-mode type-break-keystroke-threshold
-;;;;;;  type-break-good-rest-interval type-break-interval type-break-mode)
-;;;;;;  "type-break" "type-break.el" (16211 27021))
+;;;;;;  type-break-good-break-interval type-break-good-rest-interval
+;;;;;;  type-break-interval type-break-mode) "type-break" "type-break.el"
+;;;;;;  (16768 48632))
 ;;; Generated autoloads from type-break.el
 
 (defvar type-break-mode nil "\
@@ -23776,7 +25629,7 @@
 (defvar type-break-good-rest-interval (/ type-break-interval 6) "\
 *Number of seconds of idle time considered to be an adequate typing rest.
 
-When this variable is non-nil, emacs checks the idle time between
+When this variable is non-nil, Emacs checks the idle time between
 keystrokes.  If this idle time is long enough to be considered a \"good\"
 rest from typing, then the next typing break is simply rescheduled for later.
 
@@ -23785,6 +25638,16 @@
 
 (custom-autoload (quote type-break-good-rest-interval) "type-break")
 
+(defvar type-break-good-break-interval nil "\
+*Number of seconds considered to be an adequate explicit typing rest.
+
+When this variable is non-nil, its value is considered to be a \"good\"
+length (in seconds) for a break initiated by the command `type-break',
+overriding `type-break-good-rest-interval'.  This provides querying of
+break interruptions when `type-break-good-rest-interval' is nil.")
+
+(custom-autoload (quote type-break-good-break-interval) "type-break")
+
 (defvar type-break-keystroke-threshold (let* ((wpm 35) (avg-word-length 5) (upper (* wpm avg-word-length (/ type-break-interval 60))) (lower (/ upper 5))) (cons lower upper)) "\
 *Upper and lower bound on number of keystrokes for considering typing break.
 This structure is a pair of numbers (MIN . MAX).
@@ -23816,7 +25679,7 @@
 When this mode is enabled, the user is encouraged to take typing breaks at
 appropriate intervals; either after a specified amount of time or when the
 user has exceeded a keystroke threshold.  When the time arrives, the user
-is asked to take a break.  If the user refuses at that time, emacs will ask
+is asked to take a break.  If the user refuses at that time, Emacs will ask
 again in a short period of time.  The idea is to give the user enough time
 to find a good breaking point in his or her work, but be sufficiently
 annoying to discourage putting typing breaks off indefinitely.
@@ -23841,9 +25704,18 @@
 If set, the variable `type-break-good-rest-interval' specifies the minimum
 amount of time which is considered a reasonable typing break.  Whenever
 that time has elapsed, typing breaks are automatically rescheduled for
-later even if emacs didn't prompt you to take one first.  Also, if a break
+later even if Emacs didn't prompt you to take one first.  Also, if a break
 is ended before this much time has elapsed, the user will be asked whether
-or not to continue.
+or not to continue.  A nil value for this variable prevents automatic
+break rescheduling, making `type-break-interval' an upper bound on the time
+between breaks.  In this case breaks will be prompted for as usual before
+the upper bound if the keystroke threshold is reached.
+
+If `type-break-good-rest-interval' is nil and
+`type-break-good-break-interval' is set, then confirmation is required to
+interrupt a break before `type-break-good-break-interval' seconds
+have passed.  This provides for an upper bound on the time between breaks
+together with confirmation of interruptions to these breaks.
 
 The variable `type-break-keystroke-threshold' is used to determine the
 thresholds at which typing breaks should be considered.  You can use
@@ -23867,7 +25739,12 @@
         `type-break-query-function'
         `type-break-query-interval'
 
-Finally, the command `type-break-statistics' prints interesting things.
+The command `type-break-statistics' prints interesting things.
+
+Finally, a file (named `type-break-file-name') is used to store information
+across Emacs sessions.  This provides recovery of the break status between
+sessions and after a crash.  Manual changes to the file may result in
+problems.
 
 \(fn &optional PREFIX)" t nil)
 
@@ -23905,7 +25782,7 @@
 length of words (5).  For the minimum threshold, it uses about a fifth of
 the computed maximum threshold.
 
-When called from lisp programs, the optional args WORDLEN and FRAC can be
+When called from Lisp programs, the optional args WORDLEN and FRAC can be
 used to override the default assumption about average word length and the
 fraction of the maximum threshold to which to set the minimum threshold.
 FRAC should be the inverse of the fractional value; for example, a value of
@@ -23916,7 +25793,7 @@
 ;;;***
 
 ;;;### (autoloads (ununderline-region underline-region) "underline"
-;;;;;;  "textmodes/underline.el" (16211 27044))
+;;;;;;  "textmodes/underline.el" (16213 43286))
 ;;; Generated autoloads from textmodes/underline.el
 
 (autoload (quote underline-region) "underline" "\
@@ -23937,7 +25814,7 @@
 ;;;***
 
 ;;;### (autoloads (unforward-rmail-message undigestify-rmail-message)
-;;;;;;  "undigest" "mail/undigest.el" (16211 27036))
+;;;;;;  "undigest" "mail/undigest.el" (16213 43280))
 ;;; Generated autoloads from mail/undigest.el
 
 (autoload (quote undigestify-rmail-message) "undigest" "\
@@ -23956,7 +25833,7 @@
 ;;;***
 
 ;;;### (autoloads (unrmail batch-unrmail) "unrmail" "mail/unrmail.el"
-;;;;;;  (16211 27036))
+;;;;;;  (16544 33334))
 ;;; Generated autoloads from mail/unrmail.el
 
 (autoload (quote batch-unrmail) "unrmail" "\
@@ -23975,8 +25852,8 @@
 
 ;;;***
 
-;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (16211
-;;;;;;  27026))
+;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (16213
+;;;;;;  43273))
 ;;; Generated autoloads from emacs-lisp/unsafep.el
 
 (autoload (quote unsafep) "unsafep" "\
@@ -23988,8 +25865,681 @@
 
 ;;;***
 
+;;;### (autoloads nil "url" "url/url.el" (16801 58038))
+;;; Generated autoloads from url/url.el
+
+(defvar url-configuration-directory "~/.url")
+
+;;;***
+
+;;;### (autoloads (url-register-auth-scheme url-get-authentication)
+;;;;;;  "url-auth" "url/url-auth.el" (16764 51522))
+;;; Generated autoloads from url/url-auth.el
+
+(autoload (quote url-get-authentication) "url-auth" "\
+Return an authorization string suitable for use in the WWW-Authenticate
+header in an HTTP/1.0 request.
+
+URL    is the url you are requesting authorization to.  This can be either a
+       string representing the URL, or the parsed representation returned by
+       `url-generic-parse-url'
+REALM  is the realm at a specific site we are looking for.  This should be a
+       string specifying the exact realm, or nil or the symbol 'any' to
+       specify that the filename portion of the URL should be used as the
+       realm
+TYPE   is the type of authentication to be returned.  This is either a string
+       representing the type (basic, digest, etc), or nil or the symbol 'any'
+       to specify that any authentication is acceptable.  If requesting 'any'
+       the strongest matching authentication will be returned.  If this is
+       wrong, its no big deal, the error from the server will specify exactly
+       what type of auth to use
+PROMPT is boolean - specifies whether to ask the user for a username/password
+       if one cannot be found in the cache
+
+\(fn URL REALM TYPE PROMPT &optional ARGS)" nil nil)
+
+(autoload (quote url-register-auth-scheme) "url-auth" "\
+Register an HTTP authentication method.
+
+TYPE     is a string or symbol specifying the name of the method.   This
+         should be the same thing you expect to get returned in an Authenticate
+         header in HTTP/1.0 - it will be downcased.
+FUNCTION is the function to call to get the authorization information.  This
+         defaults to `url-?-auth', where ? is TYPE
+RATING   a rating between 1 and 10 of the strength of the authentication.
+         This is used when asking for the best authentication for a specific
+         URL.  The item with the highest rating is returned.
+
+\(fn TYPE &optional FUNCTION RATING)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-cache-expired url-cache-extract url-is-cached
+;;;;;;  url-store-in-cache) "url-cache" "url/url-cache.el" (16764
+;;;;;;  51522))
+;;; Generated autoloads from url/url-cache.el
+
+(autoload (quote url-store-in-cache) "url-cache" "\
+Store buffer BUFF in the cache.
+
+\(fn &optional BUFF)" nil nil)
+
+(autoload (quote url-is-cached) "url-cache" "\
+Return non-nil if the URL is cached.
+
+\(fn URL)" nil nil)
+
+(autoload (quote url-cache-extract) "url-cache" "\
+Extract FNAM from the local disk cache
+
+\(fn FNAM)" nil nil)
+
+(autoload (quote url-cache-expired) "url-cache" "\
+Return t iff a cached file has expired.
+
+\(fn URL MOD)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (16764 51522))
+;;; Generated autoloads from url/url-cid.el
+
+(autoload (quote url-cid) "url-cid" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-cookie-setup-save-timer url-cookie-handle-set-cookie
+;;;;;;  url-cookie-retrieve url-cookie-write-file url-cookie-parse-file)
+;;;;;;  "url-cookie" "url/url-cookie.el" (16746 18215))
+;;; Generated autoloads from url/url-cookie.el
+
+(autoload (quote url-cookie-parse-file) "url-cookie" "\
+Not documented
+
+\(fn &optional FNAME)" nil nil)
+
+(autoload (quote url-cookie-write-file) "url-cookie" "\
+Not documented
+
+\(fn &optional FNAME)" nil nil)
+
+(autoload (quote url-cookie-retrieve) "url-cookie" "\
+Retrieve all the netscape-style cookies for a specified HOST and PATH.
+
+\(fn HOST PATH &optional SECURE)" nil nil)
+
+(autoload (quote url-cookie-handle-set-cookie) "url-cookie" "\
+Not documented
+
+\(fn STR)" nil nil)
+
+(autoload (quote url-cookie-setup-save-timer) "url-cookie" "\
+Reset the cookie saver timer.
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (url-dav-vc-registered url-dav-file-name-completion
+;;;;;;  url-dav-file-name-all-completions url-dav-rename-file url-dav-make-directory
+;;;;;;  url-dav-file-directory-p url-dav-directory-files url-dav-delete-file
+;;;;;;  url-dav-delete-directory url-dav-save-resource url-dav-file-attributes
+;;;;;;  url-dav-unlock-resource url-dav-active-locks url-dav-lock-resource
+;;;;;;  url-dav-get-properties url-dav-supported-p) "url-dav" "url/url-dav.el"
+;;;;;;  (16515 33876))
+;;; Generated autoloads from url/url-dav.el
+
+(autoload (quote url-dav-supported-p) "url-dav" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+(autoload (quote url-dav-get-properties) "url-dav" "\
+Return properties for URL, up to DEPTH levels deep.
+
+Returns an assoc list, where the key is the filename (possibly a full
+URI), and the value is a standard property list of DAV property
+names (ie: DAV:resourcetype).
+
+\(fn URL &optional ATTRIBUTES DEPTH NAMESPACES)" nil nil)
+
+(autoload (quote url-dav-lock-resource) "url-dav" "\
+Request a lock on URL.  If EXCLUSIVE is non-nil, get an exclusive lock.
+Optional 3rd argument DEPTH says how deep the lock should go, default is 0
+\(lock only the resource and none of its children).
+
+Returns a cons-cell of (SUCCESSFUL-RESULTS . FAILURE-RESULTS).
+SUCCESSFUL-RESULTS is a list of (URL STATUS locktoken).
+FAILURE-RESULTS is a list of (URL STATUS).
+
+\(fn URL EXCLUSIVE &optional DEPTH)" nil nil)
+
+(autoload (quote url-dav-active-locks) "url-dav" "\
+Return an assoc list of all active locks on URL.
+
+\(fn URL &optional DEPTH)" nil nil)
+
+(autoload (quote url-dav-unlock-resource) "url-dav" "\
+Release the lock on URL represented by LOCK-TOKEN.
+Returns t iff the lock was successfully released.
+
+\(fn URL LOCK-TOKEN)" nil nil)
+
+(autoload (quote url-dav-file-attributes) "url-dav" "\
+Not documented
+
+\(fn URL &optional ID-FORMAT)" nil nil)
+
+(autoload (quote url-dav-save-resource) "url-dav" "\
+Save OBJ as URL using WebDAV.
+URL must be a fully qualified URL.
+OBJ may be a buffer or a string.
+
+\(fn URL OBJ &optional CONTENT-TYPE LOCK-TOKEN)" nil nil)
+
+(autoload (quote url-dav-delete-directory) "url-dav" "\
+Delete the WebDAV collection URL.
+If optional second argument RECURSIVE is non-nil, then delete all
+files in the collection as well.
+
+\(fn URL &optional RECURSIVE LOCK-TOKEN)" nil nil)
+
+(autoload (quote url-dav-delete-file) "url-dav" "\
+Delete file named URL.
+
+\(fn URL &optional LOCK-TOKEN)" nil nil)
+
+(autoload (quote url-dav-directory-files) "url-dav" "\
+Return a list of names of files in DIRECTORY.
+There are three optional arguments:
+If FULL is non-nil, return absolute file names.  Otherwise return names
+ that are relative to the specified directory.
+If MATCH is non-nil, mention only file names that match the regexp MATCH.
+If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
+ NOSORT is useful if you plan to sort the result yourself.
+
+\(fn URL &optional FULL MATCH NOSORT FILES-ONLY)" nil nil)
+
+(autoload (quote url-dav-file-directory-p) "url-dav" "\
+Return t if URL names an existing DAV collection.
+
+\(fn URL)" nil nil)
+
+(autoload (quote url-dav-make-directory) "url-dav" "\
+Create the directory DIR and any nonexistent parent dirs.
+
+\(fn URL &optional PARENTS)" nil nil)
+
+(autoload (quote url-dav-rename-file) "url-dav" "\
+Not documented
+
+\(fn OLDNAME NEWNAME &optional OVERWRITE)" nil nil)
+
+(autoload (quote url-dav-file-name-all-completions) "url-dav" "\
+Return a list of all completions of file name FILE in directory DIRECTORY.
+These are all file names in directory DIRECTORY which begin with FILE.
+
+\(fn FILE URL)" nil nil)
+
+(autoload (quote url-dav-file-name-completion) "url-dav" "\
+Complete file name FILE in directory DIRECTORY.
+Returns the longest string
+common to all file names in DIRECTORY that start with FILE.
+If there is only one and FILE matches it exactly, returns t.
+Returns nil if DIR contains no name starting with FILE.
+
+\(fn FILE URL)" nil nil)
+
+(autoload (quote url-dav-vc-registered) "url-dav" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-file) "url-file" "url/url-file.el" (16746
+;;;;;;  18215))
+;;; Generated autoloads from url/url-file.el
+
+(autoload (quote url-file) "url-file" "\
+Handle file: and ftp: URLs.
+
+\(fn URL CALLBACK CBARGS)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-open-stream url-gateway-nslookup-host) "url-gw"
+;;;;;;  "url/url-gw.el" (16764 51522))
+;;; Generated autoloads from url/url-gw.el
+
+(autoload (quote url-gateway-nslookup-host) "url-gw" "\
+Attempt to resolve the given HOST using nslookup if possible.
+
+\(fn HOST)" t nil)
+
+(autoload (quote url-open-stream) "url-gw" "\
+Open a stream to HOST, possibly via a gateway.
+Args per `open-network-stream'.
+Will not make a connexion if `url-gateway-unplugged' is non-nil.
+
+\(fn NAME BUFFER HOST SERVICE)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-insert-file-contents url-file-local-copy url-copy-file
+;;;;;;  url-handler-mode) "url-handlers" "url/url-handlers.el" (16746
+;;;;;;  18215))
+;;; Generated autoloads from url/url-handlers.el
+
+(defvar url-handler-mode nil "\
+Non-nil if Url-Handler mode is enabled.
+See the command `url-handler-mode' for a description of this minor-mode.
+Setting this variable directly does not take effect;
+use either \\[customize] or the function `url-handler-mode'.")
+
+(custom-autoload (quote url-handler-mode) "url-handlers")
+
+(autoload (quote url-handler-mode) "url-handlers" "\
+Use URL to handle URL-like file names.
+
+\(fn &optional ARG)" t nil)
+
+(autoload (quote url-copy-file) "url-handlers" "\
+Copy URL to NEWNAME.  Both args must be strings.
+Signals a `file-already-exists' error if file NEWNAME already exists,
+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
+last-modified time as the old one.  (This works on only some systems.)
+A prefix arg makes KEEP-TIME non-nil.
+
+\(fn URL NEWNAME &optional OK-IF-ALREADY-EXISTS KEEP-TIME)" nil nil)
+
+(autoload (quote url-file-local-copy) "url-handlers" "\
+Copy URL into a temporary file on this machine.
+Returns the name of the local copy, or nil, if FILE is directly
+accessible.
+
+\(fn URL &rest IGNORED)" nil nil)
+
+(autoload (quote url-insert-file-contents) "url-handlers" "\
+Not documented
+
+\(fn URL &optional VISIT BEG END REPLACE)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-history-save-history url-history-parse-history
+;;;;;;  url-history-setup-save-timer) "url-history" "url/url-history.el"
+;;;;;;  (16746 18215))
+;;; Generated autoloads from url/url-history.el
+
+(autoload (quote url-history-setup-save-timer) "url-history" "\
+Reset the history list timer.
+
+\(fn)" t nil)
+
+(autoload (quote url-history-parse-history) "url-history" "\
+Parse a history file stored in FNAME.
+
+\(fn &optional FNAME)" nil nil)
+
+(autoload (quote url-history-save-history) "url-history" "\
+Write the global history file into `url-history-file'.
+The type of data written is determined by what is in the file to begin
+with.  If the type of storage cannot be determined, then prompt the
+user for what type to save as.
+
+\(fn &optional FNAME)" t nil)
+
+;;;***
+
+;;;### (autoloads (url-http-options url-http-file-attributes url-http-file-exists-p
+;;;;;;  url-http) "url-http" "url/url-http.el" (16812 58719))
+;;; Generated autoloads from url/url-http.el
+
+(autoload (quote url-http) "url-http" "\
+Retrieve URL via HTTP asynchronously.
+URL must be a parsed URL.  See `url-generic-parse-url' for details.
+When retrieval is completed, the function CALLBACK is executed with
+CBARGS as the arguments.
+
+\(fn URL CALLBACK CBARGS)" nil nil)
+
+(autoload (quote url-http-file-exists-p) "url-http" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+(defalias (quote url-http-file-readable-p) (quote url-http-file-exists-p))
+
+(autoload (quote url-http-file-attributes) "url-http" "\
+Not documented
+
+\(fn URL &optional ID-FORMAT)" nil nil)
+
+(autoload (quote url-http-options) "url-http" "\
+Returns a property list describing options available for URL.
+This list is retrieved using the `OPTIONS' HTTP method.
+
+Property list members:
+
+methods
+  A list of symbols specifying what HTTP methods the resource
+  supports.
+
+dav
+  A list of numbers specifying what DAV protocol/schema versions are
+  supported.
+
+dasl
+  A list of supported DASL search types supported (string form)
+
+ranges
+  A list of the units available for use in partial document fetches.
+
+p3p
+  The `Platform For Privacy Protection' description for the resource.
+  Currently this is just the raw header contents.  This is likely to
+  change once P3P is formally supported by the URL package or
+  Emacs/W3.
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (16775 26718))
+;;; Generated autoloads from url/url-irc.el
+
+(autoload (quote url-irc) "url-irc" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (16747
+;;;;;;  61768))
+;;; Generated autoloads from url/url-ldap.el
+
+(autoload (quote url-ldap) "url-ldap" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-mailto url-mail) "url-mailto" "url/url-mailto.el"
+;;;;;;  (16788 34909))
+;;; Generated autoloads from url/url-mailto.el
+
+(autoload (quote url-mail) "url-mailto" "\
+Not documented
+
+\(fn &rest ARGS)" t nil)
+
+(autoload (quote url-mailto) "url-mailto" "\
+Handle the mailto: URL syntax.
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-data url-generic-emulator-loader url-info
+;;;;;;  url-man) "url-misc" "url/url-misc.el" (16764 51522))
+;;; Generated autoloads from url/url-misc.el
+
+(autoload (quote url-man) "url-misc" "\
+Fetch a Unix manual page URL.
+
+\(fn URL)" nil nil)
+
+(autoload (quote url-info) "url-misc" "\
+Fetch a GNU Info URL.
+
+\(fn URL)" nil nil)
+
+(autoload (quote url-generic-emulator-loader) "url-misc" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+(defalias (quote url-rlogin) (quote url-generic-emulator-loader))
+
+(defalias (quote url-telnet) (quote url-generic-emulator-loader))
+
+(defalias (quote url-tn3270) (quote url-generic-emulator-loader))
+
+(autoload (quote url-data) "url-misc" "\
+Fetch a data URL (RFC 2397).
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-snews url-news) "url-news" "url/url-news.el"
+;;;;;;  (16775 26718))
+;;; Generated autoloads from url/url-news.el
+
+(autoload (quote url-news) "url-news" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+(autoload (quote url-snews) "url-news" "\
+Not documented
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-ns-user-pref url-ns-prefs isInNet isResolvable
+;;;;;;  dnsResolve dnsDomainIs isPlainHostName) "url-ns" "url/url-ns.el"
+;;;;;;  (16764 51522))
+;;; Generated autoloads from url/url-ns.el
+
+(autoload (quote isPlainHostName) "url-ns" "\
+Not documented
+
+\(fn HOST)" nil nil)
+
+(autoload (quote dnsDomainIs) "url-ns" "\
+Not documented
+
+\(fn HOST DOM)" nil nil)
+
+(autoload (quote dnsResolve) "url-ns" "\
+Not documented
+
+\(fn HOST)" nil nil)
+
+(autoload (quote isResolvable) "url-ns" "\
+Not documented
+
+\(fn HOST)" nil nil)
+
+(autoload (quote isInNet) "url-ns" "\
+Not documented
+
+\(fn IP NET MASK)" nil nil)
+
+(autoload (quote url-ns-prefs) "url-ns" "\
+Not documented
+
+\(fn &optional FILE)" nil nil)
+
+(autoload (quote url-ns-user-pref) "url-ns" "\
+Not documented
+
+\(fn KEY &optional DEFAULT)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-generic-parse-url url-recreate-url) "url-parse"
+;;;;;;  "url/url-parse.el" (16746 18215))
+;;; Generated autoloads from url/url-parse.el
+
+(autoload (quote url-recreate-url) "url-parse" "\
+Recreate a URL string from the parsed URLOBJ.
+
+\(fn URLOBJ)" nil nil)
+
+(autoload (quote url-generic-parse-url) "url-parse" "\
+Return a vector of the parts of URL.
+Format is:
+\[TYPE USER PASSWORD HOST PORT FILE TARGET ATTRIBUTES FULL]
+
+\(fn URL)" nil nil)
+
+;;;***
+
+;;;### (autoloads (url-setup-privacy-info) "url-privacy" "url/url-privacy.el"
+;;;;;;  (16764 51522))
+;;; Generated autoloads from url/url-privacy.el
+
+(autoload (quote url-setup-privacy-info) "url-privacy" "\
+Not documented
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (url-view-url url-truncate-url-for-viewing url-file-extension
+;;;;;;  url-hexify-string url-unhex-string url-parse-query-string
+;;;;;;  url-basepath url-percentage url-display-percentage url-pretty-length
+;;;;;;  url-strip-leading-spaces url-eat-trailing-space url-get-normalized-date
+;;;;;;  url-lazy-message url-normalize-url url-insert-entities-in-string
+;;;;;;  url-parse-args url-debug url-debug) "url-util" "url/url-util.el"
+;;;;;;  (16764 51522))
+;;; Generated autoloads from url/url-util.el
+
+(defvar url-debug nil "\
+*What types of debug messages from the URL library to show.
+Debug messages are logged to the *URL-DEBUG* buffer.
+
+If t, all messages will be logged.
+If a number, all messages will be logged, as well shown via `message'.
+If a list, it is a list of the types of messages to be logged.")
+
+(custom-autoload (quote url-debug) "url-util")
+
+(autoload (quote url-debug) "url-util" "\
+Not documented
+
+\(fn TAG &rest ARGS)" nil nil)
+
+(autoload (quote url-parse-args) "url-util" "\
+Not documented
+
+\(fn STR &optional NODOWNCASE)" nil nil)
+
+(autoload (quote url-insert-entities-in-string) "url-util" "\
+Convert HTML markup-start characters to entity references in STRING.
+Also replaces the \" character, so that the result may be safely used as
+  an attribute value in a tag.  Returns a new string with the result of the
+  conversion.  Replaces these characters as follows:
+    &  ==>  &amp;
+    <  ==>  &lt;
+    >  ==>  &gt;
+    \"  ==>  &quot;
+
+\(fn STRING)" nil nil)
+
+(autoload (quote url-normalize-url) "url-util" "\
+Return a 'normalized' version of URL.
+Strips out default port numbers, etc.
+
+\(fn URL)" nil nil)
+
+(autoload (quote url-lazy-message) "url-util" "\
+Just like `message', but is a no-op if called more than once a second.
+Will not do anything if `url-show-status' is nil.
+
+\(fn &rest ARGS)" nil nil)
+
+(autoload (quote url-get-normalized-date) "url-util" "\
+Return a 'real' date string that most HTTP servers can understand.
+
+\(fn &optional SPECIFIED-TIME)" nil nil)
+
+(autoload (quote url-eat-trailing-space) "url-util" "\
+Remove spaces/tabs at the end of a string.
+
+\(fn X)" nil nil)
+
+(autoload (quote url-strip-leading-spaces) "url-util" "\
+Remove spaces at the front of a string.
+
+\(fn X)" nil nil)
+
+(autoload (quote url-pretty-length) "url-util" "\
+Not documented
+
+\(fn N)" nil nil)
+
+(autoload (quote url-display-percentage) "url-util" "\
+Not documented
+
+\(fn FMT PERC &rest ARGS)" nil nil)
+
+(autoload (quote url-percentage) "url-util" "\
+Not documented
+
+\(fn X Y)" nil nil)
+
+(autoload (quote url-basepath) "url-util" "\
+Return the base pathname of FILE, or the actual filename if X is true.
+
+\(fn FILE &optional X)" nil nil)
+
+(autoload (quote url-parse-query-string) "url-util" "\
+Not documented
+
+\(fn QUERY &optional DOWNCASE)" nil nil)
+
+(autoload (quote url-unhex-string) "url-util" "\
+Remove %XX embedded spaces, etc in a url.
+If optional second argument ALLOW-NEWLINES is non-nil, then allow the
+decoding of carriage returns and line feeds in the string, which is normally
+forbidden in URL encoding.
+
+\(fn STR &optional ALLOW-NEWLINES)" nil nil)
+
+(autoload (quote url-hexify-string) "url-util" "\
+Escape characters in a string.
+
+\(fn STR)" nil nil)
+
+(autoload (quote url-file-extension) "url-util" "\
+Return the filename extension of FNAME.
+If optional variable X is t,
+then return the basename of the file with the extension stripped off.
+
+\(fn FNAME &optional X)" nil nil)
+
+(autoload (quote url-truncate-url-for-viewing) "url-util" "\
+Return a shortened version of URL that is WIDTH characters or less wide.
+WIDTH defaults to the current frame width.
+
+\(fn URL &optional WIDTH)" nil nil)
+
+(autoload (quote url-view-url) "url-util" "\
+View the current document's URL.
+Optional argument NO-SHOW means just return the URL, don't show it in
+the minibuffer.
+
+This uses `url-current-object', set locally to the buffer.
+
+\(fn &optional NO-SHOW)" t nil)
+
+;;;***
+
 ;;;### (autoloads (ask-user-about-supersession-threat ask-user-about-lock)
-;;;;;;  "userlock" "userlock.el" (16211 27021))
+;;;;;;  "userlock" "userlock.el" (16213 43271))
 ;;; Generated autoloads from userlock.el
 
 (autoload (quote ask-user-about-lock) "userlock" "\
@@ -24017,8 +26567,9 @@
 
 ;;;***
 
-;;;### (autoloads (uudecode-decode-region uudecode-decode-region-external)
-;;;;;;  "uudecode" "gnus/uudecode.el" (16211 27032))
+;;;### (autoloads (uudecode-decode-region uudecode-decode-region-internal
+;;;;;;  uudecode-decode-region-external) "uudecode" "gnus/uudecode.el"
+;;;;;;  (16719 60886))
 ;;; Generated autoloads from gnus/uudecode.el
 
 (autoload (quote uudecode-decode-region-external) "uudecode" "\
@@ -24028,12 +26579,18 @@
 
 \(fn START END &optional FILE-NAME)" t nil)
 
-(autoload (quote uudecode-decode-region) "uudecode" "\
+(autoload (quote uudecode-decode-region-internal) "uudecode" "\
 Uudecode region between START and END without using an external program.
 If FILE-NAME is non-nil, save the result to FILE-NAME.
 
 \(fn START END &optional FILE-NAME)" t nil)
 
+(autoload (quote uudecode-decode-region) "uudecode" "\
+Uudecode region between START and END.
+If FILE-NAME is non-nil, save the result to FILE-NAME.
+
+\(fn START END &optional FILE-NAME)" nil nil)
+
 ;;;***
 
 ;;;### (autoloads (vc-annotate vc-update-change-log vc-rename-file
@@ -24042,7 +26599,7 @@
 ;;;;;;  vc-directory vc-merge vc-insert-headers vc-version-other-window
 ;;;;;;  vc-diff vc-register vc-next-action vc-do-command edit-vc-file
 ;;;;;;  with-vc-file vc-branch-part vc-before-checkin-hook vc-checkin-hook
-;;;;;;  vc-checkout-hook) "vc" "vc.el" (16211 27021))
+;;;;;;  vc-checkout-hook) "vc" "vc.el" (16812 26771))
 ;;; Generated autoloads from vc.el
 
 (defvar vc-checkout-hook nil "\
@@ -24224,8 +26781,9 @@
 
 (autoload (quote vc-print-log) "vc" "\
 List the change log of the current buffer in a window.
-
-\(fn)" t nil)
+If FOCUS-REV is non-nil, leave the point at that revision.
+
+\(fn &optional FOCUS-REV)" t nil)
 
 (autoload (quote vc-revert-buffer) "vc" "\
 Revert the current buffer's file to the version it was based on.
@@ -24319,11 +26877,21 @@
 `vc-annotate-very-old-color' defines the mapping of time to
 colors. `vc-annotate-background' specifies the background color.
 
-\(fn PREFIX)" t nil)
-
-;;;***
-
-;;;### (autoloads nil "vc-cvs" "vc-cvs.el" (16250 54573))
+\(fn PREFIX &optional REVISION DISPLAY-MODE)" t nil)
+
+;;;***
+
+;;;### (autoloads nil "vc-arch" "vc-arch.el" (16764 51519))
+;;; Generated autoloads from vc-arch.el
+ (defun vc-arch-registered (file)
+  (if (vc-find-root file "{arch}/=tagging-method")
+      (progn
+        (load "vc-arch")
+        (vc-arch-registered file))))
+
+;;;***
+
+;;;### (autoloads nil "vc-cvs" "vc-cvs.el" (16812 26771))
 ;;; Generated autoloads from vc-cvs.el
  (defun vc-cvs-registered (f)
   (when (file-readable-p (expand-file-name
@@ -24333,26 +26901,18 @@
 
 ;;;***
 
-;;;### (autoloads nil "vc-mcvs" "vc-mcvs.el" (16211 27021))
+;;;### (autoloads nil "vc-mcvs" "vc-mcvs.el" (16777 65418))
 ;;; Generated autoloads from vc-mcvs.el
  (defun vc-mcvs-registered (file)
-  (let ((dir file))
-    (while (and (stringp dir)
-                (not (equal
-                      dir (setq dir (file-name-directory dir))))
-                dir)
-      (setq dir (if (file-directory-p
-                     (expand-file-name "MCVS/CVS" dir))
-                    t (directory-file-name dir))))
-    (if (eq dir t)
-         (progn
-          (load "vc-mcvs")
-          (vc-mcvs-registered file)))))
+  (if (vc-find-root file "MCVS/CVS")
+      (progn
+        (load "vc-mcvs")
+        (vc-mcvs-registered file))))
 
 ;;;***
 
 ;;;### (autoloads (vc-rcs-master-templates) "vc-rcs" "vc-rcs.el"
-;;;;;;  (16211 27021))
+;;;;;;  (16801 58024))
 ;;; Generated autoloads from vc-rcs.el
 
 (defvar vc-rcs-master-templates (quote ("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) "\
@@ -24365,7 +26925,7 @@
 ;;;***
 
 ;;;### (autoloads (vc-sccs-master-templates) "vc-sccs" "vc-sccs.el"
-;;;;;;  (16211 27021))
+;;;;;;  (16701 32674))
 ;;; Generated autoloads from vc-sccs.el
 
 (defvar vc-sccs-master-templates (quote ("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) "\
@@ -24382,7 +26942,7 @@
 
 ;;;***
 
-;;;### (autoloads nil "vc-svn" "vc-svn.el" (16211 27021))
+;;;### (autoloads nil "vc-svn" "vc-svn.el" (16683 1170))
 ;;; Generated autoloads from vc-svn.el
  (defun vc-svn-registered (f)
   (when (file-readable-p (expand-file-name
@@ -24395,7 +26955,7 @@
 ;;;***
 
 ;;;### (autoloads (vhdl-mode) "vhdl-mode" "progmodes/vhdl-mode.el"
-;;;;;;  (16211 27039))
+;;;;;;  (16775 26717))
 ;;; Generated autoloads from progmodes/vhdl-mode.el
 
 (autoload (quote vhdl-mode) "vhdl-mode" "\
@@ -24920,7 +27480,7 @@
 
 ;;;***
 
-;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (16211 27026))
+;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (16423 23570))
 ;;; Generated autoloads from emulation/vi.el
 
 (autoload (quote vi-mode) "vi" "\
@@ -24975,7 +27535,7 @@
 ;;;### (autoloads (viqr-pre-write-conversion viqr-post-read-conversion
 ;;;;;;  viet-encode-viqr-buffer viet-encode-viqr-region viet-decode-viqr-buffer
 ;;;;;;  viet-decode-viqr-region viet-encode-viscii-char) "viet-util"
-;;;;;;  "language/viet-util.el" (16211 27033))
+;;;;;;  "language/viet-util.el" (16213 43280))
 ;;; Generated autoloads from language/viet-util.el
 
 (autoload (quote viet-encode-viscii-char) "viet-util" "\
@@ -25021,8 +27581,8 @@
 
 ;;;### (autoloads (View-exit-and-edit view-mode-enter view-mode view-buffer-other-frame
 ;;;;;;  view-buffer-other-window view-buffer view-file-other-frame
-;;;;;;  view-file-other-window view-file) "view" "view.el" (16211
-;;;;;;  27021))
+;;;;;;  view-file-other-window view-file) "view" "view.el" (16764
+;;;;;;  51519))
 ;;; Generated autoloads from view.el
 
 (defvar view-mode nil "\
@@ -25229,8 +27789,8 @@
 
 ;;;***
 
-;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (16211
-;;;;;;  27026))
+;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (16213
+;;;;;;  43273))
 ;;; Generated autoloads from emulation/vip.el
 
 (autoload (quote vip-setup) "vip" "\
@@ -25246,7 +27806,7 @@
 ;;;***
 
 ;;;### (autoloads (viper-mode toggle-viper-mode) "viper" "emulation/viper.el"
-;;;;;;  (16211 27027))
+;;;;;;  (16213 43273))
 ;;; Generated autoloads from emulation/viper.el
 
 (autoload (quote toggle-viper-mode) "viper" "\
@@ -25263,7 +27823,7 @@
 ;;;***
 
 ;;;### (autoloads (warn lwarn display-warning) "warnings" "emacs-lisp/warnings.el"
-;;;;;;  (16211 27026))
+;;;;;;  (16478 51573))
 ;;; Generated autoloads from emacs-lisp/warnings.el
 
 (defvar warning-prefix-function nil "\
@@ -25345,7 +27905,22 @@
 
 ;;;***
 
-;;;### (autoloads (webjump) "webjump" "net/webjump.el" (16211 27037))
+;;;### (autoloads (wdired-change-to-wdired-mode) "wdired" "wdired.el"
+;;;;;;  (16644 49446))
+;;; Generated autoloads from wdired.el
+
+(autoload (quote wdired-change-to-wdired-mode) "wdired" "\
+Put a dired buffer in a mode in which filenames are editable.
+In this mode the names of the files can be changed, and after
+typing C-c C-c the files and directories in disk are renamed.
+
+See `wdired-mode'.
+
+\(fn)" t nil)
+
+;;;***
+
+;;;### (autoloads (webjump) "webjump" "net/webjump.el" (16423 23573))
 ;;; Generated autoloads from net/webjump.el
 
 (autoload (quote webjump) "webjump" "\
@@ -25362,7 +27937,7 @@
 ;;;***
 
 ;;;### (autoloads (which-function-mode) "which-func" "progmodes/which-func.el"
-;;;;;;  (16249 31942))
+;;;;;;  (16820 16328))
 ;;; Generated autoloads from progmodes/which-func.el
  (put 'which-func-format 'risky-local-variable t)
  (put 'which-func-current 'risky-local-variable t)
@@ -25394,7 +27969,7 @@
 ;;;;;;  whitespace-buffer whitespace-toggle-ateol-check whitespace-toggle-spacetab-check
 ;;;;;;  whitespace-toggle-indent-check whitespace-toggle-trailing-check
 ;;;;;;  whitespace-toggle-leading-check) "whitespace" "whitespace.el"
-;;;;;;  (16248 29803))
+;;;;;;  (16764 51519))
 ;;; Generated autoloads from whitespace.el
 
 (autoload (quote whitespace-toggle-leading-check) "whitespace" "\
@@ -25456,6 +28031,8 @@
 
 \(fn S E)" t nil)
 
+(defalias (quote global-whitespace-mode) (quote whitespace-global-mode))
+
 (defvar whitespace-global-mode nil "\
 Non-nil if Whitespace-Global mode is enabled.
 See the command `whitespace-global-mode' for a description of this minor-mode.
@@ -25482,7 +28059,7 @@
 ;;;***
 
 ;;;### (autoloads (widget-minor-mode widget-browse-other-window widget-browse
-;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (16211 27022))
+;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (16213 43272))
 ;;; Generated autoloads from wid-browse.el
 
 (autoload (quote widget-browse-at) "wid-browse" "\
@@ -25509,8 +28086,8 @@
 ;;;***
 
 ;;;### (autoloads (widget-setup widget-insert widget-delete widget-create
-;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (16284
-;;;;;;  32617))
+;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (16820
+;;;;;;  16328))
 ;;; Generated autoloads from wid-edit.el
 
 (autoload (quote widgetp) "wid-edit" "\
@@ -25552,8 +28129,8 @@
 ;;;***
 
 ;;;### (autoloads (windmove-default-keybindings windmove-down windmove-right
-;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (16211
-;;;;;;  27022))
+;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (16710
+;;;;;;  51039))
 ;;; Generated autoloads from windmove.el
 
 (autoload (quote windmove-left) "windmove" "\
@@ -25606,7 +28183,7 @@
 ;;;***
 
 ;;;### (autoloads (winner-mode winner-mode) "winner" "winner.el"
-;;;;;;  (16211 27022))
+;;;;;;  (16792 36614))
 ;;; Generated autoloads from winner.el
 
 (defvar winner-mode nil "\
@@ -25625,7 +28202,7 @@
 ;;;***
 
 ;;;### (autoloads (woman-find-file woman-dired-find-file woman) "woman"
-;;;;;;  "woman.el" (16239 4622))
+;;;;;;  "woman.el" (16767 25304))
 ;;; Generated autoloads from woman.el
 
 (autoload (quote woman) "woman" "\
@@ -25661,7 +28238,7 @@
 ;;;***
 
 ;;;### (autoloads (wordstar-mode) "ws-mode" "emulation/ws-mode.el"
-;;;;;;  (16211 27027))
+;;;;;;  (16213 43273))
 ;;; Generated autoloads from emulation/ws-mode.el
 
 (autoload (quote wordstar-mode) "ws-mode" "\
@@ -25774,7 +28351,7 @@
 ;;;***
 
 ;;;### (autoloads (xml-parse-region xml-parse-file) "xml" "xml.el"
-;;;;;;  (16301 42974))
+;;;;;;  (16814 63075))
 ;;; Generated autoloads from xml.el
 
 (autoload (quote xml-parse-file) "xml" "\
@@ -25799,8 +28376,8 @@
 
 ;;;***
 
-;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (16211
-;;;;;;  27022))
+;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (16213
+;;;;;;  43272))
 ;;; Generated autoloads from xt-mouse.el
 
 (defvar xterm-mouse-mode nil "\
@@ -25821,8 +28398,24 @@
 
 ;;;***
 
+;;;### (autoloads (yenc-extract-filename yenc-decode-region) "yenc"
+;;;;;;  "gnus/yenc.el" (16697 49031))
+;;; Generated autoloads from gnus/yenc.el
+
+(autoload (quote yenc-decode-region) "yenc" "\
+Yenc decode region between START and END using an internal decoder.
+
+\(fn START END)" t nil)
+
+(autoload (quote yenc-extract-filename) "yenc" "\
+Extract file name from an yenc header.
+
+\(fn)" nil nil)
+
+;;;***
+
 ;;;### (autoloads (psychoanalyze-pinhead apropos-zippy insert-zippyism
-;;;;;;  yow) "yow" "play/yow.el" (16211 27038))
+;;;;;;  yow) "yow" "play/yow.el" (16213 43281))
 ;;; Generated autoloads from play/yow.el
 
 (autoload (quote yow) "yow" "\
@@ -25848,7 +28441,7 @@
 
 ;;;***
 
-;;;### (autoloads (zone) "zone" "play/zone.el" (16211 27038))
+;;;### (autoloads (zone) "zone" "play/zone.el" (16423 23573))
 ;;; Generated autoloads from play/zone.el
 
 (autoload (quote zone) "zone" "\
@@ -25859,7 +28452,7 @@
 ;;;***
 
 ;;;### (autoloads (zone-mode zone-mode-update-serial-hook) "zone-mode"
-;;;;;;  "net/zone-mode.el" (16211 27037))
+;;;;;;  "net/zone-mode.el" (16377 12872))
 ;;; Generated autoloads from net/zone-mode.el
 
 (autoload (quote zone-mode-update-serial-hook) "zone-mode" "\
@@ -25884,10 +28477,10 @@
 ;;;### (autoloads nil nil ("abbrev.el" "abbrevlist.el" "bindings.el"
 ;;;;;;  "buff-menu.el" "calc/calc-aent.el" "calc/calc-alg.el" "calc/calc-arith.el"
 ;;;;;;  "calc/calc-bin.el" "calc/calc-comb.el" "calc/calc-cplx.el"
-;;;;;;  "calc/calc-embed.el" "calc/calc-fin.el" "calc/calc-forms.el"
-;;;;;;  "calc/calc-frac.el" "calc/calc-funcs.el" "calc/calc-graph.el"
-;;;;;;  "calc/calc-help.el" "calc/calc-incom.el" "calc/calc-keypd.el"
-;;;;;;  "calc/calc-lang.el" "calc/calc-macs.el" "calc/calc-maint.el"
+;;;;;;  "calc/calc-embed.el" "calc/calc-ext.el" "calc/calc-fin.el"
+;;;;;;  "calc/calc-forms.el" "calc/calc-frac.el" "calc/calc-funcs.el"
+;;;;;;  "calc/calc-graph.el" "calc/calc-help.el" "calc/calc-incom.el"
+;;;;;;  "calc/calc-keypd.el" "calc/calc-lang.el" "calc/calc-macs.el"
 ;;;;;;  "calc/calc-map.el" "calc/calc-math.el" "calc/calc-misc.el"
 ;;;;;;  "calc/calc-mode.el" "calc/calc-mtx.el" "calc/calc-poly.el"
 ;;;;;;  "calc/calc-prog.el" "calc/calc-rewr.el" "calc/calc-rules.el"
@@ -25895,59 +28488,64 @@
 ;;;;;;  "calc/calc-stuff.el" "calc/calc-trail.el" "calc/calc-undo.el"
 ;;;;;;  "calc/calc-units.el" "calc/calc-vec.el" "calc/calc-yank.el"
 ;;;;;;  "calc/calcalg2.el" "calc/calcalg3.el" "calc/calccomp.el"
-;;;;;;  "calc/calcsel2.el" "calendar/cal-china.el" "calendar/cal-coptic.el"
-;;;;;;  "calendar/cal-french.el" "calendar/cal-islam.el" "calendar/cal-iso.el"
-;;;;;;  "calendar/cal-julian.el" "calendar/cal-mayan.el" "calendar/cal-menu.el"
-;;;;;;  "calendar/cal-move.el" "calendar/cal-persia.el" "calendar/cal-tex.el"
-;;;;;;  "calendar/cal-x.el" "case-table.el" "cdl.el" "cus-dep.el"
-;;;;;;  "cus-load.el" "cus-start.el" "custom.el" "dos-fns.el" "dos-vars.el"
-;;;;;;  "dos-w32.el" "ediff-diff.el" "ediff-init.el" "ediff-merg.el"
-;;;;;;  "ediff-ptch.el" "ediff-vers.el" "ediff-wind.el" "electric.el"
-;;;;;;  "emacs-lisp/assoc.el" "emacs-lisp/authors.el" "emacs-lisp/bindat.el"
-;;;;;;  "emacs-lisp/byte-opt.el" "emacs-lisp/byte-run.el" "emacs-lisp/cl-compat.el"
-;;;;;;  "emacs-lisp/cl-extra.el" "emacs-lisp/cl-macs.el" "emacs-lisp/cl-seq.el"
-;;;;;;  "emacs-lisp/cl-specs.el" "emacs-lisp/cust-print.el" "emacs-lisp/ewoc.el"
-;;;;;;  "emacs-lisp/find-gc.el" "emacs-lisp/float-sup.el" "emacs-lisp/gulp.el"
-;;;;;;  "emacs-lisp/levents.el" "emacs-lisp/lisp-mnt.el" "emacs-lisp/lisp-mode.el"
-;;;;;;  "emacs-lisp/lisp.el" "emacs-lisp/lmenu.el" "emacs-lisp/lselect.el"
-;;;;;;  "emacs-lisp/lucid.el" "emacs-lisp/map-ynp.el" "emacs-lisp/regi.el"
-;;;;;;  "emacs-lisp/sregex.el" "emacs-lisp/testcover-ses.el" "emacs-lisp/testcover-unsafep.el"
-;;;;;;  "emacs-lock.el" "emulation/cua-gmrk.el" "emulation/cua-rect.el"
-;;;;;;  "emulation/edt-lk201.el" "emulation/edt-mapper.el" "emulation/edt-pc.el"
-;;;;;;  "emulation/edt-vt100.el" "emulation/tpu-mapper.el" "emulation/viper-cmd.el"
-;;;;;;  "emulation/viper-ex.el" "emulation/viper-init.el" "emulation/viper-keym.el"
-;;;;;;  "emulation/viper-macs.el" "emulation/viper-mous.el" "emulation/viper-util.el"
-;;;;;;  "env.el" "eshell/em-alias.el" "eshell/em-banner.el" "eshell/em-basic.el"
-;;;;;;  "eshell/em-cmpl.el" "eshell/em-dirs.el" "eshell/em-glob.el"
-;;;;;;  "eshell/em-hist.el" "eshell/em-ls.el" "eshell/em-pred.el"
-;;;;;;  "eshell/em-prompt.el" "eshell/em-rebind.el" "eshell/em-script.el"
-;;;;;;  "eshell/em-smart.el" "eshell/em-term.el" "eshell/em-unix.el"
-;;;;;;  "eshell/em-xtra.el" "eshell/esh-arg.el" "eshell/esh-cmd.el"
-;;;;;;  "eshell/esh-ext.el" "eshell/esh-groups.el" "eshell/esh-io.el"
-;;;;;;  "eshell/esh-maint.el" "eshell/esh-module.el" "eshell/esh-opt.el"
-;;;;;;  "eshell/esh-proc.el" "eshell/esh-util.el" "eshell/esh-var.el"
-;;;;;;  "faces.el" "files.el" "filesets.el" "finder-inf.el" "foldout.el"
-;;;;;;  "font-core.el" "format.el" "forms-d2.el" "forms-pass.el"
-;;;;;;  "frame.el" "generic-x.el" "gnus/flow-fill.el" "gnus/format-spec.el"
-;;;;;;  "gnus/gnus-async.el" "gnus/gnus-bcklg.el" "gnus/gnus-cite.el"
-;;;;;;  "gnus/gnus-cus.el" "gnus/gnus-demon.el" "gnus/gnus-draft.el"
-;;;;;;  "gnus/gnus-dup.el" "gnus/gnus-eform.el" "gnus/gnus-ems.el"
-;;;;;;  "gnus/gnus-gl.el" "gnus/gnus-int.el" "gnus/gnus-logic.el"
-;;;;;;  "gnus/gnus-mh.el" "gnus/gnus-nocem.el" "gnus/gnus-range.el"
-;;;;;;  "gnus/gnus-salt.el" "gnus/gnus-score.el" "gnus/gnus-setup.el"
-;;;;;;  "gnus/gnus-srvr.el" "gnus/gnus-sum.el" "gnus/gnus-topic.el"
-;;;;;;  "gnus/gnus-undo.el" "gnus/gnus-util.el" "gnus/gnus-uu.el"
-;;;;;;  "gnus/gnus-vm.el" "gnus/ietf-drums.el" "gnus/imap.el" "gnus/mail-parse.el"
+;;;;;;  "calc/calcsel2.el" "calendar/cal-bahai.el" "calendar/cal-china.el"
+;;;;;;  "calendar/cal-coptic.el" "calendar/cal-french.el" "calendar/cal-islam.el"
+;;;;;;  "calendar/cal-iso.el" "calendar/cal-julian.el" "calendar/cal-mayan.el"
+;;;;;;  "calendar/cal-menu.el" "calendar/cal-move.el" "calendar/cal-persia.el"
+;;;;;;  "calendar/cal-tex.el" "calendar/cal-x.el" "calendar/icalendar.el"
+;;;;;;  "case-table.el" "cdl.el" "cus-dep.el" "cus-load.el" "cus-start.el"
+;;;;;;  "custom.el" "dos-fns.el" "dos-vars.el" "dos-w32.el" "ediff-diff.el"
+;;;;;;  "ediff-init.el" "ediff-merg.el" "ediff-ptch.el" "ediff-vers.el"
+;;;;;;  "ediff-wind.el" "electric.el" "emacs-lisp/assoc.el" "emacs-lisp/authors.el"
+;;;;;;  "emacs-lisp/bindat.el" "emacs-lisp/byte-opt.el" "emacs-lisp/byte-run.el"
+;;;;;;  "emacs-lisp/cl-compat.el" "emacs-lisp/cl-extra.el" "emacs-lisp/cl-macs.el"
+;;;;;;  "emacs-lisp/cl-seq.el" "emacs-lisp/cl-specs.el" "emacs-lisp/cust-print.el"
+;;;;;;  "emacs-lisp/ewoc.el" "emacs-lisp/find-gc.el" "emacs-lisp/float-sup.el"
+;;;;;;  "emacs-lisp/gulp.el" "emacs-lisp/levents.el" "emacs-lisp/lisp-mnt.el"
+;;;;;;  "emacs-lisp/lisp-mode.el" "emacs-lisp/lisp.el" "emacs-lisp/lmenu.el"
+;;;;;;  "emacs-lisp/lselect.el" "emacs-lisp/lucid.el" "emacs-lisp/map-ynp.el"
+;;;;;;  "emacs-lisp/regi.el" "emacs-lisp/sregex.el" "emacs-lisp/tcover-ses.el"
+;;;;;;  "emacs-lisp/tcover-unsafep.el" "emacs-lock.el" "emulation/cua-gmrk.el"
+;;;;;;  "emulation/cua-rect.el" "emulation/edt-lk201.el" "emulation/edt-mapper.el"
+;;;;;;  "emulation/edt-pc.el" "emulation/edt-vt100.el" "emulation/tpu-mapper.el"
+;;;;;;  "emulation/viper-cmd.el" "emulation/viper-ex.el" "emulation/viper-init.el"
+;;;;;;  "emulation/viper-keym.el" "emulation/viper-macs.el" "emulation/viper-mous.el"
+;;;;;;  "emulation/viper-util.el" "env.el" "eshell/em-alias.el" "eshell/em-banner.el"
+;;;;;;  "eshell/em-basic.el" "eshell/em-cmpl.el" "eshell/em-dirs.el"
+;;;;;;  "eshell/em-glob.el" "eshell/em-hist.el" "eshell/em-ls.el"
+;;;;;;  "eshell/em-pred.el" "eshell/em-prompt.el" "eshell/em-rebind.el"
+;;;;;;  "eshell/em-script.el" "eshell/em-smart.el" "eshell/em-term.el"
+;;;;;;  "eshell/em-unix.el" "eshell/em-xtra.el" "eshell/esh-arg.el"
+;;;;;;  "eshell/esh-cmd.el" "eshell/esh-ext.el" "eshell/esh-groups.el"
+;;;;;;  "eshell/esh-io.el" "eshell/esh-maint.el" "eshell/esh-module.el"
+;;;;;;  "eshell/esh-opt.el" "eshell/esh-proc.el" "eshell/esh-util.el"
+;;;;;;  "eshell/esh-var.el" "faces.el" "files.el" "filesets.el" "finder-inf.el"
+;;;;;;  "foldout.el" "font-core.el" "format.el" "forms-d2.el" "forms-pass.el"
+;;;;;;  "frame.el" "generic-x.el" "gnus/compface.el" "gnus/dig.el"
+;;;;;;  "gnus/dns.el" "gnus/format-spec.el" "gnus/gnus-async.el"
+;;;;;;  "gnus/gnus-bcklg.el" "gnus/gnus-cite.el" "gnus/gnus-cus.el"
+;;;;;;  "gnus/gnus-demon.el" "gnus/gnus-diary.el" "gnus/gnus-dup.el"
+;;;;;;  "gnus/gnus-eform.el" "gnus/gnus-ems.el" "gnus/gnus-gl.el"
+;;;;;;  "gnus/gnus-int.el" "gnus/gnus-logic.el" "gnus/gnus-mh.el"
+;;;;;;  "gnus/gnus-nocem.el" "gnus/gnus-salt.el" "gnus/gnus-score.el"
+;;;;;;  "gnus/gnus-setup.el" "gnus/gnus-srvr.el" "gnus/gnus-sum.el"
+;;;;;;  "gnus/gnus-topic.el" "gnus/gnus-undo.el" "gnus/gnus-util.el"
+;;;;;;  "gnus/gnus-uu.el" "gnus/gnus-vm.el" "gnus/hex-util.el" "gnus/ietf-drums.el"
+;;;;;;  "gnus/imap.el" "gnus/legacy-gnus-agent.el" "gnus/mail-parse.el"
 ;;;;;;  "gnus/mail-prsvr.el" "gnus/mail-source.el" "gnus/mailcap.el"
 ;;;;;;  "gnus/messcompat.el" "gnus/mm-bodies.el" "gnus/mm-decode.el"
-;;;;;;  "gnus/mm-encode.el" "gnus/mm-util.el" "gnus/mm-view.el" "gnus/mml.el"
-;;;;;;  "gnus/nnagent.el" "gnus/nnbabyl.el" "gnus/nndir.el" "gnus/nndraft.el"
-;;;;;;  "gnus/nneething.el" "gnus/nngateway.el" "gnus/nnheader.el"
-;;;;;;  "gnus/nnimap.el" "gnus/nnlistserv.el" "gnus/nnmail.el" "gnus/nnmbox.el"
-;;;;;;  "gnus/nnmh.el" "gnus/nnoo.el" "gnus/nnslashdot.el" "gnus/nnspool.el"
-;;;;;;  "gnus/nntp.el" "gnus/nnultimate.el" "gnus/nnvirtual.el" "gnus/nnwarchive.el"
-;;;;;;  "gnus/nnweb.el" "gnus/pop3.el" "gnus/qp.el" "gnus/rfc1843.el"
-;;;;;;  "gnus/rfc2045.el" "gnus/rfc2047.el" "gnus/rfc2104.el" "gnus/rfc2231.el"
+;;;;;;  "gnus/mm-encode.el" "gnus/mm-util.el" "gnus/mm-view.el" "gnus/mml-sec.el"
+;;;;;;  "gnus/mml-smime.el" "gnus/mml.el" "gnus/nnagent.el" "gnus/nnbabyl.el"
+;;;;;;  "gnus/nndb.el" "gnus/nndir.el" "gnus/nndraft.el" "gnus/nneething.el"
+;;;;;;  "gnus/nngateway.el" "gnus/nnheader.el" "gnus/nnimap.el" "gnus/nnlistserv.el"
+;;;;;;  "gnus/nnmail.el" "gnus/nnmaildir.el" "gnus/nnmbox.el" "gnus/nnmh.el"
+;;;;;;  "gnus/nnnil.el" "gnus/nnoo.el" "gnus/nnrss.el" "gnus/nnslashdot.el"
+;;;;;;  "gnus/nnspool.el" "gnus/nntp.el" "gnus/nnultimate.el" "gnus/nnvirtual.el"
+;;;;;;  "gnus/nnwarchive.el" "gnus/nnweb.el" "gnus/nnwfm.el" "gnus/pgg-def.el"
+;;;;;;  "gnus/pgg-gpg.el" "gnus/pgg-parse.el" "gnus/pgg-pgp.el" "gnus/pgg-pgp5.el"
+;;;;;;  "gnus/pop3.el" "gnus/rfc1843.el" "gnus/rfc2045.el" "gnus/rfc2047.el"
+;;;;;;  "gnus/rfc2104.el" "gnus/rfc2231.el" "gnus/sieve-manage.el"
+;;;;;;  "gnus/smime.el" "gnus/spam-report.el" "gnus/spam-stat.el"
 ;;;;;;  "gnus/starttls.el" "gnus/utf7.el" "gnus/webmail.el" "help.el"
 ;;;;;;  "indent.el" "international/characters.el" "international/fontset.el"
 ;;;;;;  "international/iso-ascii.el" "international/iso-insert.el"
@@ -25971,16 +28569,16 @@
 ;;;;;;  "language/vietnamese.el" "ldefs-boot.el" "loadup.el" "mail/blessmail.el"
 ;;;;;;  "mail/mailheader.el" "mail/mailpost.el" "mail/mspools.el"
 ;;;;;;  "mail/rfc2368.el" "mail/rfc822.el" "mail/rmail-spam-filter.el"
-;;;;;;  "mail/uce.el" "mail/vms-pmail.el" "mh-e/mh-alias.el" "mh-e/mh-customize.el"
-;;;;;;  "mh-e/mh-funcs.el" "mh-e/mh-identity.el" "mh-e/mh-inc.el"
-;;;;;;  "mh-e/mh-index.el" "mh-e/mh-junk.el" "mh-e/mh-loaddefs.el"
-;;;;;;  "mh-e/mh-mime.el" "mh-e/mh-pick.el" "mh-e/mh-seq.el" "mh-e/mh-speed.el"
-;;;;;;  "mh-e/mh-xemacs-compat.el" "mh-e/mh-xemacs-icons.el" "misc.el"
-;;;;;;  "mouse-copy.el" "mouse-drag.el" "mouse.el" "net/eudc-vars.el"
-;;;;;;  "net/eudcb-bbdb.el" "net/eudcb-ldap.el" "net/eudcb-ph.el"
-;;;;;;  "net/ldap.el" "net/netrc.el" "net/tls.el" "net/tramp-ftp.el"
-;;;;;;  "net/tramp-smb.el" "net/tramp-util.el" "net/tramp-uu.el"
-;;;;;;  "net/tramp-vc.el" "net/trampver.el" "obsolete/awk-mode.el"
+;;;;;;  "mail/uce.el" "mail/vms-pmail.el" "mh-e/mh-acros.el" "mh-e/mh-alias.el"
+;;;;;;  "mh-e/mh-customize.el" "mh-e/mh-funcs.el" "mh-e/mh-gnus.el"
+;;;;;;  "mh-e/mh-identity.el" "mh-e/mh-inc.el" "mh-e/mh-index.el"
+;;;;;;  "mh-e/mh-junk.el" "mh-e/mh-loaddefs.el" "mh-e/mh-mime.el"
+;;;;;;  "mh-e/mh-pick.el" "mh-e/mh-print.el" "mh-e/mh-seq.el" "mh-e/mh-speed.el"
+;;;;;;  "mh-e/mh-utils.el" "misc.el" "mouse-copy.el" "mouse-drag.el"
+;;;;;;  "mouse.el" "net/eudc-vars.el" "net/eudcb-bbdb.el" "net/eudcb-ldap.el"
+;;;;;;  "net/eudcb-ph.el" "net/ldap.el" "net/netrc.el" "net/tls.el"
+;;;;;;  "net/tramp-ftp.el" "net/tramp-smb.el" "net/tramp-util.el"
+;;;;;;  "net/tramp-uu.el" "net/tramp-vc.el" "net/trampver.el" "obsolete/awk-mode.el"
 ;;;;;;  "obsolete/float.el" "obsolete/hilit19.el" "obsolete/mlsupport.el"
 ;;;;;;  "obsolete/ooutline.el" "obsolete/profile.el" "obsolete/rnews.el"
 ;;;;;;  "obsolete/sc.el" "obsolete/sun-curs.el" "obsolete/sun-fns.el"
@@ -25990,29 +28588,34 @@
 ;;;;;;  "progmodes/cc-align.el" "progmodes/cc-awk.el" "progmodes/cc-bytecomp.el"
 ;;;;;;  "progmodes/cc-cmds.el" "progmodes/cc-compat.el" "progmodes/cc-defs.el"
 ;;;;;;  "progmodes/cc-engine.el" "progmodes/cc-fonts.el" "progmodes/cc-langs.el"
-;;;;;;  "progmodes/cc-menus.el" "progmodes/cc-vars.el" "progmodes/ebnf-bnf.el"
+;;;;;;  "progmodes/cc-menus.el" "progmodes/cc-vars.el" "progmodes/ebnf-abn.el"
+;;;;;;  "progmodes/ebnf-bnf.el" "progmodes/ebnf-dtd.el" "progmodes/ebnf-ebx.el"
 ;;;;;;  "progmodes/ebnf-iso.el" "progmodes/ebnf-otz.el" "progmodes/ebnf-yac.el"
-;;;;;;  "progmodes/idlw-rinfo.el" "progmodes/idlw-toolbar.el" "progmodes/mantemp.el"
-;;;;;;  "progmodes/xscheme.el" "register.el" "replace.el" "s-region.el"
-;;;;;;  "saveplace.el" "scroll-bar.el" "select.el" "simple.el" "soundex.el"
-;;;;;;  "startup.el" "subdirs.el" "subr.el" "tempo.el" "term/AT386.el"
-;;;;;;  "term/apollo.el" "term/bg-mouse.el" "term/bobcat.el" "term/internal.el"
-;;;;;;  "term/iris-ansi.el" "term/keyswap.el" "term/linux.el" "term/lk201.el"
-;;;;;;  "term/mac-win.el" "term/news.el" "term/pc-win.el" "term/rxvt.el"
-;;;;;;  "term/sun-mouse.el" "term/sun.el" "term/sup-mouse.el" "term/tty-colors.el"
-;;;;;;  "term/tvi970.el" "term/vt100.el" "term/vt102.el" "term/vt125.el"
-;;;;;;  "term/vt200.el" "term/vt201.el" "term/vt220.el" "term/vt240.el"
-;;;;;;  "term/vt300.el" "term/vt320.el" "term/vt400.el" "term/vt420.el"
-;;;;;;  "term/w32-win.el" "term/wyse50.el" "term/x-win.el" "term/xterm.el"
-;;;;;;  "textmodes/bib-mode.el" "textmodes/fill.el" "textmodes/makeinfo.el"
-;;;;;;  "textmodes/page-ext.el" "textmodes/page.el" "textmodes/paragraphs.el"
-;;;;;;  "textmodes/refbib.el" "textmodes/refer.el" "textmodes/reftex-auc.el"
-;;;;;;  "textmodes/reftex-dcr.el" "textmodes/reftex-global.el" "textmodes/reftex-ref.el"
-;;;;;;  "textmodes/reftex-sel.el" "textmodes/reftex-toc.el" "textmodes/reftex-vars.el"
-;;;;;;  "textmodes/texnfo-upd.el" "textmodes/text-mode.el" "timezone.el"
-;;;;;;  "uniquify.el" "vc-hooks.el" "vcursor.el" "version.el" "vms-patch.el"
-;;;;;;  "vmsproc.el" "vt-control.el" "vt100-led.el" "w32-fns.el"
-;;;;;;  "w32-vars.el" "widget.el" "window.el") (16313 5919 739767))
+;;;;;;  "progmodes/idlw-help.el" "progmodes/idlw-rinfo.el" "progmodes/idlw-toolbar.el"
+;;;;;;  "progmodes/mantemp.el" "progmodes/xscheme.el" "register.el"
+;;;;;;  "replace.el" "s-region.el" "saveplace.el" "scroll-bar.el"
+;;;;;;  "select.el" "simple.el" "soundex.el" "startup.el" "subdirs.el"
+;;;;;;  "subr.el" "tempo.el" "term/AT386.el" "term/apollo.el" "term/bg-mouse.el"
+;;;;;;  "term/bobcat.el" "term/internal.el" "term/iris-ansi.el" "term/keyswap.el"
+;;;;;;  "term/linux.el" "term/lk201.el" "term/mac-win.el" "term/news.el"
+;;;;;;  "term/pc-win.el" "term/rxvt.el" "term/sun-mouse.el" "term/sun.el"
+;;;;;;  "term/sup-mouse.el" "term/tty-colors.el" "term/tvi970.el"
+;;;;;;  "term/vt100.el" "term/vt102.el" "term/vt125.el" "term/vt200.el"
+;;;;;;  "term/vt201.el" "term/vt220.el" "term/vt240.el" "term/vt300.el"
+;;;;;;  "term/vt320.el" "term/vt400.el" "term/vt420.el" "term/w32-win.el"
+;;;;;;  "term/wyse50.el" "term/x-win.el" "term/xterm.el" "textmodes/bib-mode.el"
+;;;;;;  "textmodes/fill.el" "textmodes/makeinfo.el" "textmodes/page-ext.el"
+;;;;;;  "textmodes/page.el" "textmodes/paragraphs.el" "textmodes/refbib.el"
+;;;;;;  "textmodes/refer.el" "textmodes/reftex-auc.el" "textmodes/reftex-dcr.el"
+;;;;;;  "textmodes/reftex-global.el" "textmodes/reftex-ref.el" "textmodes/reftex-sel.el"
+;;;;;;  "textmodes/reftex-toc.el" "textmodes/reftex-vars.el" "textmodes/texnfo-upd.el"
+;;;;;;  "textmodes/text-mode.el" "timezone.el" "tree-widget.el" "uniquify.el"
+;;;;;;  "url/url-about.el" "url/url-dired.el" "url/url-expand.el"
+;;;;;;  "url/url-ftp.el" "url/url-https.el" "url/url-imap.el" "url/url-methods.el"
+;;;;;;  "url/url-nfs.el" "url/url-proxy.el" "url/url-vars.el" "url/vc-dav.el"
+;;;;;;  "vc-hooks.el" "vcursor.el" "version.el" "vms-patch.el" "vmsproc.el"
+;;;;;;  "vt-control.el" "vt100-led.el" "w32-fns.el" "w32-vars.el"
+;;;;;;  "widget.el" "window.el" "x-dnd.el") (16820 23750 66854))
 
 ;;;***
 
--- a/lisp/macros.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/macros.el	Wed Dec 08 22:20:27 2004 +0000
@@ -63,12 +63,13 @@
 
 To save a kbd macro, visit a file of Lisp code such as your `~/.emacs',
 use this command, and then save the file."
-  (interactive (list (intern (completing-read "Insert kbd macro (name): " 
-					      obarray 
+  (interactive (list (intern (completing-read "Insert kbd macro (name): "
+					      obarray
 					      (lambda (elt)
 						(and (fboundp elt)
 						     (or (stringp (symbol-function elt))
-							 (vectorp (symbol-function elt)))))
+							 (vectorp (symbol-function elt))
+							 (get elt 'kmacro))))
 					      t))
 		     current-prefix-arg))
   (let (definition)
--- a/lisp/mail/emacsbug.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/mail/emacsbug.el	Wed Dec 08 22:20:27 2004 +0000
@@ -129,8 +129,10 @@
 
     (insert "In " (emacs-version) "\n")
     (if (fboundp 'x-server-vendor)
-	(insert "Distributor `" (x-server-vendor) "', version "
-		(mapconcat 'number-to-string (x-server-version) ".") "\n"))
+	(condition-case nil
+	    (insert "Distributor `" (x-server-vendor) "', version "
+		    (mapconcat 'number-to-string (x-server-version) ".") "\n")
+	  (error t)))
     (if (and system-configuration-options
 	     (not (equal system-configuration-options "")))
 	(insert "configured using `configure "
--- a/lisp/mail/supercite.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/mail/supercite.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,6 @@
 ;;; supercite.el --- minor mode for citing mail and news replies
 
-;; Copyright (C) 1993, 1997, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1997, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: 1993 Barry A. Warsaw <bwarsaw@python.org>
 ;; Maintainer:    FSF
@@ -1434,7 +1434,10 @@
 and that means call `sc-select-attribution' too."
   (interactive "r\nP\np")
   (undo-boundary)
-  (let ((frame (or (sc-scan-info-alist sc-cite-frame-alist)
+  (let ((frame (or (sc-scan-info-alist
+		    (if (symbolp sc-cite-frame-alist)
+			(symbol-value sc-cite-frame-alist)
+		      sc-cite-frame-alist))
 		   sc-default-cite-frame))
 	(sc-confirm-always-p (if confirm-p t sc-confirm-always-p)))
     (run-hooks 'sc-pre-cite-hook)
@@ -1447,7 +1450,10 @@
 First runs `sc-pre-uncite-hook'."
   (interactive "r")
   (undo-boundary)
-  (let ((frame (or (sc-scan-info-alist sc-uncite-frame-alist)
+  (let ((frame (or (sc-scan-info-alist
+		    (if (symbolp sc-uncite-frame-alist)
+			(symbol-value sc-uncite-frame-alist)
+		      sc-uncite-frame-alist))
 		   sc-default-uncite-frame)))
     (run-hooks 'sc-pre-uncite-hook)
     (regi-interpret frame start end)))
@@ -1459,7 +1465,10 @@
   (let ((sc-confirm-always-p t))
     (sc-select-attribution))
   (undo-boundary)
-  (let ((frame (or (sc-scan-info-alist sc-recite-frame-alist)
+  (let ((frame (or (sc-scan-info-alist
+		    (if (symbolp sc-recite-frame-alist)
+			(symbol-value sc-recite-frame-alist)
+		      sc-recite-frame-alist))
 		   sc-default-recite-frame)))
     (run-hooks 'sc-pre-recite-hook)
     (regi-interpret frame start end)))
--- a/lisp/man.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/man.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,7 @@
 ;;; man.el --- browse UNIX manual pages -*- coding: iso-8859-1 -*-
 
-;; Copyright (C) 1993, 1994, 1996, 1997, 2001, 2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1996, 1997, 2001, 2003, 2004
+;;           Free Software Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <bwarsaw@cen.com>
 ;; Maintainer: FSF
@@ -94,6 +95,7 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
 (require 'assoc)
 (require 'button)
 
@@ -153,6 +155,11 @@
   :type 'face
   :group 'man)
 
+(defcustom Man-reverse-face 'highlight
+  "*Face to use when fontifying reverse video."
+  :type 'face
+  :group 'man)
+
 ;; Use the value of the obsolete user option Man-notify, if set.
 (defcustom Man-notify-method (if (boundp 'Man-notify) Man-notify 'friendly)
   "*Selects the behavior when manpage is ready.
@@ -813,13 +820,39 @@
   (interactive)
   (message "Please wait: formatting the %s man page..." Man-arguments)
   (goto-char (point-min))
-  (while (search-forward "\e[1m" nil t)
-    (delete-backward-char 4)
-    (put-text-property (point)
-		       (progn (if (search-forward "\e[0m" nil 'move)
-				  (delete-backward-char 4))
-			      (point))
-		       'face Man-overstrike-face))
+  ;; Fontify ANSI escapes.
+  (let ((faces nil)
+	(start (point)))
+    ;; http://www.isthe.com/chongo/tech/comp/ansi_escapes.html
+    ;; suggests many codes, but we only handle:
+    ;; ESC [ 00 m	reset to normal display
+    ;; ESC [ 01 m	bold
+    ;; ESC [ 04 m	underline
+    ;; ESC [ 07 m	reverse-video
+    ;; ESC [ 22 m	no-bold
+    ;; ESC [ 24 m	no-underline
+    ;; ESC [ 27 m	no-reverse-video
+    (while (re-search-forward "\e\\[0?\\([1470]\\|2\\([247]\\)\\)m" nil t)
+      (if faces (put-text-property start (match-beginning 0) 'face
+				   (if (cdr faces) faces (car faces))))
+      (setq faces
+	    (cond
+	     ((match-beginning 2)
+	      (delq (case (char-after (match-beginning 2))
+		      (?2 Man-overstrike-face)
+		      (?4 Man-underline-face)
+		      (?7 Man-reverse-face))
+		    faces))
+	     ((eq (char-after (match-beginning 1)) ?0) nil)
+	     (t
+	      (cons (case (char-after (match-beginning 1))
+		      (?1 Man-overstrike-face)
+		      (?4 Man-underline-face)
+		      (?7 Man-reverse-face))
+		    faces))))
+      (delete-region (match-beginning 0) (match-end 0))
+      (setq start (point))))
+  ;; Other highlighting.
   (if (< (buffer-size) (position-bytes (point-max)))
       ;; Multibyte characters exist.
       (progn
@@ -1372,5 +1405,5 @@
 
 (provide 'man)
 
-;;; arch-tag: 587cda76-8e23-4594-b1f3-89b6b09a0d47
+;; arch-tag: 587cda76-8e23-4594-b1f3-89b6b09a0d47
 ;;; man.el ends here
--- a/lisp/menu-bar.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/menu-bar.el	Wed Dec 08 22:20:27 2004 +0000
@@ -634,12 +634,17 @@
   "Save current values of Options menu items using Custom."
   (interactive)
   (let ((need-save nil))
+    ;; These are set with menu-bar-make-mm-toggle, which does not
+    ;; put on a customized-value property.
+    (dolist (elt '(line-number-mode column-number-mode cua-mode show-paren-mode
+		   transient-mark-mode global-font-lock-mode))
+      (and (customize-mark-to-save elt)
+	   (setq need-save t)))
     ;; These are set with `customize-set-variable'.
-    (dolist (elt '(line-number-mode column-number-mode scroll-bar-mode
+    (dolist (elt '(scroll-bar-mode
 		   debug-on-quit debug-on-error menu-bar-mode tool-bar-mode
 		   save-place uniquify-buffer-name-style fringe-mode
-		   case-fold-search cua-mode show-paren-mode
-		   transient-mark-mode global-font-lock-mode
+		   fringe-indicators case-fold-search
 		   display-time-mode auto-compression-mode
 		   current-language-environment default-input-method
 		   ;; Saving `text-mode-hook' is somewhat questionable,
@@ -710,6 +715,87 @@
 			      (frame-visible-p
 			       (symbol-value 'speedbar-frame))))))
 
+
+(defvar menu-bar-showhide-fringe-ind-menu (make-sparse-keymap "Indicators"))
+
+;; The real definition is in fringe.el.
+;; This is to prevent errors in the :radio conditions below.
+(setq fringe-indicators nil)
+
+(defun menu-bar-showhide-fringe-ind-empty ()
+  "Display empty line indicators in the left or right fringe."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-indicators 'empty))
+
+(define-key menu-bar-showhide-fringe-ind-menu [empty]
+  '(menu-item "Empty lines only" menu-bar-showhide-fringe-ind-empty
+	      :help "Show empty line indicators in fringe"
+	      :visible (display-graphic-p)
+	      :button (:radio . (eq fringe-indicators 'empty))))
+
+(defun menu-bar-showhide-fringe-ind-mixed ()
+  "Display top and bottom indicators in opposite fringes, arrow in right."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-indicators 'mixed))
+
+(define-key menu-bar-showhide-fringe-ind-menu [mixed]
+  '(menu-item "Opposite, arrows right" menu-bar-showhide-fringe-ind-mixed
+	      :help "Show top/bottom indicators in opposite fringes, arrows in right"
+	      :visible (display-graphic-p)
+	      :button (:radio . (eq fringe-indicators 'mixed))))
+
+(defun menu-bar-showhide-fringe-ind-box ()
+  "Display top and bottom indicators in opposite fringes."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-indicators 'box))
+
+(define-key menu-bar-showhide-fringe-ind-menu [box]
+  '(menu-item "Opposite, no arrows" menu-bar-showhide-fringe-ind-box
+	      :help "Show top/bottom indicators in opposite fringes, no arrows"
+	      :visible (display-graphic-p)
+	      :button (:radio . (eq fringe-indicators 'box))))
+
+(defun menu-bar-showhide-fringe-ind-right ()
+  "Display fringe indicators in the right fringe."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-indicators 'right))
+
+(define-key menu-bar-showhide-fringe-ind-menu [right]
+  '(menu-item "In right fringe" menu-bar-showhide-fringe-ind-right
+	      :help "Show indicators in right fringe"
+	      :visible (display-graphic-p)
+	      :button (:radio . (eq fringe-indicators 'right))))
+
+(defun menu-bar-showhide-fringe-ind-left ()
+  "Display fringe indicators in the left fringe."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-indicators 'left))
+
+(define-key menu-bar-showhide-fringe-ind-menu [left]
+  '(menu-item "In left fringe" menu-bar-showhide-fringe-ind-left
+	      :help "Show indicators in left fringe"
+	      :visible (display-graphic-p)
+	      :button (:radio . (eq fringe-indicators 'left))))
+
+(defun menu-bar-showhide-fringe-ind-none ()
+  "Do not display any fringe indicators."
+  (interactive)
+  (require 'fringe)
+  (customize-set-variable 'fringe-indicators nil))
+
+(define-key menu-bar-showhide-fringe-ind-menu [none]
+  '(menu-item "No indicators" menu-bar-showhide-fringe-ind-none
+	      :help "Hide all fringe indicators"
+	      :visible (display-graphic-p)
+	      :button (:radio . (eq fringe-indicators nil))))
+
+
+
 (defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
 
 (defun menu-bar-showhide-fringe-menu-customize ()
@@ -727,6 +813,11 @@
   (interactive)
   (customize-set-variable 'fringe-mode nil))
 
+(define-key menu-bar-showhide-fringe-menu [showhide-fringe-ind]
+  (list 'menu-item "Indicators" menu-bar-showhide-fringe-ind-menu
+	:visible `(display-graphic-p)
+	:help "Select fringe mode"))
+
 ;; The real definition is in fringe.el.
 ;; This is to prevent errors in the :radio conditions below.
 (setq fringe-mode nil)
--- a/lisp/net/tramp.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/net/tramp.el	Wed Dec 08 22:20:27 2004 +0000
@@ -34,7 +34,7 @@
 ;;
 ;; Notes:
 ;; -----
-;; 
+;;
 ;; This package only works for Emacs 20 and higher, and for XEmacs 21
 ;; and higher.  (XEmacs 20 is missing the `with-timeout' macro.  Emacs
 ;; 19 is reported to have other problems.  For XEmacs 21, you need the
@@ -205,7 +205,7 @@
 
 gives the same backup policy for Tramp files on their hosts like the
 policy for local files."
-      :type '(repeat 
+      :type '(repeat
 	      (list (regexp :tag "File regexp")
 		    (string :tag "Backup Dir")
 		    (set :inline t
@@ -506,7 +506,7 @@
 	      (tramp-copy-args            nil)
 	      (tramp-copy-keep-date-arg   "-p")
 	      (tramp-password-end-of-line "xy")) ;see docstring for "xy"
-     ("fcp"   
+     ("fcp"
 	      (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "fsh")
               (tramp-copy-program         "fcp")
@@ -633,7 +633,7 @@
     ("rsh"    tramp-multi-connect-rlogin "rsh %h -l %u%n")
     ("remsh"  tramp-multi-connect-rlogin "remsh %h -l %u%n")
     ("ssh"    tramp-multi-connect-rlogin "ssh %h -l %u%n")
-    ("ssht"   tramp-multi-connect-rlogin "ssh %h -e none -t -t -l %u%n")     
+    ("ssht"   tramp-multi-connect-rlogin "ssh %h -e none -t -t -l %u%n")
     ("su"     tramp-multi-connect-su     "su - %u%n")
     ("sudo"   tramp-multi-connect-su     "sudo -u %u -s -p Password:%n"))
   "*List of connection functions for multi-hop methods.
@@ -777,7 +777,7 @@
       "sudo" tramp-completion-function-alist-su)
      (tramp-set-completion-function
       "multi" nil)
-     (tramp-set-completion-function 
+     (tramp-set-completion-function
       "scpx" tramp-completion-function-alist-ssh)
      (tramp-set-completion-function
       "sshx" tramp-completion-function-alist-ssh)
@@ -1547,20 +1547,92 @@
 ;; The device number is returned as "-1", because there will be a virtual
 ;; device number set in `tramp-handle-file-attributes'
 (defconst tramp-perl-file-attributes "\
-\($f, $n) = @ARGV;
-@s = lstat($f);
-if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; }
-elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; }
-else { $l = \"nil\" };
-$u = ($n eq \"nil\") ? $s[4] : getpwuid($s[4]);
-$g = ($n eq \"nil\") ? $s[5] : getgrgid($s[5]);
-printf(\"(%s %u %s %s (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) -1)\\n\",
-$l, $s[3], $u, $g, $s[8] >> 16 & 0xffff, $s[8] & 0xffff,
-$s[9] >> 16 & 0xffff, $s[9] & 0xffff, $s[10] >> 16 & 0xffff, $s[10] & 0xffff,
-$s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff);"
+@stat = lstat($ARGV[0]);
+if (($stat[2] & 0170000) == 0120000)
+{
+    $type = readlink($ARGV[0]);
+    $type = \"\\\"$type\\\"\";
+}
+elsif (($stat[2] & 0170000) == 040000)
+{
+    $type = \"t\";
+}
+else
+{
+    $type = \"nil\"
+};
+$uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
+$gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
+printf(
+    \"(%s %u %s %s (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) -1)\\n\",
+    $type,
+    $stat[3],
+    $uid,
+    $gid,
+    $stat[8] >> 16 & 0xffff,
+    $stat[8] & 0xffff,
+    $stat[9] >> 16 & 0xffff,
+    $stat[9] & 0xffff,
+    $stat[10] >> 16 & 0xffff,
+    $stat[10] & 0xffff,
+    $stat[7],
+    $stat[2],
+    $stat[1] >> 16 & 0xffff,
+    $stat[1] & 0xffff
+);"
   "Perl script to produce output suitable for use with `file-attributes'
 on the remote file system.")
 
+(defconst tramp-perl-directory-files-and-attributes "\
+chdir($ARGV[0]);
+opendir(DIR,\".\");
+@list = readdir(DIR);
+closedir(DIR);
+$n = scalar(@list);
+printf(\"(\\n\");
+for($i = 0; $i < $n; $i++)
+{
+    $filename = $list[$i];
+    @stat = lstat($filename);
+    if (($stat[2] & 0170000) == 0120000)
+    {
+        $type = readlink($filename);
+        $type = \"\\\"$type\\\"\";
+    }
+    elsif (($stat[2] & 0170000) == 040000)
+    {
+        $type = \"t\";
+    }
+    else
+    {
+        $type = \"nil\"
+    };
+    $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
+    $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
+    printf(
+        \"(\\\"%s\\\" %s %u %s %s (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) (%u %u))\\n\",
+        $filename,
+        $type,
+        $stat[3],
+        $uid,
+        $gid,
+        $stat[8] >> 16 & 0xffff,
+        $stat[8] & 0xffff,
+        $stat[9] >> 16 & 0xffff,
+        $stat[9] & 0xffff,
+        $stat[10] >> 16 & 0xffff,
+        $stat[10] & 0xffff,
+        $stat[7],
+        $stat[2],
+        $stat[1] >> 16 & 0xffff,
+        $stat[1] & 0xffff,
+        $stat[0] >> 16 & 0xffff,
+        $stat[0] & 0xffff);
+}
+printf(\")\\n\");"
+  "Perl script implementing `directory-files-attributes' as Lisp `read'able
+output.")
+
 ;; ;; These two use uu encoding.
 ;; (defvar tramp-perl-encode "%s -e'\
 ;; print qq(begin 644 xxx\n);
@@ -1759,8 +1831,8 @@
     (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
     (file-attributes . tramp-handle-file-attributes)
     (file-modes . tramp-handle-file-modes)
-    (file-directory-files . tramp-handle-file-directory-files)
     (directory-files . tramp-handle-directory-files)
+    (directory-files-and-attributes . tramp-handle-directory-files-and-attributes)
     (file-name-all-completions . tramp-handle-file-name-all-completions)
     (file-name-completion . tramp-handle-file-name-completion)
     (add-name-to-file . tramp-handle-add-name-to-file)
@@ -1984,7 +2056,7 @@
 	(setq filename (tramp-file-name-localname
 			(tramp-dissect-file-name
 			 (expand-file-name filename)))))
-    
+
       ;; Right, they are on the same host, regardless of user, method, etc.
       ;; We now make the link on the remote machine. This will occur as the user
       ;; that FILENAME belongs to.
@@ -1993,7 +2065,7 @@
 	l-multi-method l-method l-user l-host
 	(format "cd %s && %s -sf %s %s"
 		cwd ln
-		filename 
+		filename
 		l-localname)
 	t)))))
 
@@ -2170,26 +2242,21 @@
 ;; Daniel Pittman <daniel@danann.net>
 (defun tramp-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for tramp files."
-  (let ((nonnumeric (and id-format (equal id-format 'string)))
-	result)
+  (when (file-exists-p filename)
+    ;; file exists, find out stuff
+    (unless id-format (setq id-format 'integer))
     (with-parsed-tramp-file-name filename nil
-      (when (file-exists-p filename)
-	;; file exists, find out stuff
-	(save-excursion
-	  (if (tramp-get-remote-perl multi-method method user host)
-	      (setq result
-		    (tramp-handle-file-attributes-with-perl
-		     multi-method method user host localname nonnumeric))
-	    (setq result
-		  (tramp-handle-file-attributes-with-ls
-		   multi-method method user host localname nonnumeric)))
-	  ;; set virtual device number
-	  (setcar (nthcdr 11 result)
-		  (tramp-get-device multi-method method user host)))))
-    result))
+      (save-excursion
+        (tramp-convert-file-attributes
+         multi-method method user host
+         (if (tramp-get-remote-perl multi-method method user host)
+             (tramp-handle-file-attributes-with-perl multi-method method user host
+                                                     localname id-format)
+           (tramp-handle-file-attributes-with-ls multi-method method user host
+                                                 localname id-format)))))))
 
 (defun tramp-handle-file-attributes-with-ls
-  (multi-method method user host localname &optional nonnumeric)
+  (multi-method method user host localname &optional id-format)
   "Implement `file-attributes' for tramp files using the ls(1) command."
   (let (symlinkp dirp
 		 res-inode res-filemodes res-numlinks
@@ -2202,7 +2269,7 @@
      multi-method method user host
      (format "%s %s %s"
 	     (tramp-get-ls-command multi-method method user host)
-	     (if nonnumeric "-ild" "-ildn")
+	     (if (eq id-format 'integer) "-ildn" "-ild")
 	     (tramp-shell-quote-argument localname)))
     (tramp-wait-for-output)
     ;; parse `ls -l' output ...
@@ -2229,7 +2296,7 @@
     ;; ... uid and gid
     (setq res-uid (read (current-buffer)))
     (setq res-gid (read (current-buffer)))
-    (unless nonnumeric
+    (when (eq id-format 'integer)
       (unless (numberp res-uid) (setq res-uid -1))
       (unless (numberp res-gid) (setq res-gid -1)))
     ;; ... size
@@ -2274,33 +2341,20 @@
      )))
 
 (defun tramp-handle-file-attributes-with-perl
-  (multi-method method user host localname &optional nonnumeric)
-  "Implement `file-attributes' for tramp files using a Perl script.
-
-The Perl command is sent to the remote machine when the connection
-is initially created and is kept cached by the remote shell."
+  (multi-method method user host localname &optional id-format)
+  "Implement `file-attributes' for tramp files using a Perl script."
   (tramp-message-for-buffer multi-method method user host 10
 			    "file attributes with perl: %s"
 			    (tramp-make-tramp-file-name
 			     multi-method method user host localname))
-  (tramp-send-command
-   multi-method method user host
-   (format "tramp_file_attributes %s %s"
-	   (tramp-shell-quote-argument localname) nonnumeric))
+  (tramp-maybe-send-perl-script tramp-perl-file-attributes
+                                "tramp_file_attributes"
+                                multi-method method user host)
+  (tramp-send-command multi-method method user host
+                      (format "tramp_file_attributes %s %s"
+                              (tramp-shell-quote-argument localname) id-format))
   (tramp-wait-for-output)
-  (let ((result (read (current-buffer))))
-    (setcar (nthcdr 8 result)
-	    (tramp-file-mode-from-int (nth 8 result)))
-    result))
-
-(defun tramp-get-device (multi-method method user host)
-  "Returns the virtual device number.
-If it doesn't exist, generate a new one."
-  (let ((string (tramp-make-tramp-file-name multi-method method user host "")))
-    (unless (assoc string tramp-devices)
-      (add-to-list 'tramp-devices
-		   (list string (length tramp-devices))))
-    (list -1 (nth 1 (assoc string tramp-devices)))))
+  (read (current-buffer)))
 
 (defun tramp-handle-set-visited-file-modtime (&optional time-list)
   "Like `set-visited-file-modtime' for tramp files."
@@ -2352,7 +2406,7 @@
 	  (let* ((attr (file-attributes f))
 		 (modtime (nth 5 attr))
 		 (mt (visited-file-modtime)))
-	    
+
  	    (cond
 	     ;; file exists, and has a known modtime.
 	     ((and attr (not (equal modtime '(0 0))))
@@ -2442,7 +2496,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 fa1) (nth 5 fa2)))
 	       ;; 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
@@ -2628,6 +2682,38 @@
 		  (push item result)))))))
       result)))
 
+(defun tramp-handle-directory-files-and-attributes
+  (directory &optional full match nosort id-format)
+  "Like `directory-files-and-attributes' for tramp files."
+  (when (tramp-handle-file-exists-p directory)
+    (save-excursion
+      (setq directory (tramp-handle-expand-file-name directory))
+      (with-parsed-tramp-file-name directory nil
+        (tramp-maybe-send-perl-script tramp-perl-directory-files-and-attributes
+                                      "tramp_directory_files_and_attributes"
+                                      multi-method method user host)
+        (tramp-send-command multi-method method user host
+                            (format "tramp_directory_files_and_attributes %s %s"
+                                    (tramp-shell-quote-argument localname)
+                                    (or id-format 'integer)))
+        (tramp-wait-for-output)
+        (let* ((root (cons nil (read (current-buffer))))
+               (cell root))
+          (while (cdr cell)
+            (if (and match (not (string-match match (caadr cell))))
+                ;; Remove from list
+                (setcdr cell (cddr cell))
+              ;; Include in list
+              (setq cell (cdr cell))
+              (let ((l (car cell)))
+                (tramp-convert-file-attributes multi-method method user host
+                                               (cdr l))
+                ;; If FULL, make file name absolute
+                (when full (setcar l (concat directory "/" (car l)))))))
+          (if nosort
+              (cdr root)
+            (sort (cdr root) (lambda (x y) (string< (car x) (car y))))))))))
+
 ;; This function should return "foo/" for directories and "bar" for
 ;; files.  We use `ls -ad' to get a list of files (including
 ;; directories), and `find . -type d \! -name . -prune' to get a list
@@ -2667,7 +2753,7 @@
 	    (push (buffer-substring (point)
 				    (tramp-line-end-position))
 		  result))
-	
+
 	  (tramp-send-command multi-method method user host "cd")
 	  (tramp-wait-for-output)
 
@@ -3084,7 +3170,7 @@
 	 'file-error
 	 (list "Removing old file name" "no such directory" filename)))
     ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>)
-    (tramp-send-command multi-method method user host 
+    (tramp-send-command multi-method method user host
 			(format "rm -r %s" (tramp-shell-quote-argument localname)))
     ;; Wait for the remote system to return to us...
     ;; This might take a while, allow it plenty of time.
@@ -3092,7 +3178,7 @@
     ;; Make sure that it worked...
     (and (file-exists-p filename)
 	 (error "Failed to recusively delete %s" filename))))
-	 
+
 (defun tramp-handle-dired-call-process (program discard &rest arguments)
   "Like `dired-call-process' for tramp files."
   (with-parsed-tramp-file-name default-directory nil
@@ -3114,7 +3200,7 @@
 	  (tramp-send-command-and-check multi-method method user host nil)
 	(tramp-send-command multi-method method user host "cd")
 	(tramp-wait-for-output)))))
-	 
+
 (defun tramp-handle-dired-compress-file (file &rest ok-flag)
   "Like `dired-compress-file' for tramp files."
   ;; OK-FLAG is valid for XEmacs only, but not implemented.
@@ -3186,83 +3272,87 @@
 (defun tramp-handle-insert-directory
   (filename switches &optional wildcard full-directory-p)
   "Like `insert-directory' for tramp files."
-  ;; For the moment, we assume that the remote "ls" program does not
-  ;; grok "--dired".  In the future, we should detect this on
-  ;; connection setup.
-  (when (string-match "^--dired\\s-+" switches)
-    (setq switches (replace-match "" nil t switches)))
-  (setq filename (expand-file-name filename))
-  (with-parsed-tramp-file-name filename nil
-    (tramp-message-for-buffer
-     multi-method method user host 10
-     "Inserting directory `ls %s %s', wildcard %s, fulldir %s"
-     switches filename (if wildcard "yes" "no")
-     (if full-directory-p "yes" "no"))
-    (when wildcard
-      (setq wildcard (file-name-nondirectory localname))
-      (setq localname (file-name-directory localname)))
-    (when (listp switches)
-      (setq switches (mapconcat 'identity switches " ")))
-    (unless full-directory-p
-      (setq switches (concat "-d " switches)))
-    (when wildcard
-      (setq switches (concat switches " " wildcard)))
-    (save-excursion
-      ;; If `full-directory-p', we just say `ls -l FILENAME'.
-      ;; Else we chdir to the parent directory, then say `ls -ld BASENAME'.
-      (if full-directory-p
-	  (tramp-send-command
-	   multi-method method user host
-	   (format "%s %s %s"
-		   (tramp-get-ls-command multi-method method user host)
-		   switches
-		   (if wildcard
-		       localname
-		     (tramp-shell-quote-argument (concat localname ".")))))
-	(tramp-barf-unless-okay
-	 multi-method method user host
-	 (format "cd %s" (tramp-shell-quote-argument
-			  (file-name-directory localname)))
-	 nil 'file-error
-	 "Couldn't `cd %s'"
-	 (tramp-shell-quote-argument (file-name-directory localname)))
-	(tramp-send-command
-	 multi-method method user host
-	 (format "%s %s %s"
-		 (tramp-get-ls-command multi-method method user host)
-		 switches
-		 (if wildcard
-		     localname
-		   (tramp-shell-quote-argument
-		    (file-name-nondirectory localname))))))
-      (sit-for 1)			;needed for rsh but not ssh?
-      (tramp-wait-for-output))
-    ;; The following let-binding is used by code that's commented
-    ;; out.  Let's leave the let-binding in for a while to see
-    ;; that the commented-out code is really not needed.  Commenting-out
-    ;; happened on 2003-03-13.
-    (let ((old-pos (point)))
-      (insert-buffer-substring
-       (tramp-get-buffer multi-method method user host))
-      ;; On XEmacs, we want to call (exchange-point-and-mark t), but
-      ;; that doesn't exist on Emacs, so we use this workaround instead.
-      ;; Since zmacs-region-stays doesn't exist in Emacs, this ought to
-      ;; be safe.  Thanks to Daniel Pittman <daniel@danann.net>.
-      ;;     (let ((zmacs-region-stays t))
-      ;;       (exchange-point-and-mark))
+  (if (and (boundp 'ls-lisp-use-insert-directory-program)
+           (not ls-lisp-use-insert-directory-program))
+      (tramp-run-real-handler 'insert-directory
+                              (list filename switches wildcard full-directory-p))
+    ;; For the moment, we assume that the remote "ls" program does not
+    ;; grok "--dired".  In the future, we should detect this on
+    ;; connection setup.
+    (when (string-match "^--dired\\s-+" switches)
+      (setq switches (replace-match "" nil t switches)))
+    (setq filename (expand-file-name filename))
+    (with-parsed-tramp-file-name filename nil
+      (tramp-message-for-buffer
+       multi-method method user host 10
+       "Inserting directory `ls %s %s', wildcard %s, fulldir %s"
+       switches filename (if wildcard "yes" "no")
+       (if full-directory-p "yes" "no"))
+      (when wildcard
+        (setq wildcard (file-name-nondirectory localname))
+        (setq localname (file-name-directory localname)))
+      (when (listp switches)
+        (setq switches (mapconcat 'identity switches " ")))
+      (unless full-directory-p
+        (setq switches (concat "-d " switches)))
+      (when wildcard
+        (setq switches (concat switches " " wildcard)))
       (save-excursion
-	(tramp-send-command multi-method method user host "cd")
-	(tramp-wait-for-output))
-      ;; For the time being, the XEmacs kludge is commented out.
-      ;; Please test it on various XEmacs versions to see if it works.
-;;       ;; Another XEmacs specialty follows.  What's the right way to do
-;;       ;; it?
-;;       (when (and (featurep 'xemacs)
-;; 		 (eq major-mode 'dired-mode))
-;; 	(save-excursion
-;; 	  (require 'dired)
-;; 	  (dired-insert-set-properties old-pos (point))))
-      )))
+        ;; If `full-directory-p', we just say `ls -l FILENAME'.
+        ;; Else we chdir to the parent directory, then say `ls -ld BASENAME'.
+        (if full-directory-p
+            (tramp-send-command
+             multi-method method user host
+             (format "%s %s %s"
+                     (tramp-get-ls-command multi-method method user host)
+                     switches
+                     (if wildcard
+                         localname
+                       (tramp-shell-quote-argument (concat localname ".")))))
+          (tramp-barf-unless-okay
+           multi-method method user host
+           (format "cd %s" (tramp-shell-quote-argument
+                            (file-name-directory localname)))
+           nil 'file-error
+           "Couldn't `cd %s'"
+           (tramp-shell-quote-argument (file-name-directory localname)))
+          (tramp-send-command
+           multi-method method user host
+           (format "%s %s %s"
+                   (tramp-get-ls-command multi-method method user host)
+                   switches
+                   (if wildcard
+                       localname
+                     (tramp-shell-quote-argument
+                      (file-name-nondirectory localname))))))
+        (sit-for 1)			;needed for rsh but not ssh?
+        (tramp-wait-for-output))
+      ;; The following let-binding is used by code that's commented
+      ;; out.  Let's leave the let-binding in for a while to see
+      ;; that the commented-out code is really not needed.  Commenting-out
+      ;; happened on 2003-03-13.
+      (let ((old-pos (point)))
+        (insert-buffer-substring
+         (tramp-get-buffer multi-method method user host))
+        ;; On XEmacs, we want to call (exchange-point-and-mark t), but
+        ;; that doesn't exist on Emacs, so we use this workaround instead.
+        ;; Since zmacs-region-stays doesn't exist in Emacs, this ought to
+        ;; be safe.  Thanks to Daniel Pittman <daniel@danann.net>.
+        ;;     (let ((zmacs-region-stays t))
+        ;;       (exchange-point-and-mark))
+        (save-excursion
+          (tramp-send-command multi-method method user host "cd")
+          (tramp-wait-for-output))
+        ;; For the time being, the XEmacs kludge is commented out.
+        ;; Please test it on various XEmacs versions to see if it works.
+        ;;       ;; Another XEmacs specialty follows.  What's the right way to do
+        ;;       ;; it?
+        ;;       (when (and (featurep 'xemacs)
+        ;; 		 (eq major-mode 'dired-mode))
+        ;; 	(save-excursion
+        ;; 	  (require 'dired)
+        ;; 	  (dired-insert-set-properties old-pos (point))))
+        ))))
 
 ;; Continuation of kluge to pacify byte-compiler.
 ;;(eval-when-compile
@@ -3478,7 +3568,7 @@
   (when (and (numberp buffer) (zerop buffer))
     (error "Implementation does not handle immediate return"))
   (when (consp buffer) (error "Implementation does not handle error files"))
-  (shell-command 
+  (shell-command
    (mapconcat 'tramp-shell-quote-argument
               (cons program args)
               " ")
@@ -4160,7 +4250,7 @@
 ;; `tramp-completion-file-name-regexp-unified' aren't different.
 ;; If nil, `tramp-completion-run-real-handler' is called (i.e. forwarding to
 ;; `tramp-file-name-handler'). Otherwise, it takes `tramp-run-real-handler'.
-;; Using `last-input-event' is a little bit risky, because completing a file 
+;; Using `last-input-event' is a little bit risky, because completing a file
 ;; might require loading other files, like "~/.netrc", and for them it
 ;; shouldn't be decided based on that variable. On the other hand, those files
 ;; shouldn't have partial tramp file name syntax. Maybe another variable should
@@ -4264,7 +4354,7 @@
 			       (funcall (nth 0 x) (nth 1 x)))))
 	       (tramp-get-completion-function m))
 
-	      (setq result (append result 
+	      (setq result (append result
 	        (mapcar
 		 (lambda (x)
 		   (tramp-get-completion-user-host
@@ -4305,7 +4395,7 @@
 ;; [nil nil "x" nil nil]
 ;; [nil "x" nil nil nil]
 
-;; "/x:"                    "/x:y"                   "/x:y:"		      
+;; "/x:"                    "/x:y"                   "/x:y:"
 ;; [nil nil nil "x" ""]     [nil nil nil "x" "y"]    [nil "x" nil "y" ""]
 ;;       "/[x/"                   "/[x/y"
 ;; [nil "x" nil "" nil]     [nil "x" nil "y" nil]
@@ -4679,6 +4769,29 @@
 
 ;;; Internal Functions:
 
+(defun tramp-maybe-send-perl-script (script name multi-method method user host)
+  "Define in remote shell function NAME implemented as perl SCRIPT.
+Only send the definition if it has not already been done.
+Function may have 0-3 parameters."
+  (let ((remote-perl (tramp-get-remote-perl multi-method method user host)))
+    (unless remote-perl (error "No remote perl"))
+    (let ((perl-scripts (tramp-get-connection-property "perl-scripts" nil
+                                                       multi-method method user host)))
+      (unless (memq name perl-scripts)
+        (with-current-buffer (tramp-get-buffer multi-method method user host)
+          (tramp-message 5 (concat "Sending the Perl script `" name "'..."))
+          (tramp-send-string multi-method method user host
+                             (concat name
+                                     " () {\n"
+                                     remote-perl
+                                     " -e '"
+                                     script
+                                     "' \"$1\" \"$2\" \"$3\" 2>/dev/null\n}"))
+          (tramp-wait-for-output)
+          (tramp-set-connection-property "perl-scripts" (cons name perl-scripts)
+                                         multi-method method user host)
+          (tramp-message 5 (concat "Sending the Perl script `" name "'...done.")))))))
+
 (defun tramp-set-auto-save ()
   (when (and (buffer-file-name)
              (tramp-tramp-file-p (buffer-file-name))
@@ -4751,7 +4864,7 @@
 			"touch" nil (current-buffer) nil "-t" touch-time file))
 	      (pop-to-buffer (current-buffer))
 	      (error "tramp-touch: touch failed"))))))
- 
+
 (defun tramp-buffer-name (multi-method method user host)
   "A name for the connection buffer for USER at HOST using METHOD."
   (if multi-method
@@ -4909,7 +5022,7 @@
                   (file-exists-p existing)
                   (not (file-exists-p nonexisting))))
       (error "Couldn't find command to check if file exists."))))
-    
+
 
 ;; CCC test ksh or bash found for tilde expansion?
 (defun tramp-find-shell (multi-method method user host)
@@ -5008,9 +5121,9 @@
    (tramp-check-ls-commands multi-method method user host "gnuls" tramp-remote-path)
    (tramp-check-ls-commands multi-method method user host "gls" tramp-remote-path)))
 
-;; ------------------------------------------------------------ 
-;; -- Functions for establishing connection -- 
-;; ------------------------------------------------------------ 
+;; ------------------------------------------------------------
+;; -- Functions for establishing connection --
+;; ------------------------------------------------------------
 
 ;; The following functions are actions to be taken when seeing certain
 ;; prompts from the remote host.  See the variable
@@ -5251,7 +5364,7 @@
     (when multi-method
       (error "Cannot multi-connect using telnet connection method"))
     (tramp-pre-connection multi-method method user host)
-    (tramp-message 7 "Opening connection for %s@%s using %s..." 
+    (tramp-message 7 "Opening connection for %s@%s using %s..."
 		   (or user (user-login-name)) host method)
     (let ((process-environment (copy-sequence process-environment)))
       (setenv "TERM" tramp-terminal-type)
@@ -5285,7 +5398,7 @@
          p multi-method method user host)
         (tramp-post-connection multi-method method user host)))))
 
-	    
+
 (defun tramp-open-connection-rsh (multi-method method user host)
   "Open a connection using an rsh METHOD.
 This starts the command `rsh HOST -l USER'[*], then waits for a remote
@@ -5310,7 +5423,7 @@
       (error "Cannot multi-connect using rsh connection method"))
     (tramp-pre-connection multi-method method user host)
     (if (and user (not (string= user "")))
-	(tramp-message 7 "Opening connection for %s@%s using %s..." 
+	(tramp-message 7 "Opening connection for %s@%s using %s..."
 		       user host method)
       (tramp-message 7 "Opening connection at %s using %s..." host method))
     (let ((process-environment (copy-sequence process-environment))
@@ -5339,9 +5452,9 @@
                                                   (> emacs-major-version 20))
                                        tramp-dos-coding-system))
              (p (if (and user (not (string= user "")))
-                    (apply #'start-process bufnam buf login-program  
+                    (apply #'start-process bufnam buf login-program
                            real-host "-l" user login-args)
-                  (apply #'start-process bufnam buf login-program 
+                  (apply #'start-process bufnam buf login-program
                          real-host login-args)))
              (found nil))
         (tramp-set-process-query-on-exit-flag p nil)
@@ -5411,10 +5524,10 @@
 			       tramp-actions-before-shell)
         (tramp-open-connection-setup-interactive-shell
          p multi-method method user host)
-        (tramp-post-connection multi-method method 
+        (tramp-post-connection multi-method method
                                user host)))))
 
-;; HHH: Not Changed.  Multi method.  It is not clear to me how this can 
+;; HHH: Not Changed.  Multi method.  It is not clear to me how this can
 ;;      handle not giving a user name in the "file name".
 ;;
 ;;      This is more difficult than for the single-hop method.  In the
@@ -5484,7 +5597,7 @@
         (tramp-post-connection multi-method method user host)))))
 
 ;; HHH: Changed.  Multi method.  Don't know how to handle this in the case
-;;      of no user name provided.  Hack to make it work as it did before:  
+;;      of no user name provided.  Hack to make it work as it did before:
 ;;      changed `user' to `(or user (user-login-name))' in the places where
 ;;      the value is actually used.
 (defun tramp-multi-connect-telnet (p method user host command)
@@ -5506,8 +5619,8 @@
     (tramp-process-multi-actions p method user host
 				 tramp-multi-actions)))
 
-;; HHH: Changed.  Multi method.  Don't know how to handle this in the case 
-;;      of no user name provided.  Hack to make it work as it did before:  
+;; HHH: Changed.  Multi method.  Don't know how to handle this in the case
+;;      of no user name provided.  Hack to make it work as it did before:
 ;;      changed `user' to `(or user (user-login-name))' in the places where
 ;;      the value is actually used.
 (defun tramp-multi-connect-rlogin (p method user host command)
@@ -5532,8 +5645,8 @@
     (tramp-process-multi-actions p method user host
 				 tramp-multi-actions)))
 
-;; HHH: Changed.  Multi method.  Don't know how to handle this in the case 
-;;      of no user name provided.  Hack to make it work as it did before:  
+;; HHH: Changed.  Multi method.  Don't know how to handle this in the case
+;;      of no user name provided.  Hack to make it work as it did before:
 ;;      changed `user' to `(or user (user-login-name))' in the places where
 ;;      the value is actually used.
 (defun tramp-multi-connect-su (p method user host command)
@@ -5859,6 +5972,7 @@
   (tramp-wait-for-output)
   ;; Find a `perl'.
   (erase-buffer)
+  (tramp-set-connection-property "perl-scripts" nil multi-method method user host)
   (let ((tramp-remote-perl
 	 (or (tramp-find-executable multi-method method user host
 				    "perl5" tramp-remote-path nil)
@@ -5867,48 +5981,37 @@
     (when tramp-remote-perl
       (tramp-set-connection-property "perl" tramp-remote-perl
 				     multi-method method user host)
-      ;; Set up stat in Perl if we can.
-      (when tramp-remote-perl
-	(tramp-message 5 "Sending the Perl `file-attributes' implementation.")
-	(tramp-send-string
-	 multi-method method user host
-	 (concat "tramp_file_attributes () {\n"
-		 tramp-remote-perl
-		 " -e '" tramp-perl-file-attributes "'"
-		 " \"$1\" \"$2\" 2>/dev/null\n"
-		 "}"))
-	(tramp-wait-for-output)
-	(unless (tramp-method-out-of-band-p multi-method method user host)
-	  (tramp-message 5 "Sending the Perl `mime-encode' implementations.")
-	  (tramp-send-string
-	   multi-method method user host
-	   (concat "tramp_encode () {\n"
-		   (format tramp-perl-encode tramp-remote-perl)
-		   " 2>/dev/null"
-		   "\n}"))
-	  (tramp-wait-for-output)
-	  (tramp-send-string
-	   multi-method method user host
-	   (concat "tramp_encode_with_module () {\n"
-		   (format tramp-perl-encode-with-module tramp-remote-perl)
-		   " 2>/dev/null"
-		   "\n}"))
-	  (tramp-wait-for-output)
-	  (tramp-message 5 "Sending the Perl `mime-decode' implementations.")
-	  (tramp-send-string
-	   multi-method method user host
-	   (concat "tramp_decode () {\n"
-		   (format tramp-perl-decode tramp-remote-perl)
-		   " 2>/dev/null"
-		   "\n}"))
-	  (tramp-wait-for-output)
-	  (tramp-send-string
-	   multi-method method user host
-	   (concat "tramp_decode_with_module () {\n"
-		   (format tramp-perl-decode-with-module tramp-remote-perl)
-		   " 2>/dev/null"
-		   "\n}"))
-	  (tramp-wait-for-output)))))
+      (unless (tramp-method-out-of-band-p multi-method method user host)
+        (tramp-message 5 "Sending the Perl `mime-encode' implementations.")
+        (tramp-send-string
+         multi-method method user host
+         (concat "tramp_encode () {\n"
+                 (format tramp-perl-encode tramp-remote-perl)
+                 " 2>/dev/null"
+                 "\n}"))
+        (tramp-wait-for-output)
+        (tramp-send-string
+         multi-method method user host
+         (concat "tramp_encode_with_module () {\n"
+                 (format tramp-perl-encode-with-module tramp-remote-perl)
+                 " 2>/dev/null"
+                 "\n}"))
+        (tramp-wait-for-output)
+        (tramp-message 5 "Sending the Perl `mime-decode' implementations.")
+        (tramp-send-string
+         multi-method method user host
+         (concat "tramp_decode () {\n"
+                 (format tramp-perl-decode tramp-remote-perl)
+                 " 2>/dev/null"
+                 "\n}"))
+        (tramp-wait-for-output)
+        (tramp-send-string
+         multi-method method user host
+         (concat "tramp_decode_with_module () {\n"
+                 (format tramp-perl-decode-with-module tramp-remote-perl)
+                 " 2>/dev/null"
+                 "\n}"))
+        (tramp-wait-for-output))))
   ;; Find ln(1)
   (erase-buffer)
   (let ((ln (tramp-find-executable multi-method method user host
@@ -6173,7 +6276,7 @@
   (tramp-barf-if-no-shell-prompt
    nil 30
    "Couldn't `%s', see buffer `%s'" command (buffer-name)))
-  
+
 (defun tramp-wait-for-output (&optional timeout)
   "Wait for output from remote rsh command."
   (let ((proc (get-buffer-process (current-buffer)))
@@ -6417,6 +6520,26 @@
          (t (error "Tenth char `%c' must be one of `xtT-'"
                    other-execute-or-sticky)))))))
 
+(defun tramp-convert-file-attributes (multi-method method user host attr)
+  "Convert file-attributes ATTR generated by perl script or ls.
+Convert file mode bits to string and set virtual device number.
+Return ATTR."
+  (unless (stringp (nth 8 attr))
+    ;; Convert file mode bits to string.
+    (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))))
+  ;; Set virtual device number.
+  (setcar (nthcdr 11 attr)
+          (tramp-get-device multi-method method user host))
+  attr)
+
+(defun tramp-get-device (multi-method method user host)
+  "Returns the virtual device number.
+If it doesn't exist, generate a new one."
+  (let ((string (tramp-make-tramp-file-name multi-method method user host "")))
+    (unless (assoc string tramp-devices)
+      (add-to-list 'tramp-devices
+		   (list string (length tramp-devices))))
+    (list -1 (nth 1 (assoc string tramp-devices)))))
 
 (defun tramp-file-mode-from-int (mode)
   "Turn an integer representing a file mode into an ls(1)-like string."
@@ -6486,9 +6609,9 @@
    ""))
 
 
-;; ------------------------------------------------------------ 
-;; -- TRAMP file names -- 
-;; ------------------------------------------------------------ 
+;; ------------------------------------------------------------
+;; -- TRAMP file names --
+;; ------------------------------------------------------------
 ;; Conversion functions between external representation and
 ;; internal data structure.  Convenience functions for internal
 ;; data structure.
@@ -6499,7 +6622,7 @@
   "Return t iff NAME is a tramp file."
   (save-match-data
     (string-match tramp-file-name-regexp name)))
- 
+
 ;; HHH: Changed.  Used to assign the return value of (user-login-name)
 ;;      to the `user' part of the structure if a user name was not
 ;;      provided, now it assigns nil.
@@ -6552,7 +6675,7 @@
 If both MULTI-METHOD and METHOD are nil, do a lookup in
 `tramp-default-method-alist'."
   (or multi-method method (tramp-find-default-method user host)))
-    
+
 ;; HHH: Not Changed.  Multi method.  Will probably not handle the case where
 ;;      a user name is not provided in the "file name" very well.
 (defun tramp-dissect-multi-file-name (name)
@@ -6724,7 +6847,7 @@
     (if entry
 	(second entry)
       (symbol-value param))))
-      
+
 
 ;; Auto saving to a special directory.
 
@@ -6916,9 +7039,9 @@
 	     process flag)))
 
 
-;; ------------------------------------------------------------ 
-;; -- Kludges section -- 
-;; ------------------------------------------------------------ 
+;; ------------------------------------------------------------
+;; -- Kludges section --
+;; ------------------------------------------------------------
 
 ;; Currently (as of Emacs 20.5), the function `shell-quote-argument'
 ;; does not deal well with newline characters.  Newline is replaced by
@@ -7181,7 +7304,7 @@
 ;;   strange when doing zerop, we should kill the process and start
 ;;   again.  (Greg Stark)
 ;; * Add caching for filename completion.  (Greg Stark)
-;;   Of course, this has issues with usability (stale cache bites) 
+;;   Of course, this has issues with usability (stale cache bites)
 ;;      -- <daniel@danann.net>
 ;; * Provide a local cache of old versions of remote files for the rsync
 ;;   transfer method to use.  (Greg Stark)
--- a/lisp/paren.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/paren.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,6 @@
 ;;; paren.el --- highlight matching paren
 
-;; Copyright (C) 1993, 1996, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1996, 2001, 2004  Free Software Foundation, Inc.
 
 ;; Author: rms@gnu.org
 ;; Maintainer: FSF
@@ -139,8 +139,8 @@
 (defun show-paren-function ()
   (if show-paren-mode
       (let ((oldpos (point))
-	    (dir (cond ((eq (car (syntax-after (1- (point)))) ?\)) -1)
-		       ((eq (car (syntax-after (point))) ?\() 1)))
+	    (dir (cond ((eq (car (syntax-after (1- (point)))) 5) -1)
+		       ((eq (car (syntax-after (point))) 4) 1)))
 	    pos mismatch face)
 	;;
 	;; Find the other end of the sexp.
@@ -169,11 +169,14 @@
 	      ;; kind of paren to match the one we started at.
 	      (when (integerp pos)
 		(let ((beg (min pos oldpos)) (end (max pos oldpos)))
-		  (when (/= (char-syntax (char-after beg)) ?\$)
+		  (unless (eq (car (syntax-after beg)) 8) ;Not syntax `$'.
 		    (setq mismatch
-			  (not (eq (char-before end)
-				   ;; This can give nil.
-				   (matching-paren (char-after beg)))))))))))
+			  (not (or (eq (char-before end)
+				       ;; This can give nil.
+				       (cdr (syntax-after beg)))
+				   (eq (char-after beg)
+				       ;; This can give nil.
+				       (cdr (syntax-after (1- end)))))))))))))
 	;;
 	;; Highlight the other end of the sexp, or unhighlight if none.
 	(if (not pos)
@@ -246,5 +249,5 @@
 
 (provide 'paren)
 
-;;; arch-tag: d0969b88-7ac0-4bd0-bd53-e73b892b86a9
+;; arch-tag: d0969b88-7ac0-4bd0-bd53-e73b892b86a9
 ;;; paren.el ends here
--- a/lisp/pcvs.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/pcvs.el	Wed Dec 08 22:20:27 2004 +0000
@@ -575,7 +575,7 @@
   ;; emacsen. It shouldn't be needed, but it does no harm.
   (sit-for 0))
 
-(defun cvs-update-header (args fis) ; inline
+(defun cvs-header-msg (args fis)
   (let* ((lastarg nil)
 	 (args (mapcar (lambda (arg)
 			 (cond
@@ -595,38 +595,40 @@
 			   (concat (match-string 0 arg) "<log message>"))
 			  ;; Keep the rest as is.
 			  (t arg)))
-		       args))
-	 ;; turn them into a string
-	 (arg (cvs-strings->string
-	       (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery)
-		       (if cvs-cvsroot (list "-d" cvs-cvsroot))
-		       args
-		       (mapcar 'cvs-fileinfo->full-path fis))))
-	 (str (if args (concat "-- Running " cvs-program " " arg " ...\n")
-		"\n")))
-    (if nil (insert str)		;inline
-      ;;(with-current-buffer cvs-buffer
-      (let* ((prev-msg (car (ewoc-get-hf cvs-cookies)))
-	     (tin (ewoc-nth cvs-cookies 0)))
-	;; look for the first *real* fileinfo (to determine emptyness)
-	(while
-	    (and tin
-		 (memq (cvs-fileinfo->type (ewoc-data tin))
-		       '(MESSAGE DIRCHANGE)))
-	  (setq tin (ewoc-next cvs-cookies tin)))
-	;; cleanup the prev-msg
-	(when (string-match "Running \\(.*\\) ...\n" prev-msg)
-	  (setq prev-msg
-		(concat
-		 "-- last cmd: "
-		 (match-string 1 prev-msg)
-		 " --")))
-	;; set the new header and footer
-	(ewoc-set-hf cvs-cookies
-		     str (concat "\n--------------------- "
-				 (if tin "End" "Empty")
-				 " ---------------------\n"
-				 prev-msg))))))
+		       args)))
+    (concat cvs-program " "
+	    (cvs-strings->string
+	     (append (cvs-flags-query 'cvs-cvs-flags nil 'noquery)
+		     (if cvs-cvsroot (list "-d" cvs-cvsroot))
+		     args
+		     (mapcar 'cvs-fileinfo->full-path fis))))))
+
+(defun cvs-update-header (cmd add)
+  (let* ((hf (ewoc-get-hf cvs-cookies))
+	 (str (car hf))
+	 (done "")
+	 (tin (ewoc-nth cvs-cookies 0)))
+    (if (eq (length str) 1) (setq str ""))
+    ;; look for the first *real* fileinfo (to determine emptyness)
+    (while
+	(and tin
+	     (memq (cvs-fileinfo->type (ewoc-data tin))
+		   '(MESSAGE DIRCHANGE)))
+      (setq tin (ewoc-next cvs-cookies tin)))
+    (if add
+	(setq str (concat "-- Running " cmd " ...\n" str))
+      (if (not (string-match
+		(concat "^-- Running " (regexp-quote cmd) " \\.\\.\\.\n") str))
+	  (error "Internal PCL-CVS error while removing message")
+	(setq str (replace-match "" t t str))
+	(if (zerop (length str)) (setq str "\n"))
+	(setq done (concat "-- last cmd: " cmd " --"))))
+    ;; set the new header and footer
+    (ewoc-set-hf cvs-cookies
+		 str (concat "\n--------------------- "
+			     (if tin "End" "Empty")
+			     " ---------------------\n"
+			     done))))
 
 
 (defun cvs-sentinel (proc msg)
@@ -658,7 +660,6 @@
 	    ;; in a file-like buffer.  -stef
 	    (buffer-enable-undo)
 	    (with-current-buffer cvs-buffer
-	      (cvs-update-header nil nil) ;FIXME: might need to be inline
 	      (message "CVS process has completed in %s" (buffer-name)))))
 	;; This might not even be necessary
 	(set-buffer obuf)))))
@@ -1824,8 +1825,12 @@
 		;; absence of `cvs update' output has a specific meaning.
 		(or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." ""))))))
 	(push `(cvs-parse-process ',dont-change-disc nil ',old-fis) postproc)))
+    (let ((msg (cvs-header-msg args fis)))
+      (cvs-update-header msg 'add)
+      (push `(with-current-buffer cvs-buffer
+	       (cvs-update-header ',msg nil))
+	    postproc))
     (setq postproc (if (cdr postproc) (cons 'progn postproc) (car postproc)))
-    (cvs-update-header args fis)
     (with-current-buffer buf
       (let ((inhibit-read-only t)) (erase-buffer))
       (message "Running cvs %s ..." cmd)
--- a/lisp/progmodes/cc-mode.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/cc-mode.el	Wed Dec 08 22:20:27 2004 +0000
@@ -998,7 +998,7 @@
 
 ;;; Autoload directives must be on the top level, so we construct an
 ;;; autoload form instead.
-;;;###autoload (autoload 'awk-mode "cc-mode" "Major mode for editing AWK code.")
+;;;###autoload (autoload 'awk-mode "cc-mode" "Major mode for editing AWK code." t)
 
 (if (not (memq 'syntax-properties c-emacs-features))
     (autoload 'awk-mode "awk-mode" "Major mode for editing AWK code."  t)
--- a/lisp/progmodes/compile.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/compile.el	Wed Dec 08 22:20:27 2004 +0000
@@ -181,15 +181,9 @@
     (epc
      "^Error [0-9]+ at (\\([0-9]+\\):\\([^)\n]+\\))" 2 1)
 
-    (ftnchek-file
-     "^File \\(.+\\.f\\):$"
-     1 nil nil 0)
-    (ftnchek-line-file
-     "\\(^Warning .* \\)?line \\([0-9]+\\)\\(?: col \\([0-9]+\\)\\)? file \\(.+\\.f\\)"
-     4 2 3 (1) nil (1 'default nil t))
-    (ftnchek-line
-     "\\(?:^\\(Warning\\) .* \\)?line \\([0-9]+\\)\\(?: col \\([0-9]+\\)\\)?"
-     nil 2 3 (1) nil (1 (compilation-face '(1)) nil t))
+    (ftnchek
+     "\\(^Warning .*\\)? line[ \n]\\([0-9]+\\)[ \n]\\(?:col \\([0-9]+\\)[ \n]\\)?file \\([^ :;\n]+\\)"
+     4 2 3 (1))
 
     (iar
      "^\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[0-9]+\\]:"
@@ -916,7 +910,7 @@
 	;; would do it again through the shell: (cd "..") AND sh -c "cd ..; make"
 	(cd (if (string-match "^\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]" command)
 		(if (match-end 1)
-		    (match-string 1 command)
+		    (substitute-env-vars (match-string 1 command))
 		  "~")
 	      default-directory))
 	(erase-buffer)
@@ -1086,14 +1080,27 @@
 
 (defvar compilation-mode-map
   (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map compilation-minor-mode-map)
+    ;; Don't inherit from compilation-minor-mode-map,
+    ;; because that introduces a menu bar item we don't want.
+    ;; That confuses C-down-mouse-3.
+    (define-key map [mouse-2] 'compile-goto-error)
+    (define-key map "\C-c\C-c" 'compile-goto-error)
+    (define-key map "\C-m" 'compile-goto-error)
+    (define-key map "\C-c\C-k" 'kill-compilation)
+    (define-key map "\M-n" 'compilation-next-error)
+    (define-key map "\M-p" 'compilation-previous-error)
+    (define-key map "\M-{" 'compilation-previous-file)
+    (define-key map "\M-}" 'compilation-next-file)
+
     (define-key map " " 'scroll-up)
     (define-key map "\^?" 'scroll-down)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
 
     ;; Set up the menu-bar
-    (define-key map [menu-bar compilation]
-      (cons "Compile" (make-sparse-keymap "Compile")))
+    (let ((submap (make-sparse-keymap "Compile")))
+      (define-key map [menu-bar compilation]
+	(cons "Compile" submap))
+      (set-keymap-parent submap compilation-menu-map))
     (define-key map [menu-bar compilation compilation-separator2]
       '("----" . nil))
     (define-key map [menu-bar compilation compilation-grep]
--- a/lisp/progmodes/cperl-mode.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/cperl-mode.el	Wed Dec 08 22:20:27 2004 +0000
@@ -4191,12 +4191,7 @@
 	(goto-char start)
 	(setq end (set-marker (make-marker) end)) ; indentation changes pos
 	(or (bolp) (beginning-of-line 2))
-	(or (fboundp 'imenu-progress-message)
-	    (message "Indenting... For feedback load `imenu'..."))
 	(while (and (<= (point) end) (not (eobp))) ; bol to check start
-	  (and (fboundp 'imenu-progress-message)
-	       (imenu-progress-message
-		pm (/ (* 100 (- (point) start)) (- end start -1))))
 	  (setq st (point))
 	  (if (or
 	       (setq empty (looking-at "[ \t]*\n"))
@@ -4232,10 +4227,7 @@
 			     (skip-chars-backward " \t")
 			     (skip-chars-backward "#")
 			     (setq new-comm-indent (current-column))))))))
-	(beginning-of-line 2))
-      	(if (fboundp 'imenu-progress-message)
-	     (imenu-progress-message pm 100)
-	  (message nil)))
+	(beginning-of-line 2)))
       ;; Now run the update hooks
       (and after-change-functions
 	   cperl-update-end
@@ -4385,17 +4377,12 @@
 	packages ends-ranges p marker
 	(prev-pos 0) char fchar index index1 name (end-range 0) package)
     (goto-char (point-min))
-    (if noninteractive
-	(message "Scanning Perl for index")
-      (imenu-progress-message prev-pos 0))
     (cperl-update-syntaxification (point-max) (point-max))
     ;; Search for the function
     (progn ;;save-match-data
       (while (re-search-forward
 	      (or regexp cperl-imenu--function-name-regexp-perl)
 	      nil t)
-	(or noninteractive
-	    (imenu-progress-message prev-pos))
 	(cond
 	 ((and				; Skip some noise if building tags
 	   (match-beginning 2)		; package or sub
@@ -4465,8 +4452,6 @@
 	  (setq index1 (cons (concat "=" name) (cdr index)))
 	  (push index index-pod-alist)
 	  (push index1 index-unsorted-alist)))))
-    (or noninteractive
-	(imenu-progress-message prev-pos 100))
     (setq index-alist
 	  (if (default-value 'imenu-sort-function)
 	      (sort index-alist (default-value 'imenu-sort-function))
@@ -5549,16 +5534,11 @@
   (let ((index-alist '())
 	(prev-pos 0) index index1 name package prefix)
     (goto-char (point-min))
-    (if noninteractive
-	(message "Scanning XSUB for index")
-      (imenu-progress-message prev-pos 0))
     ;; Search for the function
     (progn ;;save-match-data
       (while (re-search-forward
 	      "^\\([ \t]*MODULE\\>[^\n]*\\<PACKAGE[ \t]*=[ \t]*\\([a-zA-Z_][a-zA-Z_0-9:]*\\)\\>\\|\\([a-zA-Z_][a-zA-Z_0-9]*\\)(\\|[ \t]*BOOT:\\)"
 	      nil t)
-	(or noninteractive
-	    (imenu-progress-message prev-pos))
 	(cond
 	 ((match-beginning 2)		; SECTION
 	  (setq package (buffer-substring (match-beginning 2) (match-end 2)))
@@ -5586,8 +5566,6 @@
 	  (setq index (imenu-example--name-and-position))
 	  (setcar index (concat package "::BOOT:"))
 	  (push index index-alist)))))
-    (or noninteractive
-	(imenu-progress-message prev-pos 100))
     index-alist))
 
 (defvar cperl-unreadable-ok nil)
--- a/lisp/progmodes/f90.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/f90.el	Wed Dec 08 22:20:27 2004 +0000
@@ -217,9 +217,12 @@
   :group 'f90)
 
 (defcustom f90-smart-end 'blink
-  "*From an END statement, check and fill the end using matching block start.
-Allowed values are 'blink, 'no-blink, and nil, which determine
-whether to blink the matching beginning."
+  "*Qualification of END statements according to the matching block start.
+For example, the END that closes an IF block is changed to END
+IF.  If the block has a label, this is added as well.  Allowed
+values are 'blink, 'no-blink, and nil.  If nil, nothing is done.
+The other two settings have the same effect, but 'blink
+additionally blinks the cursor to the start of the block."
   :type  '(choice (const blink) (const no-blink) (const nil))
   :group 'f90)
 
@@ -428,6 +431,9 @@
     (modify-syntax-entry ?=  "."  table)
     (modify-syntax-entry ?*  "."  table)
     (modify-syntax-entry ?/  "."  table)
+    ;; I think that the f95 standard leaves the behaviour of \
+    ;; unspecified, but that f2k will require it to be non-special.
+    ;; Use `f90-backslash-not-special' to change.
     (modify-syntax-entry ?\\ "\\" table) ; escape chars
     table)
   "Syntax table used in F90 mode.")
@@ -967,6 +973,7 @@
 
 (defsubst f90-looking-at-program-block-start ()
   "Return (KIND NAME) if a program block with name NAME starts after point."
+;;;NAME is nil for an un-named main PROGRAM block."
   (cond
    ((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>")
     (list (match-string 1) (match-string 2)))
@@ -977,6 +984,13 @@
 	 (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[ \t]+\
 \\(\\sw+\\)"))
     (list (match-string 1) (match-string 2)))))
+;; Following will match an un-named main program block; however
+;; one needs to check if there is an actual PROGRAM statement after
+;; point (and before any END program). Adding this will require
+;; change to eg f90-calculate-indent.
+;;;   ((save-excursion
+;;;     (not (f90-previous-statement)))
+;;;    '("program" nil))))
 
 (defsubst f90-looking-at-program-block-end ()
   "Return (KIND NAME) if a block with name NAME ends after point."
@@ -1104,7 +1118,13 @@
   (let (icol cont (case-fold-search t) (pnt (point)))
     (save-excursion
       (if (not (f90-previous-statement))
-	  (setq icol 0)
+          ;; First statement in buffer.
+	  (setq icol (if (save-excursion
+                           (f90-next-statement)
+                           (f90-looking-at-program-block-start))
+                         0
+                       ;; No explicit PROGRAM start statement.
+                       f90-program-indent))
 	(setq cont (f90-present-statement-cont))
 	(if (eq cont 'end)
 	    (while (not (eq 'begin (f90-present-statement-cont)))
@@ -1151,8 +1171,10 @@
 
 (defun f90-previous-statement ()
   "Move point to beginning of the previous F90 statement.
-Return nil if no previous statement is found.
-A statement is a line which is neither blank nor a comment."
+If no previous statement is found (i.e. if called from the first
+statement in the buffer), move to the start of the buffer and
+return nil.  A statement is a line which is neither blank nor a
+comment."
   (interactive)
   (let (not-first-statement)
     (beginning-of-line)
@@ -1189,6 +1211,8 @@
     (beginning-of-line)
     (if (zerop count)
 	matching-beg
+      ;; Note this includes the case of an un-named main program,
+      ;; in which case we go to (point-min).
       (message "No beginning found.")
       nil)))
 
@@ -1221,18 +1245,17 @@
 (defun f90-end-of-block (&optional num)
   "Move point forward to the end of the current code block.
 With optional argument NUM, go forward that many balanced blocks.
-If NUM is negative, go backward to the start of a block.
-Checks for consistency of block types and labels (if present),
-and completes outermost block if necessary.
-Some of these things (which?) are not done if NUM is nil,
-which only happens in a noninteractive call."
+If NUM is negative, go backward to the start of a block.  Checks
+for consistency of block types and labels (if present), and
+completes outermost block if `f90-smart-end' is non-nil.
+Interactively, pushes mark before moving point."
   (interactive "p")
-  (if (and num (< num 0)) (f90-beginning-of-block (- num)))
-  (let ((f90-smart-end nil)             ; for the final `f90-match-end'
+  (if (interactive-p) (push-mark (point) t)) ; can move some distance
+  (and num (< num 0) (f90-beginning-of-block (- num)))
+  (let ((f90-smart-end (if f90-smart-end 'no-blink)) ; for final match-end
         (case-fold-search t)
         (count (or num 1))
         start-list start-this start-type start-label end-type end-label)
-    (if num (push-mark (point) t))
     (end-of-line)                       ; probably want this
     (while (and (> count 0) (re-search-forward f90-blocks-re nil 'move))
       (beginning-of-line)
@@ -1268,20 +1291,21 @@
       (end-of-line))
     (if (> count 0) (error "Missing block end"))
     ;; Check outermost block.
-    (if num
-        (save-excursion
-          (beginning-of-line)
-          (skip-chars-forward " \t0-9")
-          (f90-match-end)))))
+    (when f90-smart-end
+      (save-excursion
+        (beginning-of-line)
+        (skip-chars-forward " \t0-9")
+        (f90-match-end)))))
 
 (defun f90-beginning-of-block (&optional num)
   "Move point backwards to the start of the current code block.
 With optional argument NUM, go backward that many balanced blocks.
 If NUM is negative, go forward to the end of a block.
 Checks for consistency of block types and labels (if present).
-Does not check the outermost block, because it may be incomplete."
+Does not check the outermost block, because it may be incomplete.
+Interactively, pushes mark before moving point."
   (interactive "p")
-  (if (and num (< num 0)) (f90-end-of-block (- num)))
+  (and num (< num 0) (f90-end-of-block (- num)))
   (let ((case-fold-search t)
         (count (or num 1))
         end-list end-this end-type end-label
@@ -1320,7 +1344,8 @@
                (or (f90-equal-symbols start-label end-label)
                    (error "Start label `%s' does not match end label `%s'"
                           start-label end-label))))))
-     (if (> count 0) (error "Missing block start"))))
+    ;; Includes an un-named main program block.
+    (if (> count 0) (error "Missing block start"))))
 
 (defun f90-next-block (&optional num)
   "Move point forward to the next end or start of a code block.
@@ -1439,6 +1464,8 @@
   (f90-indent-line 'no-update))         ; nothing to update
 
 
+;; TODO not add spaces to empty lines at the start.
+;; Why is second line getting extra indent over first?
 (defun f90-indent-region (beg-region end-region)
   "Indent every line in region by forward parsing."
   (interactive "*r")
@@ -1663,9 +1690,13 @@
 END-BLOCK is the type of block as indicated at the end (may be nil).
 END-NAME is the block end name (may be nil).
 Leave point at the end of line."
+  ;; Hack to deal with the case when this is called from
+  ;; f90-indent-region on a program block without an explicit PROGRAM
+  ;; statement at the start. Should really be an error (?).
+  (or beg-block (setq beg-block "program"))
   (search-forward "end" (line-end-position))
   (catch 'no-match
-    (if (f90-equal-symbols beg-block end-block)
+    (if (and end-block (f90-equal-symbols beg-block end-block))
         (search-forward end-block)
       (if end-block
           (progn
@@ -1703,7 +1734,9 @@
             end-name  (car (cdr end-struct)))
       (save-excursion
         (beginning-of-line)
-        (while (and (> count 0) (re-search-backward f90-blocks-re nil t))
+        (while (and (> count 0)
+                    (not (= (line-beginning-position) (point-min))))
+          (re-search-backward f90-blocks-re nil 'move)
           (beginning-of-line)
           ;; GM not a line number if continued line.
 ;;;          (skip-chars-forward " \t")
@@ -1717,7 +1750,12 @@
                         (f90-looking-at-where-or-forall)
                         (f90-looking-at-select-case)
                         (f90-looking-at-type-like)
-                        (f90-looking-at-program-block-start)))
+                        (f90-looking-at-program-block-start)
+                        ;; Interpret a single END without a block
+                        ;; start to be the END of a program block
+                        ;; without an initial PROGRAM line.
+                        (if (= (line-beginning-position) (point-min))
+                            '("program" nil))))
                  (setq count (1- count)))
                 ((looking-at (concat "end[ \t]*" f90-blocks-re))
                  (setq count (1+ count)))))
@@ -1850,6 +1888,19 @@
   (save-excursion
     (nth 1 (f90-beginning-of-subprogram))))
 
+
+(defun f90-backslash-not-special (&optional all)
+  "Make the backslash character (\\) be non-special in the current buffer.
+With optional argument ALL, change the default for all present
+and future F90 buffers.  F90 mode normally treats backslash as an
+escape character."
+  (or (eq major-mode 'f90-mode)
+      (error "This function should only be used in F90 buffers"))
+  (when (equal (char-syntax ?\\ ) ?\\ )
+    (or all (set-syntax-table (copy-syntax-table (syntax-table))))
+    (modify-syntax-entry ?\\ ".")))
+
+
 (provide 'f90)
 
 ;;; arch-tag: fceac97c-c147-44bd-aec0-172d4b560ef8
--- a/lisp/progmodes/flymake.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/flymake.el	Wed Dec 08 22:20:27 2004 +0000
@@ -32,2501 +32,1983 @@
 
 ;;; Code:
 
-;;;_* Provide
-(provide 'flymake)
-
-;;;; [[ Overlay compatibility
+;;;; [[ Xemacs overlay compatibility
+(if (featurep 'xemacs) (progn
 (autoload 'make-overlay            "overlay" "Overlay compatibility kit." t)
 (autoload 'overlayp                "overlay" "Overlay compatibility kit." t)
 (autoload 'overlays-in             "overlay" "Overlay compatibility kit." t)
 (autoload 'delete-overlay          "overlay" "Overlay compatibility kit." t)
 (autoload 'overlay-put             "overlay" "Overlay compatibility kit." t)
 (autoload 'overlay-get             "overlay" "Overlay compatibility kit." t)
+))
 ;;;; ]]
 
 ;;;; [[ cross-emacs compatibility routines
-(defvar flymake-emacs
-    (cond
-	((string-match "XEmacs" emacs-version)  'xemacs)
-	(t                                      'emacs)
-	)
-    "Currently used emacs flavor"
-)
+(defsubst flymake-makehash (&optional test)
+  (if (fboundp 'make-hash-table)
+      (if test (make-hash-table :test test) (make-hash-table))
+    (makehash test)))
 
-(defun flymake-makehash(&optional test)
-    (cond
-	((equal flymake-emacs 'xemacs)  (if test (make-hash-table :test test) (make-hash-table)))
-	(t                              (makehash test))	
-    )
-)
+(defun flymake-float-time ()
+  (if (featurep 'xemacs)
+      (let ((tm (current-time)))
+	(multiple-value-bind (s0 s1 s2) (current-time)
+			     (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2))))
+    (float-time)))
 
-(defun flymake-time-to-float(&optional tm)
-	"Convert `current-time` to a float number of seconds."
-	(multiple-value-bind (s0 s1 s2) (or tm (current-time))
-	  (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2)))
-)
-(defun flymake-float-time()
-    (cond
-	((equal flymake-emacs 'xemacs)  (flymake-time-to-float (current-time)))
-	(t                              (float-time))
-    )
-)
+(defsubst flymake-replace-regexp-in-string (regexp rep str)
+  (if (featurep 'xemacs)
+      (replace-in-string str regexp rep)
+    (replace-regexp-in-string regexp rep str)))
 
-(defun flymake-replace-regexp-in-string(regexp rep str)
-    (cond
-	((equal flymake-emacs 'xemacs)  (replace-in-string str regexp rep))
-	(t                              (replace-regexp-in-string regexp rep str))
-	)
-)
+(defun flymake-split-string (str pattern)
+  "Split, then remove first and/or last in case it's empty."
+  (let* ((splitted (split-string str pattern)))
+    (if (and (> (length splitted) 0) (= 0 (length (elt splitted 0))))
+	(setq splitted (cdr splitted)))
+    (if (and (> (length splitted) 0) (= 0 (length (elt splitted (1- (length splitted))))))
+	(setq splitted (reverse (cdr (reverse splitted)))))
+    splitted))
 
-(defun flymake-split-string-remove-empty-edges(str pattern)
-    "split, then remove first and/or last in case it's empty"
-	(let* ((splitted (split-string str pattern)))
-	    (if (and (> (length splitted) 0) (= 0 (length (elt splitted 0))))
-			(setq splitted (cdr splitted))
-		)
-	    (if (and (> (length splitted) 0) (= 0 (length (elt splitted (1- (length splitted))))))
-			(setq splitted (reverse (cdr (reverse splitted))))
-		)
-		splitted
-    )
-)
-(defun flymake-split-string(str pattern)
-    (cond
-	((equal flymake-emacs 'xemacs)  (flymake-split-string-remove-empty-edges str pattern))
-	(t                              (flymake-split-string-remove-empty-edges str pattern))
-    )
-)
+(defsubst flymake-get-temp-dir ()
+  (if (featurep 'xemacs)
+      (temp-directory)
+    temporary-file-directory))
 
-(defun flymake-get-temp-dir()
-    (cond
-	((equal flymake-emacs 'xemacs)  (temp-directory))
-	(t                              temporary-file-directory)
-    )
-)
+(defun flymake-line-beginning-position ()
+  (save-excursion
+    (beginning-of-line)
+    (point)))
 
-(defun flymake-line-beginning-position()
-    (save-excursion
-	(beginning-of-line)
-	(point)
-    )
-)
+(defun flymake-line-end-position ()
+  (save-excursion
+    (end-of-line)
+    (point)))
 
-(defun flymake-line-end-position()
-    (save-excursion
-	(end-of-line)
-	(point)
-    )
-)
+(defun flymake-popup-menu (pos menu-data)
+  (if (featurep 'xemacs)
+      (let* ((x-pos       (nth 0 (nth 0 pos)))
+	     (y-pos       (nth 1 (nth 0 pos)))
+	     (fake-event-props  '(button 1 x 1 y 1)))
+	(setq fake-event-props (plist-put fake-event-props 'x x-pos))
+	(setq fake-event-props (plist-put fake-event-props 'y y-pos))
+	(popup-menu (flymake-make-xemacs-menu menu-data) (make-event 'button-press fake-event-props)))
+    (x-popup-menu pos (flymake-make-emacs-menu menu-data))))
 
-(defun flymake-popup-menu(pos menu-data)
-    (cond
-       ((equal flymake-emacs 'xemacs)
-	    (let* ((x-pos       (nth 0 (nth 0 pos)))
-		   (y-pos       (nth 1 (nth 0 pos)))
-		   (fake-event-props  '(button 1 x 1 y 1)))
-		(setq fake-event-props (plist-put fake-event-props 'x x-pos))
-		(setq fake-event-props (plist-put fake-event-props 'y y-pos))
-		(popup-menu (flymake-make-xemacs-menu menu-data) (make-event 'button-press fake-event-props))
-	    )
-       )
-       (t                              (x-popup-menu pos (flymake-make-emacs-menu menu-data)))
-    )
-)
+(defun flymake-make-emacs-menu (menu-data)
+  (let* ((menu-title     (nth 0 menu-data))
+	 (menu-items     (nth 1 menu-data))
+	 (menu-commands  nil))
+    (setq menu-commands (mapcar (lambda (foo)
+				  (cons (nth 0 foo) (nth 1 foo)))
+				menu-items))
+    (list menu-title (cons "" menu-commands))))
 
-(defun flymake-make-emacs-menu(menu-data)
-    (let* ((menu-title     (nth 0 menu-data))
-		   (menu-items     (nth 1 menu-data))
-		   (menu-commands  nil))
+(defun flymake-nop ())
 
-	(setq menu-commands (mapcar (lambda (foo)
-				      (cons (nth 0 foo) (nth 1 foo)))
-				    menu-items))
-		(list menu-title (cons "" menu-commands))
-    )
-)
-
-(defun flymake-nop()
-)
+(if (featurep 'xemacs) (progn
 
-(defun flymake-make-xemacs-menu(menu-data)
-    (let* ((menu-title     (nth 0 menu-data))
-	   (menu-items     (nth 1 menu-data))
-	   (menu-commands  nil))
-	(setq menu-commands (mapcar (lambda (foo)
-				      (vector (nth 0 foo) (or (nth 1 foo) '(flymake-nop)) t))
-				    menu-items))
-	(cons menu-title menu-commands)
-    )
-)
+(defun flymake-make-xemacs-menu (menu-data)
+  (let* ((menu-title     (nth 0 menu-data))
+	 (menu-items     (nth 1 menu-data))
+	 (menu-commands  nil))
+    (setq menu-commands (mapcar (lambda (foo)
+				  (vector (nth 0 foo) (or (nth 1 foo) '(flymake-nop)) t))
+				menu-items))
+    (cons menu-title menu-commands)))
 
-(defun flymake-xemacs-window-edges(&optional window)
-    (let ((edges  (window-pixel-edges window))
-	  tmp)
-	(setq tmp edges)
-	(setcar tmp (/ (car tmp) (face-width 'default)))
-	(setq tmp (cdr tmp))
-	(setcar tmp (/ (car tmp) (face-height 'default)))
-	(setq tmp (cdr tmp))
-	(setcar tmp (/ (car tmp) (face-width 'default)))
-	(setq tmp (cdr tmp))
-	(setcar tmp (/ (car tmp) (face-height 'default)))
-	edges
-    )
-)
+(defun flymake-xemacs-window-edges (&optional window)
+  (let ((edges  (window-pixel-edges window))
+	tmp)
+    (setq tmp edges)
+    (setcar tmp (/ (car tmp) (face-width 'default)))
+    (setq tmp (cdr tmp))
+    (setcar tmp (/ (car tmp) (face-height 'default)))
+    (setq tmp (cdr tmp))
+    (setcar tmp (/ (car tmp) (face-width 'default)))
+    (setq tmp (cdr tmp))
+    (setcar tmp (/ (car tmp) (face-height 'default)))
+    edges))
 
-(defun flymake-current-row()
-    "return current row in current frame"
-    (cond
-       ((equal flymake-emacs 'xemacs)  (count-lines (window-start) (point)))
-       (t                              (+ (car (cdr (window-edges))) (count-lines (window-start) (point))))
-    )
-)
+)) ;; xemacs
 
-(defun flymake-selected-frame()
-    (cond
-       ((equal flymake-emacs 'xemacs)  (selected-window))
-       (t                              (selected-frame))
-    )
-)
+(defun flymake-current-row ()
+  "Return current row number in current frame."
+  (if (featurep 'xemacs)
+      (count-lines (window-start) (point))
+    (+ (car (cdr (window-edges))) (count-lines (window-start) (point)))))
+
+(defun flymake-selected-frame ()
+  (if (featurep 'xemacs)
+      (selected-window)
+    (selected-frame)))
 
 ;;;; ]]
 
 (defcustom flymake-log-level -1
-    "Logging level, only messages with level > flymake-log-level will not be logged
+  "Logging level, only messages with level > flymake-log-level will not be logged
 -1 = NONE, 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG"
-    :group 'flymake
-    :type 'integer
-)
-
-(defun flymake-log(level text &rest args)
-    "Log a message with optional arguments"
-    (if (<= level flymake-log-level)
-	(let* ((msg (apply 'format text args)))
-	    (message msg)
-	    ;(with-temp-buffer
-	    ;    (insert msg)
-	    ;   (insert "\n")
-	    ;   (flymake-save-buffer-in-file (current-buffer) "d:/flymake.log" t)  ; make log file name customizable
-	    ;)
-	)
-    )
-)
+  :group 'flymake
+  :type 'integer)
 
-(defun flymake-ins-after(list pos val)
-    "insert val into list after position pos"
-    (let ((tmp (copy-sequence list))) ; (???)
-	(setcdr (nthcdr pos tmp) (cons val (nthcdr (1+ pos) tmp)))
-	tmp
-    )
-)
+(defun flymake-log (level text &rest args)
+  "Log a message with optional arguments."
+  (if (<= level flymake-log-level)
+      (let* ((msg (apply 'format text args)))
+	(message msg)
+	;;(with-temp-buffer
+	;;    (insert msg)
+	;;   (insert "\n")
+	;;   (flymake-save-buffer-in-file (current-buffer) "d:/flymake.log" t)  ; make log file name customizable
+	;;)
+	)))
 
-(defun flymake-set-at(list pos val)
-    "set val at position pos in list"
-    (let ((tmp (copy-sequence list))) ; (???)
-	(setcar (nthcdr pos tmp) val)
-	tmp
-    )
-)
+(defun flymake-ins-after (list pos val)
+  "Insert VAL into LIST after position POS."
+  (let ((tmp (copy-sequence list)))	; (???)
+    (setcdr (nthcdr pos tmp) (cons val (nthcdr (1+ pos) tmp)))
+    tmp))
 
-(defvar flymake-pid-to-names(flymake-makehash)
-    "pid -> source buffer name, output file name mapping"
-)
+(defun flymake-set-at (list pos val)
+  "Set VAL at position POS in LIST"
+  (let ((tmp (copy-sequence list)))	; (???)
+    (setcar (nthcdr pos tmp) val)
+    tmp))
+
+(defvar flymake-pid-to-names (flymake-makehash)
+  "pid -> source buffer name, output file name mapping.")
 
-(defun flymake-reg-names(pid source-buffer-name)
-    "Save into in pid map"
-    (unless (stringp source-buffer-name)
-	(error "invalid buffer name")
-    )
-    (puthash pid (list source-buffer-name) flymake-pid-to-names)
-)
+(defun flymake-reg-names (pid source-buffer-name)
+  "Save into in PID map."
+  (unless (stringp source-buffer-name)
+    (error "Invalid buffer name"))
+  (puthash pid (list source-buffer-name) flymake-pid-to-names))
 
-(defun flymake-get-source-buffer-name(pid)
-    "Return buffer name stored in pid map"
-    (nth 0 (gethash pid flymake-pid-to-names))
-)
+(defun flymake-get-source-buffer-name (pid)
+  "Return buffer name stored in PID map."
+  (nth 0 (gethash pid flymake-pid-to-names)))
 
-(defun flymake-unreg-names(pid)
-    "Delete pid->buffer name mapping"
-    (remhash pid flymake-pid-to-names)
-)
+(defun flymake-unreg-names (pid)
+  "Delete PID->buffer name mapping."
+  (remhash pid flymake-pid-to-names))
 
-(defun flymake-get-buffer-var(buffer var-name)
-    "switch to buffer if necessary and return local variable var"
-    (unless (bufferp buffer)
-	(error "invalid buffer")
-    )
+(defun flymake-get-buffer-var (buffer var-name)
+  "Switch to BUFFER if necessary and return local variable VAR-NAME."
+  (unless (bufferp buffer)
+    (error "Invalid buffer"))
 
-    (if (eq buffer (current-buffer))
-	(symbol-value var-name)
-    ;else
-	(save-excursion
-	    (set-buffer buffer)
-	    (symbol-value var-name)
-	)
-    )
-)
+  (if (eq buffer (current-buffer))
+      (symbol-value var-name)
+    (save-excursion
+      (set-buffer buffer)
+      (symbol-value var-name))))
 
-(defun flymake-set-buffer-var(buffer var-name var-value)
-    "switch to buffer if necessary and set local variable var-name to var-value"
-    (unless (bufferp buffer)
-	(error "invalid buffer")
-    )
+(defun flymake-set-buffer-var (buffer var-name var-value)
+  "Switch to BUFFER if necessary and set local variable VAR-NAME to VAR-VALUE."
+  (unless (bufferp buffer)
+    (error "Invalid buffer"))
 
-    (if (eq buffer (current-buffer))
-	(set var-name var-value)
-    ;else
-	(save-excursion
-	    (set-buffer buffer)
-	    (set var-name var-value)
-	)
-    )
-)
+  (if (eq buffer (current-buffer))
+      (set var-name var-value)
+    (save-excursion
+      (set-buffer buffer)
+      (set var-name var-value))))
 
-(defvar flymake-buffer-data(flymake-makehash)
-    "data specific to syntax check tool, in name-value pairs"
-)
+(defvar flymake-buffer-data (flymake-makehash)
+  "Data specific to syntax check tool, in name-value pairs.")
+
 (make-variable-buffer-local 'flymake-buffer-data)
-(defun flymake-get-buffer-data(buffer)
-    (flymake-get-buffer-var buffer 'flymake-buffer-data)
-)
-(defun flymake-set-buffer-data(buffer data)
-    (flymake-set-buffer-var buffer 'flymake-buffer-data data)
-)
-(defun flymake-get-buffer-value(buffer name)
-    (gethash name (flymake-get-buffer-data buffer))
-)
-(defun flymake-set-buffer-value(buffer name value)
-    (puthash name value (flymake-get-buffer-data buffer))
-)
+
+(defun flymake-get-buffer-data (buffer)
+  (flymake-get-buffer-var buffer 'flymake-buffer-data))
+
+(defun flymake-set-buffer-data (buffer data)
+  (flymake-set-buffer-var buffer 'flymake-buffer-data data))
+
+(defun flymake-get-buffer-value (buffer name)
+  (gethash name (flymake-get-buffer-data buffer)))
 
-(defvar flymake-output-residual nil
-  ""
-)
+(defun flymake-set-buffer-value (buffer name value)
+  (puthash name value (flymake-get-buffer-data buffer)))
+
+(defvar flymake-output-residual nil "")
+
 (make-variable-buffer-local 'flymake-output-residual)
-(defun flymake-get-buffer-output-residual(buffer)
-    (flymake-get-buffer-var buffer 'flymake-output-residual)
-)
-(defun flymake-set-buffer-output-residual(buffer residual)
-    (flymake-set-buffer-var buffer 'flymake-output-residual residual)
-)
+
+(defun flymake-get-buffer-output-residual (buffer)
+  (flymake-get-buffer-var buffer 'flymake-output-residual))
+
+(defun flymake-set-buffer-output-residual (buffer residual)
+  (flymake-set-buffer-var buffer 'flymake-output-residual residual))
 
-(defcustom flymake-allowed-file-name-masks '((".+\\.c$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
-					     (".+\\.cpp$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
-					     (".+\\.xml$" flymake-xml-init flymake-simple-cleanup flymake-get-real-file-name)
-					     (".+\\.html?$" flymake-xml-init flymake-simple-cleanup flymake-get-real-file-name)
-					     (".+\\.cs$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
-					     (".+\\.pl$" flymake-perl-init flymake-simple-cleanup flymake-get-real-file-name)
-					     (".+\\.h$" flymake-master-make-header-init flymake-master-cleanup flymake-get-real-file-name)
-					     (".+\\.java$" flymake-simple-make-java-init flymake-simple-java-cleanup flymake-get-real-file-name)
-					     (".+[0-9]+\\.tex$" flymake-master-tex-init flymake-master-cleanup flymake-get-real-file-name)
-					     (".+\\.tex$" flymake-simple-tex-init flymake-simple-cleanup flymake-get-real-file-name)
-					     (".+\\.idl$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
-;                                            (".+\\.cpp$" 1)
-;                                            (".+\\.java$" 3)
-;                                            (".+\\.h$" 2 (".+\\.cpp$" ".+\\.c$")
-;                                                ("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2))
-;                                            (".+\\.idl$" 1)
-;                                            (".+\\.odl$" 1)
-;                                            (".+[0-9]+\\.tex$" 2 (".+\\.tex$")
-;                                                ("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2 ))
-;                                            (".+\\.tex$" 1)
-					     )
-    "*Files syntax checking is allowed for"
-    :group 'flymake
-    :type '(repeat (string symbol symbol symbol))
-)
-
-(defun flymake-get-file-name-mode-and-masks(file-name)
-    "return the corresponding entry from flymake-allowed-file-name-masks"
-    (unless (stringp file-name)
-	(error "invalid file-name")
+(defcustom flymake-allowed-file-name-masks
+  '((".+\\.c$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
+    (".+\\.cpp$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
+    (".+\\.xml$" flymake-xml-init flymake-simple-cleanup flymake-get-real-file-name)
+    (".+\\.html?$" flymake-xml-init flymake-simple-cleanup flymake-get-real-file-name)
+    (".+\\.cs$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
+    (".+\\.pl$" flymake-perl-init flymake-simple-cleanup flymake-get-real-file-name)
+    (".+\\.h$" flymake-master-make-header-init flymake-master-cleanup flymake-get-real-file-name)
+    (".+\\.java$" flymake-simple-make-java-init flymake-simple-java-cleanup flymake-get-real-file-name)
+    (".+[0-9]+\\.tex$" flymake-master-tex-init flymake-master-cleanup flymake-get-real-file-name)
+    (".+\\.tex$" flymake-simple-tex-init flymake-simple-cleanup flymake-get-real-file-name)
+    (".+\\.idl$" flymake-simple-make-init flymake-simple-cleanup flymake-get-real-file-name)
+					;                                            (".+\\.cpp$" 1)
+					;                                            (".+\\.java$" 3)
+					;                                            (".+\\.h$" 2 (".+\\.cpp$" ".+\\.c$")
+					;                                                ("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2))
+					;                                            (".+\\.idl$" 1)
+					;                                            (".+\\.odl$" 1)
+					;                                            (".+[0-9]+\\.tex$" 2 (".+\\.tex$")
+					;                                                ("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2 ))
+					;                                            (".+\\.tex$" 1)
     )
-    (let ((count           (length flymake-allowed-file-name-masks))
-	  (idx             0)
-	  (mode-and-masks  nil))
-	(while (and (not mode-and-masks) (< idx count))
-	    (if (string-match (nth 0 (nth idx flymake-allowed-file-name-masks)) file-name)
-		(setq mode-and-masks (cdr (nth idx flymake-allowed-file-name-masks)))
-	    )
-	    (setq idx (1+ idx))
-	)
-	(flymake-log 3 "file %s, init=%s" file-name (car mode-and-masks))
-	mode-and-masks
-    )
-)
+  "*Files syntax checking is allowed for."
+  :group 'flymake
+  :type '(repeat (string symbol symbol symbol)))
+
+(defun flymake-get-file-name-mode-and-masks (file-name)
+  "Return the corresponding entry from 'flymake-allowed-file-name-masks'."
+  (unless (stringp file-name)
+    (error "Invalid file-name"))
+  (let ((count           (length flymake-allowed-file-name-masks))
+	(idx             0)
+	(mode-and-masks  nil))
+    (while (and (not mode-and-masks) (< idx count))
+      (if (string-match (nth 0 (nth idx flymake-allowed-file-name-masks)) file-name)
+	  (setq mode-and-masks (cdr (nth idx flymake-allowed-file-name-masks))))
+      (setq idx (1+ idx)))
+    (flymake-log 3 "file %s, init=%s" file-name (car mode-and-masks))
+    mode-and-masks))
 
-(defun flymake-can-syntax-check-file(file-name)
-    "Determine whether we can syntax check file-name: nil if cannot, non-nil if can"
-    (if (flymake-get-init-function file-name)
-	t
-    ;else
-	nil
-    )
-)
+(defun flymake-can-syntax-check-file (file-name)
+  "Determine whether we can syntax check FILE-NAME.
+Return nil if we cannot, non-nil if we can."
+  (if (flymake-get-init-function file-name) t nil))
 
-(defun flymake-get-init-function(file-name)
-    "return init function to be used for the file"
-    (let* ((init-f  (nth 0 (flymake-get-file-name-mode-and-masks file-name))))
-	;(flymake-log 0 "calling %s" init-f)
-	;(funcall init-f (current-buffer))
-	  init-f
-    )
-)
+(defun flymake-get-init-function (file-name)
+  "Return init function to be used for the file."
+  (let* ((init-f  (nth 0 (flymake-get-file-name-mode-and-masks file-name))))
+					;(flymake-log 0 "calling %s" init-f)
+					;(funcall init-f (current-buffer))
+    init-f))
 
-(defun flymake-get-cleanup-function(file-name)
-    "return cleanup function to be used for the file"
-    (nth 1 (flymake-get-file-name-mode-and-masks file-name))
-)
+(defun flymake-get-cleanup-function (file-name)
+  "Return cleanup function to be used for the file."
+  (nth 1 (flymake-get-file-name-mode-and-masks file-name)))
 
-(defun flymake-get-real-file-name-function(file-name)
-    ""
-    (or (nth 2 (flymake-get-file-name-mode-and-masks file-name)) 'flymake-get-real-file-name)
-)
+(defun flymake-get-real-file-name-function (file-name)
+  (or (nth 2 (flymake-get-file-name-mode-and-masks file-name)) 'flymake-get-real-file-name))
 
 (defcustom flymake-buildfile-dirs '("." ".." "../.." "../../.." "../../../.." "../../../../.." "../../../../../.." "../../../../../../.." "../../../../../../../.." "../../../../../../../../.." "../../../../../../../../../.." "../../../../../../../../../../..")
-    "dirs to look for buildfile"
-    :group 'flymake
-    :type '(repeat (string))
-)
+  "Dirs to look for buildfile."
+  :group 'flymake
+  :type '(repeat (string)))
 
 (defvar flymake-find-buildfile-cache (flymake-makehash 'equal))
-(defun flymake-get-buildfile-from-cache(dir-name)
-    (gethash dir-name flymake-find-buildfile-cache)
-)
-(defun flymake-add-buildfile-to-cache(dir-name buildfile)
-    (puthash dir-name buildfile flymake-find-buildfile-cache)
-)
-(defun flymake-clear-buildfile-cache()
-    (clrhash flymake-find-buildfile-cache)
-)
+
+(defun flymake-get-buildfile-from-cache (dir-name)
+  (gethash dir-name flymake-find-buildfile-cache))
 
-(defun flymake-find-buildfile(buildfile-name source-dir-name dirs)
-    "find buildfile (i.e. Makefile, build.xml, etc.) starting from current directory. Return its path or nil if not found"
-    (if (flymake-get-buildfile-from-cache source-dir-name)
-	(progn
-	    (flymake-get-buildfile-from-cache source-dir-name)
-	)
-    ;else
-	(let* ((buildfile-dir          nil)
-	       (buildfile              nil)
-	       (dir-count              (length dirs))
-	       (dir-idx                0)
-	       (found                  nil))
+(defun flymake-add-buildfile-to-cache (dir-name buildfile)
+  (puthash dir-name buildfile flymake-find-buildfile-cache))
 
-	    (while (and (not found) (< dir-idx dir-count))
-
-		(setq buildfile-dir (concat source-dir-name (nth dir-idx dirs)))
-		(setq buildfile (concat buildfile-dir "/" buildfile-name))
-
-		(when (file-exists-p buildfile)
-		    (setq found t)
-		)
+(defun flymake-clear-buildfile-cache ()
+  (clrhash flymake-find-buildfile-cache))
 
-		(setq dir-idx (1+ dir-idx))
-	    )
-	    (if found
-		(progn
-		    (flymake-log 3 "found buildfile at %s/%s" buildfile-dir buildfile-name)
-		    (flymake-add-buildfile-to-cache source-dir-name buildfile-dir)
-		    buildfile-dir
-		)
-	    ;else
-		(progn
-		    (flymake-log 3 "buildfile for %s not found" source-dir-name)
-		    nil
-		)
-	    )
-	)
-    )
-)
+(defun flymake-find-buildfile (buildfile-name source-dir-name dirs)
+  "Find buildfile starting from current directory.
+Buildfile includes Makefile, build.xml etc.
+Return its file name if found, or nil if not found."
+  (if (flymake-get-buildfile-from-cache source-dir-name)
+      (progn
+	(flymake-get-buildfile-from-cache source-dir-name))
+    (let* ((buildfile-dir          nil)
+	   (buildfile              nil)
+	   (dir-count              (length dirs))
+	   (dir-idx                0)
+	   (found                  nil))
+      (while (and (not found) (< dir-idx dir-count))
+	(setq buildfile-dir (concat source-dir-name (nth dir-idx dirs)))
+	(setq buildfile (concat buildfile-dir "/" buildfile-name))
+	(when (file-exists-p buildfile)
+	  (setq found t))
+	(setq dir-idx (1+ dir-idx)))
+      (if found
+	  (progn
+	    (flymake-log 3 "found buildfile at %s/%s" buildfile-dir buildfile-name)
+	    (flymake-add-buildfile-to-cache source-dir-name buildfile-dir)
+	    buildfile-dir)
+	(progn
+	  (flymake-log 3 "buildfile for %s not found" source-dir-name)
+	  nil)))))
 
-(defun flymake-fix-path-name(name)
-    "replace all occurences of '\' with '/'"
-    (when name
-	(let* ((new-name (flymake-replace-regexp-in-string "[\\]" "/" (expand-file-name name)))
-	       (last-char (elt new-name (1- (length new-name)))))
-	    (setq new-name (flymake-replace-regexp-in-string "\\./" "" new-name))
-	    (if (equal "/" (char-to-string last-char))
-		(setq new-name (substring new-name 0 (1- (length new-name))))
-	    )
-	    new-name
-	)
-    )
-)
+(defun flymake-fix-file-name (name)
+  "Replace all occurences of '\' with '/'."
+  (when name
+    (let* ((new-name (flymake-replace-regexp-in-string "[\\]" "/" (expand-file-name name)))
+	   (last-char (elt new-name (1- (length new-name)))))
+      (setq new-name (flymake-replace-regexp-in-string "\\./" "" new-name))
+      (if (equal "/" (char-to-string last-char))
+	  (setq new-name (substring new-name 0 (1- (length new-name)))))
+      new-name)))
 
-(defun flymake-same-files(file-name-one file-name-two)
-    "t if file-name-one and file-name-two actually point to the same file"
-    (equal (flymake-fix-path-name file-name-one) (flymake-fix-path-name file-name-two))
-)
+(defun flymake-same-files (file-name-one file-name-two)
+  "Check if FILE-NAME-ONE and FILE-NAME-TWO point to same file.
+Return t if so, nil if not."
+  (equal (flymake-fix-file-name file-name-one)
+	 (flymake-fix-file-name file-name-two)))
 
-(defun flymake-ensure-ends-with-slash(path)
-    (if (not (= (elt path (1- (length path))) (string-to-char "/")))
-	(concat path "/")
-    ;else
-	path
-    )
-)
+(defun flymake-ensure-ends-with-slash (filename)
+  ;; Should this really be file-name-as-directory?
+  (if (not (= (elt filename (1- (length filename))) (string-to-char "/")))
+      (concat filename "/")
+    filename))
 
-(defun flymake-get-common-path-prefix(string-one string-two)
-    "return common prefix for two paths"
-    (when (and string-one string-two)
-	(let* ((slash-pos-one  -1)
-	       (slash-pos-two  -1)
-	       (done           nil)
-	       (prefix         nil))
-
-	    (setq string-one (flymake-ensure-ends-with-slash string-one))
-	    (setq string-two (flymake-ensure-ends-with-slash string-two))
-
-	    (while (not done)
-		(setq slash-pos-one (string-match "/" string-one (1+ slash-pos-one)))
-		(setq slash-pos-two (string-match "/" string-two (1+ slash-pos-two)))
+(defun flymake-get-common-file-prefix (string-one string-two)
+  "Return common prefix for two file names STRING-ONE and STRING-TWO."
+  (when (and string-one string-two)
+    (let* ((slash-pos-one  -1)
+	   (slash-pos-two  -1)
+	   (done           nil)
+	   (prefix         nil))
+      (setq string-one (flymake-ensure-ends-with-slash string-one))
+      (setq string-two (flymake-ensure-ends-with-slash string-two))
+      (while (not done)
+	(setq slash-pos-one (string-match "/" string-one (1+ slash-pos-one)))
+	(setq slash-pos-two (string-match "/" string-two (1+ slash-pos-two)))
+	(if (and slash-pos-one slash-pos-two
+		 (= slash-pos-one slash-pos-two)
+		 (string= (substring string-one 0 slash-pos-one) (substring string-two 0 slash-pos-two)))
+	    (progn
+	      (setq prefix (substring string-one 0 (1+ slash-pos-one))))
+	  (setq done t)))
+      prefix)))
 
-		(if (and slash-pos-one slash-pos-two
-			 (= slash-pos-one slash-pos-two)
-			 (string= (substring string-one 0 slash-pos-one) (substring string-two 0 slash-pos-two)))
-		    (progn
-			(setq prefix (substring string-one 0 (1+ slash-pos-one)))
-		    )
-		;else
-		    (setq done t)
-		)
-	    )
-	    prefix
-	)
-    )
-)
+(defun flymake-build-relative-filename (from-dir to-dir)
+  "Return rel: FROM-DIR/rel == TO-DIR."
+  (if (not (equal (elt from-dir 0) (elt to-dir 0)))
+      (error "First chars in file names %s, %s must be equal (same drive)"
+	     from-dir to-dir)
+    (let* ((from (flymake-ensure-ends-with-slash (flymake-fix-file-name from-dir)))
+	   (to   (flymake-ensure-ends-with-slash (flymake-fix-file-name to-dir)))
+	   (prefix      (flymake-get-common-file-prefix from to))
+	   (from-suffix (substring from (length prefix)))
+	   (up-count    (length (flymake-split-string from-suffix "[/]")))
+	   (to-suffix   (substring to   (length prefix)))
+	   (idx         0)
+	   (rel         nil))
+      (if (and (> (length to-suffix) 0) (equal "/" (char-to-string (elt to-suffix 0))))
+	  (setq to-suffix (substring to-suffix 1)))
 
-(defun flymake-build-relative-path(from-dir to-dir)
-    "return rel: from-dir/rel == to-dir"
-    (if (not (equal (elt from-dir 0) (elt to-dir 0)))
-	(error "first chars in paths %s, %s must be equal (same drive)" from-dir to-dir)
-    ;else
-	(let* ((from        (flymake-ensure-ends-with-slash (flymake-fix-path-name from-dir)))
-	       (to          (flymake-ensure-ends-with-slash (flymake-fix-path-name to-dir)))
-	       (prefix      (flymake-get-common-path-prefix from to))
-	       (from-suffix (substring from (length prefix)))
-	       (up-count    (length (flymake-split-string from-suffix "[/]")))
-	       (to-suffix   (substring to   (length prefix)))
-	       (idx         0)
-	       (rel         nil))
-
-		    (if (and (> (length to-suffix) 0) (equal "/" (char-to-string (elt to-suffix 0))))
-		(setq to-suffix (substring to-suffix 1))
-	    )
-
-	    (while (< idx up-count)
-		(if (> (length rel) 0)
-		    (setq rel (concat rel "/"))
-		)
-		(setq rel (concat rel ".."))
-		(setq idx (1+ idx))
-	    )
-	    (if (> (length rel) 0)
-		(setq rel (concat rel "/"))
-	    )
-	    (if (> (length to-suffix) 0)
-	       (setq rel (concat rel to-suffix))
-	    )
-
-	    (or rel "./")
-	)
-    )
-)
+      (while (< idx up-count)
+	(if (> (length rel) 0)
+	    (setq rel (concat rel "/")))
+	(setq rel (concat rel ".."))
+	(setq idx (1+ idx)))
+      (if (> (length rel) 0)
+	  (setq rel (concat rel "/")))
+      (if (> (length to-suffix) 0)
+	  (setq rel (concat rel to-suffix)))
+      (or rel "./"))))
 
 (defcustom flymake-master-file-dirs '("." "./src" "./UnitTest")
-    "dirs where to llok for master files"
-    :group 'flymake
-    :type '(repeat (string))
-)
+  "Dirs where to llok for master files."
+  :group 'flymake
+  :type '(repeat (string)))
 
 (defcustom flymake-master-file-count-limit 32
-    "max number of master files to check"
-    :group 'flymake
-    :type 'integer
-)
+  "Max number of master files to check."
+  :group 'flymake
+  :type 'integer)
 
-(defun flymake-find-possible-master-files(file-name master-file-dirs masks)
-    "find (by name and location) all posible master files, which are .cpp and .c for and .h.
-Files are searched for starting from the .h directory and max max-level parent dirs.
+;; This is bound dynamically to pass a parameter to a sort predicate below
+(defvar flymake-included-file-name)
+
+(defun flymake-find-possible-master-files (file-name master-file-dirs masks)
+  "Find (by name and location) all posible master files.
+Mater files are .cpp and .c for and .h. Files are searched for
+starting from the .h directory and max max-level parent dirs.
 File contents are not checked."
-    (let* ((dir-idx    0)
-	  (dir-count  (length master-file-dirs))
-	  (files  nil)
-	  (done   nil)
-	  (masks-count (length masks)))
-
-	(while (and (not done) (< dir-idx dir-count))
-	    (let* ((dir (concat (flymake-fix-path-name (file-name-directory file-name)) "/" (nth dir-idx master-file-dirs)))
-		   (masks-idx 0))
-		(while (and (file-exists-p dir) (not done) (< masks-idx masks-count))
-		    (let* ((mask        (nth masks-idx masks))
-			   (dir-files   (directory-files dir t mask))
-			   (file-count  (length dir-files))
-			   (file-idx    0))
+  (let* ((dir-idx    0)
+	 (dir-count  (length master-file-dirs))
+	 (files  nil)
+	 (done   nil)
+	 (masks-count (length masks)))
 
-			(flymake-log 3 "dir %s, %d file(s) for mask %s" dir file-count mask)
-			(while (and (not done) (< file-idx file-count))
-			    (when (not (file-directory-p (nth file-idx dir-files)))
-				(setq files (cons (nth file-idx dir-files) files))
-				(when (>= (length files) flymake-master-file-count-limit)
-				    (flymake-log 3 "master file count limit (%d) reached" flymake-master-file-count-limit)
-				    (setq done t)
-				)
-			    )
-			    (setq file-idx (1+ file-idx))
-			)
-		    )
-		    (setq masks-idx (1+ masks-idx))
-		)
-	    )
-	    (setq dir-idx (1+ dir-idx))
-	)
-	(when files
-	    (setq flymake-included-file-name (file-name-nondirectory file-name))
-	    (setq files (sort files 'flymake-master-file-compare))
-	    (setq flymake-included-file-name nil)
-	)
-	(flymake-log 3 "found %d possible master file(s)" (length files))
-	files
-    )
-)
+    (while (and (not done) (< dir-idx dir-count))
+      (let* ((dir (concat (flymake-fix-file-name (file-name-directory file-name)) "/" (nth dir-idx master-file-dirs)))
+	     (masks-idx 0))
+	(while (and (file-exists-p dir) (not done) (< masks-idx masks-count))
+	  (let* ((mask        (nth masks-idx masks))
+		 (dir-files   (directory-files dir t mask))
+		 (file-count  (length dir-files))
+		 (file-idx    0))
 
-(defvar flymake-included-file-name nil ; this is used to pass a parameter to a sort predicate below
-    ""
-)
+	    (flymake-log 3 "dir %s, %d file(s) for mask %s" dir file-count mask)
+	    (while (and (not done) (< file-idx file-count))
+	      (when (not (file-directory-p (nth file-idx dir-files)))
+		(setq files (cons (nth file-idx dir-files) files))
+		(when (>= (length files) flymake-master-file-count-limit)
+		  (flymake-log 3 "master file count limit (%d) reached" flymake-master-file-count-limit)
+		  (setq done t)))
+	      (setq file-idx (1+ file-idx))))
+	  (setq masks-idx (1+ masks-idx))))
+      (setq dir-idx (1+ dir-idx)))
+    (when files
+      (let ((flymake-included-file-name (file-name-nondirectory file-name)))
+	(setq files (sort files 'flymake-master-file-compare))))
+    (flymake-log 3 "found %d possible master file(s)" (length files))
+    files))
 
-(defun flymake-master-file-compare(file-one file-two)
-    "used in sort to move most possible file names to the beginning of the list (File.h -> File.cpp moved to top"
-    (and (equal (file-name-sans-extension flymake-included-file-name)
-		(file-name-sans-extension (file-name-nondirectory file-one)))
-	 (not (equal file-one file-two))
-    )
-)
+(defun flymake-master-file-compare (file-one file-two)
+  "Compare two files speccified by FILE-ONE and FILE-TWO.
+This function is used in sort to move most possible file names
+to the beginning of the list (File.h -> File.cpp moved to top."
+  (and (equal (file-name-sans-extension flymake-included-file-name)
+	      (file-name-sans-extension (file-name-nondirectory file-one)))
+       (not (equal file-one file-two))))
 
 (defcustom flymake-check-file-limit 8192
-    "max number of chars to look at when checking possible master file"
-    :group 'flymake
-    :type 'integer
-)
-
-(defun flymake-check-patch-master-file-buffer(master-file-temp-buffer
-					    master-file-name patched-master-file-name
-					    source-file-name patched-source-file-name
-					    include-dirs regexp-list)
-    "check whether master-file-name is indeed a master file for source-file-name.
-For .cpp master file this means it includes source-file-name (.h).
-If yes, patch a copy of master-file-name to include patched-source-file-name instead of source-file-name.
-Whenether a buffer for master-file-name exists, use it as a source instead of reading master file from disk"
-    (let* ((found                     nil)
-	   (regexp                    (format (nth 0 regexp-list) ; "[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\""
-					      (file-name-nondirectory source-file-name)))
-	   (path-idx                  (nth 1 regexp-list))
-	   (name-idx                  (nth 2 regexp-list))
-	   (inc-path                  nil)
-	   (inc-name                  nil)
-	   (search-limit              flymake-check-file-limit))
-	(save-excursion
-	    (unwind-protect
-		(progn
-		    (set-buffer master-file-temp-buffer)
-		    (when (> search-limit (point-max))
-			(setq search-limit (point-max))
-		    )
-		    (flymake-log 3 "checking %s against regexp %s" master-file-name regexp)
-		    (goto-char (point-min))
-		    (while (and (< (point) search-limit) (re-search-forward regexp search-limit t))
-						(let* ((match-beg   (match-beginning name-idx))
-							   (match-end   (match-end name-idx)))
+  "Max number of chars to look at when checking possible master file."
+  :group 'flymake
+  :type 'integer)
 
-							(flymake-log 3 "found possible match for %s" (file-name-nondirectory source-file-name))
-							(setq inc-path (match-string path-idx))
-							(setq inc-name (match-string name-idx))
-							(when (string= inc-name (file-name-nondirectory source-file-name))
-								(flymake-log 3 "inc-path=%s inc-name=%s" inc-path inc-name)
-								(when (flymake-check-include source-file-name inc-path inc-name include-dirs)
-									(setq found t)
-									; replace-match is not used here as it fails in xemacs with
-									; 'last match not a buffer' error as check-includes calls replace-in-string
-									(flymake-replace-region (current-buffer) match-beg match-end
-															(file-name-nondirectory patched-source-file-name))
-								)
-							)
-							(forward-line 1)
-						)
-		    )
-		    (when found
-			(flymake-save-buffer-in-file (current-buffer) patched-master-file-name)
-		    )
-		)
-		;+(flymake-log 3 "killing buffer %s" (buffer-name master-file-temp-buffer))
-		(kill-buffer master-file-temp-buffer)
-	    )
-	)
-	;+(flymake-log 3 "check-patch master file %s: %s" master-file-name found)
-	(when found
-	    (flymake-log 2 "found master file %s" master-file-name)
-	)
-	found
-    )
-)
-
-(defun flymake-replace-region(buffer beg end rep)
-    "replace text in buffer in region (beg; end) with rep"
+(defun flymake-check-patch-master-file-buffer (master-file-temp-buffer
+					       master-file-name patched-master-file-name
+					       source-file-name patched-source-file-name
+					       include-dirs regexp-list)
+  "Check if MASTER-FILE-NAME is a master file for SOURCE-FILE-NAME.
+For .cpp master file this means it includes SOURCE-FILE-NAME (.h).
+If yes, patch a copy of MASTER-FILE-NAME to include PATCHED-SOURCE-FILE-NAME
+instead of SOURCE-FILE-NAME.
+Whether a buffer for MATER-FILE-NAME exists, use it as a source
+instead of reading master file from disk."
+  (let* ((found                     nil)
+	 (regexp                    (format (nth 0 regexp-list)	; "[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\""
+					    (file-name-nondirectory source-file-name)))
+	 (path-idx                  (nth 1 regexp-list))
+	 (name-idx                  (nth 2 regexp-list))
+	 (inc-path                  nil)
+	 (inc-name                  nil)
+	 (search-limit              flymake-check-file-limit))
     (save-excursion
-	(delete-region beg end)
-	    (goto-char beg)
-	(insert rep)
-	)
-)
+      (unwind-protect
+	  (progn
+	    (set-buffer master-file-temp-buffer)
+	    (when (> search-limit (point-max))
+	      (setq search-limit (point-max)))
+	    (flymake-log 3 "checking %s against regexp %s" master-file-name regexp)
+	    (goto-char (point-min))
+	    (while (and (< (point) search-limit) (re-search-forward regexp search-limit t))
+	      (let* ((match-beg   (match-beginning name-idx))
+		     (match-end   (match-end name-idx)))
 
-(defun flymake-read-file-to-temp-buffer(file-name)
-    "isert contents of file-name into newly created temp buffer"
-    (let* ((temp-buffer (get-buffer-create (generate-new-buffer-name (concat "flymake:" (file-name-nondirectory file-name))))))
-	(save-excursion
-	    (set-buffer temp-buffer)
-	    (insert-file-contents file-name)
-	)
-	temp-buffer
-    )
-)
+		(flymake-log 3 "found possible match for %s" (file-name-nondirectory source-file-name))
+		(setq inc-path (match-string path-idx))
+		(setq inc-name (match-string name-idx))
+		(when (string= inc-name (file-name-nondirectory source-file-name))
+		  (flymake-log 3 "inc-path=%s inc-name=%s" inc-path inc-name)
+		  (when (flymake-check-include source-file-name inc-path inc-name include-dirs)
+		    (setq found t)
+		    ;;  replace-match is not used here as it fails in
+		    ;; xemacs with 'last match not a buffer' error as
+		    ;; check-includes calls replace-in-string
+		    (flymake-replace-region (current-buffer) match-beg match-end
+					    (file-name-nondirectory patched-source-file-name))))
+		(forward-line 1)))
+	    (when found
+	      (flymake-save-buffer-in-file (current-buffer) patched-master-file-name)))
+					;+(flymake-log 3 "killing buffer %s" (buffer-name master-file-temp-buffer))
+	(kill-buffer master-file-temp-buffer)))
+					;+(flymake-log 3 "check-patch master file %s: %s" master-file-name found)
+    (when found
+      (flymake-log 2 "found master file %s" master-file-name))
+    found))
 
-(defun flymake-copy-buffer-to-temp-buffer(buffer)
-    "copy contents of buffer into newly created temp buffer"
-    (let ((contents     nil)
-	  (temp-buffer  nil))
-	(save-excursion
-	    (set-buffer buffer)
-	    (setq contents (buffer-string))
+(defun flymake-replace-region (buffer beg end rep)
+  "Replace text in BUFFER in region (BEG END) with REP."
+  (save-excursion
+    (delete-region beg end)
+    (goto-char beg)
+    (insert rep)))
 
-	    (setq temp-buffer (get-buffer-create (generate-new-buffer-name (concat "flymake:" (buffer-name buffer)))))
-	    (set-buffer temp-buffer)
-	    (insert contents)
-	)
-	temp-buffer
-    )
-)
+(defun flymake-read-file-to-temp-buffer (file-name)
+  "Insert contents of FILE-NAME into newly created temp buffer."
+  (let* ((temp-buffer (get-buffer-create (generate-new-buffer-name (concat "flymake:" (file-name-nondirectory file-name))))))
+    (save-excursion
+      (set-buffer temp-buffer)
+      (insert-file-contents file-name))
+    temp-buffer))
 
-(defun flymake-check-include(source-file-name inc-path inc-name include-dirs)
-    "t if source-file-name is the one found via include dirs using inc-path and inc-name"
-    (if (file-name-absolute-p inc-path)
-	(flymake-same-files source-file-name (concat inc-path "/" inc-name))
-    ;else
-	(let* ((count      (length include-dirs))
-	       (idx        0)
-	       (file-name  nil)
-	       (found      nil))
-	    (while (and (not found) (< idx count))
-		(setq file-name (concat (file-name-directory source-file-name) "/" (nth idx include-dirs)))
-		(if (> (length inc-path) 0)
-		    (setq file-name (concat file-name "/" inc-path))
-		)
-		(setq file-name (concat file-name "/" inc-name))
-		(when (flymake-same-files source-file-name file-name)
-		    (setq found t)
-		)
-		(setq idx (1+ idx))
-	    )
-	    found
-	)
-    )
-)
+(defun flymake-copy-buffer-to-temp-buffer (buffer)
+  "Copy contents of BUFFER into newly created temp buffer."
+  (let ((contents     nil)
+	(temp-buffer  nil))
+    (save-excursion
+      (set-buffer buffer)
+      (setq contents (buffer-string))
+
+      (setq temp-buffer (get-buffer-create (generate-new-buffer-name (concat "flymake:" (buffer-name buffer)))))
+      (set-buffer temp-buffer)
+      (insert contents))
+    temp-buffer))
 
-(defun flymake-find-buffer-for-file(file-name)
-    "buffer if there exists a buffer visiting file-name, nil otherwise"
-    (let ((buffer-name (get-file-buffer file-name)))
-	(if buffer-name
-	    (get-buffer buffer-name)
-	)
-    )
-)
+(defun flymake-check-include (source-file-name inc-path inc-name include-dirs)
+  "Check if SOURCE-FILE-NAME can be found in include path.
+Return t if it can be found via include path using INC-PATH and INC-NAME."
+  (if (file-name-absolute-p inc-path)
+      (flymake-same-files source-file-name (concat inc-path "/" inc-name))
+    (let* ((count      (length include-dirs))
+	   (idx        0)
+	   (file-name  nil)
+	   (found      nil))
+      (while (and (not found) (< idx count))
+	(setq file-name (concat (file-name-directory source-file-name) "/" (nth idx include-dirs)))
+	(if (> (length inc-path) 0)
+	    (setq file-name (concat file-name "/" inc-path)))
+	(setq file-name (concat file-name "/" inc-name))
+	(when (flymake-same-files source-file-name file-name)
+	  (setq found t))
+	(setq idx (1+ idx)))
+      found)))
 
-(defun flymake-create-master-file(source-file-name patched-source-file-name get-incl-dirs-f create-temp-f masks include-regexp-list)
-    "save source-file-name with a different name, find master file, patch it and save it to."
-    (let* ((possible-master-files     (flymake-find-possible-master-files source-file-name flymake-master-file-dirs masks))
-	   (master-file-count         (length possible-master-files))
-	   (idx                       0)
-	   (temp-buffer               nil)
-	   (master-file-name          nil)
-	   (patched-master-file-name  nil)
-	   (found                     nil))
+(defun flymake-find-buffer-for-file (file-name)
+  "Check if there exists a buffer visiting FILE-NAME.
+Return t if so, nil if not."
+  (let ((buffer-name (get-file-buffer file-name)))
+    (if buffer-name
+	(get-buffer buffer-name))))
+
+(defun flymake-create-master-file (source-file-name patched-source-file-name get-incl-dirs-f create-temp-f masks include-regexp-list)
+  "Save SOURCE-FILE-NAME with a different name.
+Find master file, patch and save it."
+  (let* ((possible-master-files     (flymake-find-possible-master-files source-file-name flymake-master-file-dirs masks))
+	 (master-file-count         (length possible-master-files))
+	 (idx                       0)
+	 (temp-buffer               nil)
+	 (master-file-name          nil)
+	 (patched-master-file-name  nil)
+	 (found                     nil))
 
-	(while (and (not found) (< idx master-file-count))
-	    (setq master-file-name (nth idx possible-master-files))
-	    (setq patched-master-file-name (funcall create-temp-f master-file-name "flymake_master"))
-	    (if (flymake-find-buffer-for-file master-file-name)
-		(setq temp-buffer (flymake-copy-buffer-to-temp-buffer (flymake-find-buffer-for-file master-file-name)))
-	    ;else
-		(setq temp-buffer (flymake-read-file-to-temp-buffer master-file-name))
-	    )
-	    (setq found
-		  (flymake-check-patch-master-file-buffer
-		       temp-buffer
-		       master-file-name
-		       patched-master-file-name
-		       source-file-name
-		       patched-source-file-name
-		       (funcall get-incl-dirs-f (file-name-directory master-file-name))
-		       include-regexp-list))
-	    (setq idx (1+ idx))
-	)
-	(if found
-	    (list master-file-name patched-master-file-name)
-	;else
-	    (progn
-		(flymake-log 3 "none of %d master file(s) checked includes %s" master-file-count
-			   (file-name-nondirectory source-file-name))
-		nil
-	    )
-	)
-    )
-)
+    (while (and (not found) (< idx master-file-count))
+      (setq master-file-name (nth idx possible-master-files))
+      (setq patched-master-file-name (funcall create-temp-f master-file-name "flymake_master"))
+      (if (flymake-find-buffer-for-file master-file-name)
+	  (setq temp-buffer (flymake-copy-buffer-to-temp-buffer (flymake-find-buffer-for-file master-file-name)))
+	(setq temp-buffer (flymake-read-file-to-temp-buffer master-file-name)))
+      (setq found
+	    (flymake-check-patch-master-file-buffer
+	     temp-buffer
+	     master-file-name
+	     patched-master-file-name
+	     source-file-name
+	     patched-source-file-name
+	     (funcall get-incl-dirs-f (file-name-directory master-file-name))
+	     include-regexp-list))
+      (setq idx (1+ idx)))
+    (if found
+	(list master-file-name patched-master-file-name)
+      (progn
+	(flymake-log 3 "none of %d master file(s) checked includes %s" master-file-count
+		     (file-name-nondirectory source-file-name))
+	nil))))
+
+(defun flymake-save-buffer-in-file (buffer file-name)
+  (or buffer
+      (error "Invalid buffer"))
+  (save-excursion
+    (save-restriction
+      (set-buffer buffer)
+      (widen)
+      (make-directory (file-name-directory file-name) 1)
+      (write-region (point-min) (point-max) file-name nil 566)))
+  (flymake-log 3 "saved buffer %s in file %s" (buffer-name buffer) file-name))
 
-(defun flymake-save-buffer-in-file(buffer file-name)
-    (or buffer
-	(error "invalid buffer")
-    )
-    (save-excursion
-	(save-restriction
-	    (set-buffer buffer)
-	    (widen)
-	    (make-directory (file-name-directory file-name) 1)
-	    (write-region (point-min) (point-max) file-name nil 566)
-	)
-    )
-    (flymake-log 3 "saved buffer %s in file %s" (buffer-name buffer) file-name)
-)
+(defun flymake-save-string-to-file (file-name data)
+  "Save string DATA to file FILE-NAME."
+  (write-region data nil file-name nil 566))
 
-(defun flymake-save-string-to-file(file-name data)
-    "save string data to file file-name"
-    (write-region data nil file-name nil 566)
-)
+(defun flymake-read-file-to-string (file-name)
+  "Read contents of file FILE-NAME and return as a string."
+  (with-temp-buffer
+    (insert-file-contents file-name)
+    (buffer-substring (point-min) (point-max))))
 
-(defun flymake-read-file-to-string(file-name)
-    "read file contents and return them as a string"
-    (with-temp-buffer
-	(insert-file-contents file-name)
-	(buffer-substring (point-min) (point-max))
-    )
-)
+(defun flymake-process-filter (process output)
+  "Parse OUTPUT and highlight error lines.
+It's flymake process filter."
+  (let* ((pid               (process-id process))
+	 (source-buffer     (get-buffer (flymake-get-source-buffer-name pid))))
 
-(defun flymake-process-filter(process output)
-    "flymake process filter: parse output, highlight err lines"
-    (let* ((pid               (process-id process))
-	   (source-buffer     (get-buffer (flymake-get-source-buffer-name pid))))
-
-	(flymake-log 3 "received %d byte(s) of output from process %d" (length output) pid)
-	(when source-buffer
-	    (flymake-parse-output-and-residual source-buffer output)
-	)
-    )
-)
+    (flymake-log 3 "received %d byte(s) of output from process %d" (length output) pid)
+    (when source-buffer
+      (flymake-parse-output-and-residual source-buffer output))))
 
-(defun flymake-process-sentinel(process event)
-   "Sentinel for syntax check buffers"
-   (if (memq (process-status process) '(signal exit))
-       (let*((exit-status       (process-exit-status process))
-	     (command           (process-command process))
-	     (pid               (process-id process))
-	     (source-buffer     (get-buffer (flymake-get-source-buffer-name pid)))
-	     (cleanup-f         (flymake-get-cleanup-function (buffer-file-name source-buffer))))
+(defun flymake-process-sentinel (process event)
+  "Sentinel for syntax check buffers."
+  (if (memq (process-status process) '(signal exit))
+      (let*((exit-status       (process-exit-status process))
+	    (command           (process-command process))
+	    (pid               (process-id process))
+	    (source-buffer     (get-buffer (flymake-get-source-buffer-name pid)))
+	    (cleanup-f         (flymake-get-cleanup-function (buffer-file-name source-buffer))))
 
-	 (flymake-log 2 "process %d exited with code %d" pid exit-status)
-	 (condition-case err
-	     (progn
-		 (flymake-log 3 "cleaning up using %s" cleanup-f)
-		 (funcall cleanup-f source-buffer)
-
-		 (flymake-unreg-names pid)
-		 (delete-process process)
+	(flymake-log 2 "process %d exited with code %d" pid exit-status)
+	(condition-case err
+	    (progn
+	      (flymake-log 3 "cleaning up using %s" cleanup-f)
+	      (funcall cleanup-f source-buffer)
 
-		 (when source-buffer
-		     (save-excursion
-			 (set-buffer source-buffer)
+	      (flymake-unreg-names pid)
+	      (delete-process process)
+
+	      (when source-buffer
+		(save-excursion
+		  (set-buffer source-buffer)
 
-			 (flymake-parse-residual source-buffer)
-			 (flymake-post-syntax-check source-buffer exit-status command)
-			 (flymake-set-buffer-is-running source-buffer nil)
-		   )
-		)
-	    )
-	   (error
-	      (let ((err-str (format "Error in process sentinel for buffer %s: %s"
-				    source-buffer (error-message-string err))))
-		  (flymake-log 0 err-str)
-		  (flymake-set-buffer-is-running source-buffer nil)
-	       )
-	   )
-	 )
-      )
-   )
-)
+		  (flymake-parse-residual source-buffer)
+		  (flymake-post-syntax-check source-buffer exit-status command)
+		  (flymake-set-buffer-is-running source-buffer nil))))
+	  (error
+	   (let ((err-str (format "Error in process sentinel for buffer %s: %s"
+				  source-buffer (error-message-string err))))
+	     (flymake-log 0 err-str)
+	     (flymake-set-buffer-is-running source-buffer nil)))))))
 
-(defun flymake-post-syntax-check(source-buffer exit-status command)
-    ""
-   (flymake-set-buffer-err-info source-buffer (flymake-get-buffer-new-err-info source-buffer))
-   (flymake-set-buffer-new-err-info source-buffer nil)
+(defun flymake-post-syntax-check (source-buffer exit-status command)
+  (flymake-set-buffer-err-info source-buffer (flymake-get-buffer-new-err-info source-buffer))
+  (flymake-set-buffer-new-err-info source-buffer nil)
 
-   (flymake-set-buffer-err-info source-buffer (flymake-fix-line-numbers
-					     (flymake-get-buffer-err-info source-buffer)
-					     1
-					     (flymake-count-lines source-buffer)))
-   (flymake-delete-own-overlays source-buffer)
-   (flymake-highlight-err-lines source-buffer (flymake-get-buffer-err-info source-buffer))
+  (flymake-set-buffer-err-info source-buffer (flymake-fix-line-numbers
+					      (flymake-get-buffer-err-info source-buffer)
+					      1
+					      (flymake-count-lines source-buffer)))
+  (flymake-delete-own-overlays source-buffer)
+  (flymake-highlight-err-lines source-buffer (flymake-get-buffer-err-info source-buffer))
 
-   (let ((err-count   (flymake-get-err-count (flymake-get-buffer-err-info source-buffer) "e"))
-	 (warn-count  (flymake-get-err-count (flymake-get-buffer-err-info source-buffer) "w")))
+  (let ((err-count   (flymake-get-err-count (flymake-get-buffer-err-info source-buffer) "e"))
+	(warn-count  (flymake-get-err-count (flymake-get-buffer-err-info source-buffer) "w")))
 
-       (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
-		  (buffer-name source-buffer) err-count warn-count
-		  (- (flymake-float-time) (flymake-get-buffer-check-start-time source-buffer)))
-       (flymake-set-buffer-check-start-time source-buffer nil)
-       (if (and (equal 0 err-count) (equal 0 warn-count))
-	   (if (equal 0 exit-status)
-	       (flymake-report-status source-buffer "" "") ; PASSED
-	   ;else
-	       (if (not (flymake-get-buffer-check-was-interrupted source-buffer))
-		   (flymake-report-fatal-status (current-buffer) "CFGERR"
-		       (format "Configuration error has occured while running %s" command))
-	       ;else
-		   (flymake-report-status source-buffer nil "") ; "STOPPED"
-	       )
-	   )
-       ;else
-	   (flymake-report-status source-buffer (format "%d/%d" err-count warn-count) "")
-       )
-   )
-)
+    (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
+		 (buffer-name source-buffer) err-count warn-count
+		 (- (flymake-float-time) (flymake-get-buffer-check-start-time source-buffer)))
+    (flymake-set-buffer-check-start-time source-buffer nil)
+    (if (and (equal 0 err-count) (equal 0 warn-count))
+	(if (equal 0 exit-status)
+	    (flymake-report-status source-buffer "" "")	; PASSED
+	  (if (not (flymake-get-buffer-check-was-interrupted source-buffer))
+	      (flymake-report-fatal-status (current-buffer) "CFGERR"
+					   (format "Configuration error has occured while running %s" command))
+	    (flymake-report-status source-buffer nil ""))) ; "STOPPED"
+      (flymake-report-status source-buffer (format "%d/%d" err-count warn-count) ""))))
 
-(defun flymake-parse-output-and-residual(source-buffer output)
-    "split output into lines, merge in residual if necessary"
-    (save-excursion
-	(set-buffer source-buffer)
-	(let* ((buffer-residual     (flymake-get-buffer-output-residual source-buffer))
-	       (total-output        (if buffer-residual (concat buffer-residual output) output))
-	       (lines-and-residual  (flymake-split-output total-output))
-	       (lines               (nth 0 lines-and-residual))
-	       (new-residual        (nth 1 lines-and-residual)))
+(defun flymake-parse-output-and-residual (source-buffer output)
+  "Split OUTPUT into lines, merge in residual if necessary."
+  (save-excursion
+    (set-buffer source-buffer)
+    (let* ((buffer-residual     (flymake-get-buffer-output-residual source-buffer))
+	   (total-output        (if buffer-residual (concat buffer-residual output) output))
+	   (lines-and-residual  (flymake-split-output total-output))
+	   (lines               (nth 0 lines-and-residual))
+	   (new-residual        (nth 1 lines-and-residual)))
 
-	    (flymake-set-buffer-output-residual source-buffer new-residual)
-	    (flymake-set-buffer-new-err-info source-buffer (flymake-parse-err-lines
-							    (flymake-get-buffer-new-err-info source-buffer)
-							    source-buffer lines))
-	)
-    )
-)
+      (flymake-set-buffer-output-residual source-buffer new-residual)
+      (flymake-set-buffer-new-err-info source-buffer (flymake-parse-err-lines
+						      (flymake-get-buffer-new-err-info source-buffer)
+						      source-buffer lines)))))
 
-(defun flymake-parse-residual(source-buffer)
-    "parse residual if it's non empty"
-    (save-excursion
-	(set-buffer source-buffer)
-	(when (flymake-get-buffer-output-residual source-buffer)
-	    (flymake-set-buffer-new-err-info source-buffer (flymake-parse-err-lines
-							   (flymake-get-buffer-new-err-info source-buffer)
-							   source-buffer
-							   (list (flymake-get-buffer-output-residual source-buffer))))
-	    (flymake-set-buffer-output-residual source-buffer nil)
-	)
-    )
-)
+(defun flymake-parse-residual (source-buffer)
+  "Parse residual if it's non empty."
+  (save-excursion
+    (set-buffer source-buffer)
+    (when (flymake-get-buffer-output-residual source-buffer)
+      (flymake-set-buffer-new-err-info source-buffer (flymake-parse-err-lines
+						      (flymake-get-buffer-new-err-info source-buffer)
+						      source-buffer
+						      (list (flymake-get-buffer-output-residual source-buffer))))
+      (flymake-set-buffer-output-residual source-buffer nil))))
 
 (defvar flymake-err-info nil
-    "sorted list of line numbers and lists of err info in the form (file, err-text)."
-)
+  "Sorted list of line numbers and lists of err info in the form (file, err-text).")
+
 (make-variable-buffer-local 'flymake-err-info)
-(defun flymake-get-buffer-err-info(buffer)
-    (flymake-get-buffer-var buffer 'flymake-err-info)
-)
-(defun flymake-set-buffer-err-info(buffer err-info)
-    (flymake-set-buffer-var buffer 'flymake-err-info err-info)
-)
-(defun flymake-er-make-er(line-no line-err-info-list)
-    (list line-no line-err-info-list)
-)
-(defun flymake-er-get-line(err-info)
-    (nth 0 err-info)
-)
-(defun flymake-er-get-line-err-info-list(err-info)
-    (nth 1 err-info)
-)
+
+(defun flymake-get-buffer-err-info (buffer)
+  (flymake-get-buffer-var buffer 'flymake-err-info))
+
+(defun flymake-set-buffer-err-info (buffer err-info)
+  (flymake-set-buffer-var buffer 'flymake-err-info err-info))
+
+(defun flymake-er-make-er (line-no line-err-info-list)
+  (list line-no line-err-info-list))
+
+(defun flymake-er-get-line (err-info)
+  (nth 0 err-info))
+
+(defun flymake-er-get-line-err-info-list (err-info)
+  (nth 1 err-info))
 
 (defvar flymake-new-err-info nil
-    "the same as flymake -err-info, effective when a syntax check is in progress"
-)
+  "Same as 'flymake-err-info', effective when a syntax check is in progress.")
+
 (make-variable-buffer-local 'flymake-new-err-info)
-(defun flymake-get-buffer-new-err-info(buffer)
-    (flymake-get-buffer-var buffer 'flymake-new-err-info)
-)
-(defun flymake-set-buffer-new-err-info(buffer new-err-info)
-    (flymake-set-buffer-var buffer 'flymake-new-err-info new-err-info)
-)
+
+(defun flymake-get-buffer-new-err-info (buffer)
+  (flymake-get-buffer-var buffer 'flymake-new-err-info))
+
+(defun flymake-set-buffer-new-err-info (buffer new-err-info)
+  (flymake-set-buffer-var buffer 'flymake-new-err-info new-err-info))
 
 ;; getters/setters for line-err-info: (file, line, type, text).
-(defun flymake-ler-make-ler(file line type text &optional full-file)
-    (list file line type text full-file)
-)
-(defun flymake-ler-get-file(line-err-info)
-    (nth 0 line-err-info)
-)
-(defun flymake-ler-get-line(line-err-info)
-    (nth 1 line-err-info)
-)
-(defun flymake-ler-get-type(line-err-info)
-    (nth 2 line-err-info)
-)
-(defun flymake-ler-get-text(line-err-info)
-    (nth 3 line-err-info)
-)
-(defun flymake-ler-get-full-file(line-err-info)
-    (nth 4 line-err-info)
-)
-(defun flymake-ler-set-file(line-err-info file)
-    (flymake-ler-make-ler file
+(defun flymake-ler-make-ler (file line type text &optional full-file)
+  (list file line type text full-file))
+
+(defun flymake-ler-get-file (line-err-info)
+  (nth 0 line-err-info))
+
+(defun flymake-ler-get-line (line-err-info)
+  (nth 1 line-err-info))
+
+(defun flymake-ler-get-type (line-err-info)
+  (nth 2 line-err-info))
+
+(defun flymake-ler-get-text (line-err-info)
+  (nth 3 line-err-info))
+
+(defun flymake-ler-get-full-file (line-err-info)
+  (nth 4 line-err-info))
+
+(defun flymake-ler-set-file (line-err-info file)
+  (flymake-ler-make-ler file
 			(flymake-ler-get-line line-err-info)
 			(flymake-ler-get-type line-err-info)
 			(flymake-ler-get-text line-err-info)
-			(flymake-ler-get-full-file line-err-info))
-)
-(defun flymake-ler-set-full-file(line-err-info full-file)
-    (flymake-ler-make-ler (flymake-ler-get-file line-err-info)
+			(flymake-ler-get-full-file line-err-info)))
+
+(defun flymake-ler-set-full-file (line-err-info full-file)
+  (flymake-ler-make-ler (flymake-ler-get-file line-err-info)
 			(flymake-ler-get-line line-err-info)
 			(flymake-ler-get-type line-err-info)
 			(flymake-ler-get-text line-err-info)
-			full-file)
-)
-(defun flymake-ler-set-line(line-err-info line)
-    (flymake-ler-make-ler (flymake-ler-get-file line-err-info)
+			full-file))
+
+(defun flymake-ler-set-line (line-err-info line)
+  (flymake-ler-make-ler (flymake-ler-get-file line-err-info)
 			line
 			(flymake-ler-get-type line-err-info)
 			(flymake-ler-get-text line-err-info)
-			(flymake-ler-get-full-file line-err-info))
-)
-
-(defun flymake-get-line-err-count(line-err-info-list type)
-    "return number of errors of specified type - e or w"
-    (let* ((idx        0)
-	   (count      (length line-err-info-list))
-	   (err-count  0))
+			(flymake-ler-get-full-file line-err-info)))
 
-	(while (< idx count)
-	    (when (equal type (flymake-ler-get-type (nth idx line-err-info-list)))
-		(setq err-count (1+ err-count))
-	    )
-	    (setq idx (1+ idx))
-	)
-	err-count
-    )
-)
+(defun flymake-get-line-err-count (line-err-info-list type)
+  "Return number of errors of specified TYPE.
+Value of TYPE is eigher e or w."
+  (let* ((idx        0)
+	 (count      (length line-err-info-list))
+	 (err-count  0))
+
+    (while (< idx count)
+      (when (equal type (flymake-ler-get-type (nth idx line-err-info-list)))
+	(setq err-count (1+ err-count)))
+      (setq idx (1+ idx)))
+    err-count))
 
-(defun flymake-get-err-count(err-info-list type)
-    "return number of errors of specified type for the err-info-list"
-    (let* ((idx        0)
-	   (count      (length err-info-list))
-	   (err-count  0))
-	(while (< idx count)
-	    (setq err-count (+ err-count (flymake-get-line-err-count (nth 1 (nth idx err-info-list)) type)))
-	    (setq idx (1+ idx))
-	)
-	err-count
-    )
-)
+(defun flymake-get-err-count (err-info-list type)
+  "Return number of errors of specified TYPE for ERR-INFO-LIST."
+  (let* ((idx        0)
+	 (count      (length err-info-list))
+	 (err-count  0))
+    (while (< idx count)
+      (setq err-count (+ err-count (flymake-get-line-err-count (nth 1 (nth idx err-info-list)) type)))
+      (setq idx (1+ idx)))
+    err-count))
 
-(defun flymake-fix-line-numbers(err-info-list min-line max-line)
-    "replace line-numbers < min-line with min-line and > max-line with max-line - as some compilers might report line number outside the file being compiled"
-    (let* ((count     (length err-info-list))
-	   (err-info  nil)
-	   (line      0))
-	(while (> count 0)
-	    (setq err-info (nth (1- count) err-info-list))
-	    (setq line (flymake-er-get-line err-info))
-	    (when (or (< line min-line) (> line max-line))
-		(setq line (if (< line min-line) min-line max-line))
-		(setq err-info-list (flymake-set-at err-info-list (1- count)
+(defun flymake-fix-line-numbers (err-info-list min-line max-line)
+  "Replace line numbers with fixed value.
+If line-numbers is less than MIN-LINE, set line numbers to MIN-LINE.
+If line numbers is greater than MAX-LINE, set line numbers to MAX-LINE.
+The reason for this fix is because some compilers might report
+line number outside the file being compiled."
+  (let* ((count     (length err-info-list))
+	 (err-info  nil)
+	 (line      0))
+    (while (> count 0)
+      (setq err-info (nth (1- count) err-info-list))
+      (setq line (flymake-er-get-line err-info))
+      (when (or (< line min-line) (> line max-line))
+	(setq line (if (< line min-line) min-line max-line))
+	(setq err-info-list (flymake-set-at err-info-list (1- count)
 					    (flymake-er-make-er line
-							      (flymake-er-get-line-err-info-list err-info))))
-	    )
-	    (setq count (1- count))
-	)
-    )
-    err-info-list
-)
+								(flymake-er-get-line-err-info-list err-info)))))
+      (setq count (1- count))))
+  err-info-list)
 
-(defun flymake-highlight-err-lines(buffer err-info-list)
-    "highlight err-lines in buffer using info from err-info-list"
-    (save-excursion
-	(set-buffer buffer)
-	(let* ((idx    0)
-	       (count  (length err-info-list)))
-	    (while (< idx count)
-		(flymake-highlight-line (car (nth idx err-info-list)) (nth 1 (nth idx err-info-list)))
-		(setq idx (1+ idx))
-	    )
-	)
-    )
-)
+(defun flymake-highlight-err-lines (buffer err-info-list)
+  "Highlight error lines in BUFFER using info from ERR-INFO-LIST."
+  (save-excursion
+    (set-buffer buffer)
+    (let* ((idx    0)
+	   (count  (length err-info-list)))
+      (while (< idx count)
+	(flymake-highlight-line (car (nth idx err-info-list)) (nth 1 (nth idx err-info-list)))
+	(setq idx (1+ idx))))))
 
-(defun flymake-overlay-p(ov)
-     "Determine whether overlay was created by flymake"
-     (and (overlayp ov) (overlay-get ov 'flymake-overlay))
-)
+(defun flymake-overlay-p (ov)
+  "Determine whether overlay OV was created by flymake."
+  (and (overlayp ov) (overlay-get ov 'flymake-overlay)))
 
-(defun flymake-make-overlay(beg end tooltip-text face mouse-face)
-    "Allocate a flymake overlay in range beg end"
-    (when (not (flymake-region-has-flymake-overlays beg end))
-	(let ((ov (make-overlay beg end nil t t)))
-	    (overlay-put ov 'face           face)
-	    (overlay-put ov 'mouse-face     mouse-face)
-	    (overlay-put ov 'help-echo      tooltip-text)
-	    (overlay-put ov 'flymake-overlay  t)
-	    (overlay-put ov 'priority 100)
-	    ;+(flymake-log 3 "created overlay %s" ov)
-	    ov
-	)
-	(flymake-log 3 "created an overlay at (%d-%d)" beg end)
-    )
-)
+(defun flymake-make-overlay (beg end tooltip-text face mouse-face)
+  "Allocate a flymake overlay in range BEG and END."
+  (when (not (flymake-region-has-flymake-overlays beg end))
+    (let ((ov (make-overlay beg end nil t t)))
+      (overlay-put ov 'face           face)
+      (overlay-put ov 'mouse-face     mouse-face)
+      (overlay-put ov 'help-echo      tooltip-text)
+      (overlay-put ov 'flymake-overlay  t)
+      (overlay-put ov 'priority 100)
+					;+(flymake-log 3 "created overlay %s" ov)
+      ov)
+    (flymake-log 3 "created an overlay at (%d-%d)" beg end)))
 
-(defun flymake-delete-own-overlays(buffer)
-    "Delete all flymake overlays in buffer"
-    (save-excursion
-	(set-buffer buffer)
-	(let ((ov (overlays-in (point-min) (point-max))))
-	    (while (consp ov)
-		(when (flymake-overlay-p (car ov))
-		    (delete-overlay (car ov))
-		    ;+(flymake-log 3 "deleted overlay %s" ov)
-		)
-		(setq ov (cdr ov))
-	    )
-	)
-    )
-)
+(defun flymake-delete-own-overlays (buffer)
+  "Delete all flymake overlays in BUFFER."
+  (save-excursion
+    (set-buffer buffer)
+    (let ((ov (overlays-in (point-min) (point-max))))
+      (while (consp ov)
+	(when (flymake-overlay-p (car ov))
+	  (delete-overlay (car ov))
+					;+(flymake-log 3 "deleted overlay %s" ov)
+	  )
+	(setq ov (cdr ov))))))
 
-(defun flymake-region-has-flymake-overlays(beg end)
-    "t if specified regions has at least one flymake overlay, nil otrherwise"
-    (let ((ov                  (overlays-in beg end))
-	  (has-flymake-overlays  nil))
-	(while (consp ov)
-	    (when (flymake-overlay-p (car ov))
-		(setq has-flymake-overlays t)
-	    )
-	    (setq ov (cdr ov))
-	)
-    )
-)
+(defun flymake-region-has-flymake-overlays (beg end)
+  "Check if region specified by BEG and END has overlay.
+Return t if it has at least one flymake overlay, nil if no overlay."
+  (let ((ov                  (overlays-in beg end))
+	(has-flymake-overlays  nil))
+    (while (consp ov)
+      (when (flymake-overlay-p (car ov))
+	(setq has-flymake-overlays t))
+      (setq ov (cdr ov)))))
 
 (defface flymake-errline-face
-;+   '((((class color)) (:foreground "OrangeRed" :bold t :underline t))
-;+   '((((class color)) (:underline "OrangeRed"))
-   '((((class color)) (:background "LightPink"))
-     (t (:bold t)))
-   "Face used for marking error lines"
-    :group 'flymake
-)
+					;+   '((((class color)) (:foreground "OrangeRed" :bold t :underline t))
+					;+   '((((class color)) (:underline "OrangeRed"))
+  '((((class color)) (:background "LightPink"))
+    (t (:bold t)))
+  "Face used for marking error lines."
+  :group 'flymake)
 
 (defface flymake-warnline-face
-   '((((class color)) (:background "LightBlue2"))
-     (t (:bold t)))
-   "Face used for marking warning lines"
-    :group 'flymake
-)
-
+  '((((class color)) (:background "LightBlue2"))
+    (t (:bold t)))
+  "Face used for marking warning lines."
+  :group 'flymake)
 
-(defun flymake-highlight-line(line-no line-err-info-list)
-    "highlight line line-no in current buffer, perhaps use text from line-err-info-list to enhance highlighting"
-    (goto-line line-no)
-    (let* ((line-beg (flymake-line-beginning-position))
-	   (line-end (flymake-line-end-position))
-	   (beg      line-beg)
-	   (end      line-end)
-	   (tooltip-text (flymake-ler-get-text (nth 0 line-err-info-list)))
-	   (face     nil))
+(defun flymake-highlight-line (line-no line-err-info-list)
+  "Highlight line LINE-NO in current buffer.
+Perhaps use text from LINE-ERR-INFO-ILST to enhance highlighting."
+  (goto-line line-no)
+  (let* ((line-beg (flymake-line-beginning-position))
+	 (line-end (flymake-line-end-position))
+	 (beg      line-beg)
+	 (end      line-end)
+	 (tooltip-text (flymake-ler-get-text (nth 0 line-err-info-list)))
+	 (face     nil))
 
-	(goto-char line-beg)
-	(while (looking-at "[ \t]")
-	    (forward-char)
-	)
-
-	(setq beg (point))
-
-	(goto-char line-end)
-	(while (and (looking-at "[ \t\r\n]") (> (point) 1))
-	    (backward-char)
-	)
+    (goto-char line-beg)
+    (while (looking-at "[ \t]")
+      (forward-char))
 
-	(setq end (1+ (point)))
+    (setq beg (point))
+
+    (goto-char line-end)
+    (while (and (looking-at "[ \t\r\n]") (> (point) 1))
+      (backward-char))
+
+    (setq end (1+ (point)))
 
-	(when (<= end beg)
-	    (setq beg line-beg)
-	    (setq end line-end)
-	)
-	(when (= end beg)
-	    (goto-char end)
-	    (forward-line)
-	    (setq end (point))
-	)
-	(if (> (flymake-get-line-err-count line-err-info-list "e") 0)
-	    (setq face 'flymake-errline-face)
-	;else
-	    (setq face 'flymake-warnline-face)
-	)
-	(flymake-make-overlay beg end tooltip-text face nil)
-    )
-)
+    (when (<= end beg)
+      (setq beg line-beg)
+      (setq end line-end))
 
-(defun flymake-parse-err-lines(err-info-list source-buffer lines)
-    "parse err lines, store info in err-info-list"
-    (let* ((count              (length lines))
-	   (idx                0)
-	   (line-err-info      nil)
-	   (real-file-name     nil)
-	   (source-file-name   (buffer-file-name source-buffer))
-	   (get-real-file-name-f (flymake-get-real-file-name-function source-file-name)))
+    (when (= end beg)
+      (goto-char end)
+      (forward-line)
+      (setq end (point)))
+
+    (if (> (flymake-get-line-err-count line-err-info-list "e") 0)
+	(setq face 'flymake-errline-face)
+      (setq face 'flymake-warnline-face))
+
+    (flymake-make-overlay beg end tooltip-text face nil)))
 
-	(while (< idx count)
-	    (setq line-err-info (flymake-parse-line (nth idx lines)))
-	    (when line-err-info
-		(setq real-file-name (funcall get-real-file-name-f source-buffer (flymake-ler-get-file line-err-info)))
-		(setq line-err-info (flymake-ler-set-full-file line-err-info real-file-name))
+(defun flymake-parse-err-lines (err-info-list source-buffer lines)
+  "Parse err LINES, store info in ERR-INFO-LIST."
+  (let* ((count              (length lines))
+	 (idx                0)
+	 (line-err-info      nil)
+	 (real-file-name     nil)
+	 (source-file-name   (buffer-file-name source-buffer))
+	 (get-real-file-name-f (flymake-get-real-file-name-function source-file-name)))
 
-		(if (flymake-same-files real-file-name source-file-name)
-		    (setq line-err-info (flymake-ler-set-file line-err-info nil))
-		;else
-		    (setq line-err-info (flymake-ler-set-file line-err-info (file-name-nondirectory real-file-name)))
-		)
+    (while (< idx count)
+      (setq line-err-info (flymake-parse-line (nth idx lines)))
+      (when line-err-info
+	(setq real-file-name (funcall get-real-file-name-f source-buffer (flymake-ler-get-file line-err-info)))
+	(setq line-err-info (flymake-ler-set-full-file line-err-info real-file-name))
 
-		(setq err-info-list (flymake-add-err-info err-info-list line-err-info))
-	    )
-	    (flymake-log 3 "parsed '%s', %s line-err-info" (nth idx lines) (if line-err-info "got" "no"))
-	    (setq idx (1+ idx))
-	)
-	err-info-list
-    )
-)
+	(if (flymake-same-files real-file-name source-file-name)
+	    (setq line-err-info (flymake-ler-set-file line-err-info nil))
+	  (setq line-err-info (flymake-ler-set-file line-err-info (file-name-nondirectory real-file-name))))
+
+	(setq err-info-list (flymake-add-err-info err-info-list line-err-info)))
+      (flymake-log 3 "parsed '%s', %s line-err-info" (nth idx lines) (if line-err-info "got" "no"))
+      (setq idx (1+ idx)))
+    err-info-list))
 
-(defun flymake-split-output(output)
-    "split output into lines, return last one as residual if it does not end with newline char. Returns ((lines) residual)"
-    (when (and output (> (length output) 0))
-	(let* ((lines (flymake-split-string output "[\n\r]+"))
-	       (complete (equal "\n" (char-to-string (aref output (1- (length output))))))
-	       (residual nil))
-	    (when (not complete)
-		(setq residual (car (last lines)))
-		(setq lines (butlast lines))
-	    )
-	    (list lines residual)
-	)
-    )
-)
+(defun flymake-split-output (output)
+  "Split OUTPUT into lines.
+Return last one as residual if it does not end with newline char. Returns ((lines) residual)."
+  (when (and output (> (length output) 0))
+    (let* ((lines (flymake-split-string output "[\n\r]+"))
+	   (complete (equal "\n" (char-to-string (aref output (1- (length output))))))
+	   (residual nil))
+      (when (not complete)
+	(setq residual (car (last lines)))
+	(setq lines (butlast lines)))
+      (list lines residual))))
 
-(defun flymake-reformat-err-line-patterns-from-compile-el(original-list)
-    "grab error line patterns from original list in compile.el format, convert to flymake internal format"
-	(let* ((converted-list '()))
-	(mapcar
-	    (lambda (item)
-			(setq item (cdr item))
-			(let ((regexp (nth 0 item))
-				  (file (nth 1 item))
-				  (line (nth 2 item))
-				  (col (nth 3 item))
-				  end-line)
-			  (if (consp file)	(setq file (car file)))
-			  (if (consp line)	(setq end-line (cdr line) line (car line)))
-			  (if (consp col)	(setq col (car col)))
+(defun flymake-reformat-err-line-patterns-from-compile-el (original-list)
+  "Grab error line patterns from ORIGINAL-LIST in compile.el format.
+Convert it to flymake internal format."
+  (let* ((converted-list '()))
+    (mapcar
+     (lambda (item)
+       (setq item (cdr item))
+       (let ((regexp (nth 0 item))
+	     (file (nth 1 item))
+	     (line (nth 2 item))
+	     (col (nth 3 item))
+	     end-line)
+	 (if (consp file)	(setq file (car file)))
+	 (if (consp line)	(setq end-line (cdr line) line (car line)))
+	 (if (consp col)	(setq col (car col)))
 
-			  (when (not (functionp line))
-				  (setq converted-list (cons (list regexp file line col) converted-list))
-			  )
-		   )
-		)
-		original-list
-	)
-	converted-list
-   )
-)
+	 (when (not (functionp line))
+	   (setq converted-list (cons (list regexp file line col) converted-list)))))
+     original-list)
+    converted-list))
+
+(eval-when-compile
+  (require 'compile))
 
-(require 'compile)
-(defvar flymake-err-line-patterns  ; regexp file-idx line-idx col-idx (optional) text-idx(optional), match-end to end of string is error text
-    (append
-     '(
-    ; MS Visual C++ 6.0
-       ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
-	1 3 nil 4)
-    ; jikes
-       ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\|Semantic Error\\):[ \t\n]*\\(.+\\)\\)"
-	1 3 nil 4)
-    ; MS midl
-       ("midl[ ]*:[ ]*\\(command line error .*\\)"
-	nil nil nil 1)
-    ; MS C#
-       ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\),[0-9]+)\: \\(\\(error\\|warning\\|fatal error\\) \\(CS[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
-	1 3 nil 4)
-    ; perl
-       ("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
-    ; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on input line \\([0-9]+\\)" 20 3 nil 1)
-    ; ant/javac
-	   (" *\\(\\[javac\\]\\)? *\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[ \t\n]*\\(.+\\)"
-	2 4 nil 5)
-      )
-	 ;; compilation-error-regexp-alist)
-     (flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist)) 
-    "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx). Use flymake-reformat-err-line-patterns-from-compile-el to add patterns from compile.el"
-)
-;(defcustom flymake-err-line-patterns
-;  '(
-;    ; MS Visual C++ 6.0
-;    ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
-;       1 3 4)
-;   ; jikes
-;   ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\):[ \t\n]*\\(.+\\)\\)"
-;       1 3 4))
-;    "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)"
-;   :group 'flymake
-;   :type '(repeat (string number number number))
-;)
+(defvar flymake-err-line-patterns ; regexp file-idx line-idx col-idx (optional) text-idx(optional), match-end to end of string is error text
+  (append
+   '(
+					; MS Visual C++ 6.0
+     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
+      1 3 nil 4)
+					; jikes
+     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\|Semantic Error\\):[ \t\n]*\\(.+\\)\\)"
+      1 3 nil 4)
+					; MS midl
+     ("midl[ ]*:[ ]*\\(command line error .*\\)"
+      nil nil nil 1)
+					; MS C#
+     ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\),[0-9]+)\: \\(\\(error\\|warning\\|fatal error\\) \\(CS[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
+      1 3 nil 4)
+					; perl
+     ("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
+					; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on input line \\([0-9]+\\)" 20 3 nil 1)
+					; ant/javac
+     (" *\\(\\[javac\\]\\)? *\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[ \t\n]*\\(.+\\)"
+      2 4 nil 5))
+   ;; compilation-error-regexp-alist)
+   (flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist))
+  "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx). Use flymake-reformat-err-line-patterns-from-compile-el to add patterns from compile.el")
 
-(defun flymake-parse-line(line)
-    "parse line to see whether it's an error of warning, return it's components or nil for no match"
-    (let ((raw-file-name nil)
-	  (line-no 0)
-	  (err-type "e")
-	  (err-text nil)
-	  (count (length flymake-err-line-patterns))
-	  (idx   0)
-	  (matched nil))
-	(while (and (< idx count) (not matched))
-	    (when (string-match (car (nth idx flymake-err-line-patterns)) line)
-		(let* ((file-idx (nth 1 (nth idx flymake-err-line-patterns)))
-		       (line-idx (nth 2 (nth idx flymake-err-line-patterns))))
+					;(defcustom flymake-err-line-patterns
+					;  '(
+					;    ; MS Visual C++ 6.0
+					;    ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
+					;       1 3 4)
+					;   ; jikes
+					;   ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\):[ \t\n]*\\(.+\\)\\)"
+					;       1 3 4))
+					;    "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)"
+					;   :group 'flymake
+					;   :type '(repeat (string number number number))
+					;)
 
-		    (setq raw-file-name (if file-idx (match-string file-idx line) nil))
-		    (setq line-no       (if line-idx (string-to-int (match-string line-idx line)) 0))
-		    (setq err-text      (if (> (length (nth idx flymake-err-line-patterns)) 4)
-					    (match-string (nth 4 (nth idx flymake-err-line-patterns)) line)
-					  (flymake-patch-err-text (substring line (match-end 0)))))
-		    (or err-text (setq err-text "<no error text>"))
-		    (if (and err-text (string-match "^[wW]arning" err-text))
-			(setq err-type "w")
-		    )
-		    (flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx
-				 raw-file-name line-no err-text)
-		    (setq matched t)
-		)
-	    )
-	    (setq idx (1+ idx))
-	)
-	(if matched
-	   (flymake-ler-make-ler raw-file-name line-no err-type err-text)
-	; else
-	   ()
-	)
-    )
-)
+(defun flymake-parse-line (line)
+  "Parse LINE to see if it is an error of warning.
+Return its components if so, nil if no."
+  (let ((raw-file-name nil)
+	(line-no 0)
+	(err-type "e")
+	(err-text nil)
+	(count (length flymake-err-line-patterns))
+	(idx   0)
+	(matched nil))
+    (while (and (< idx count) (not matched))
+      (when (string-match (car (nth idx flymake-err-line-patterns)) line)
+	(let* ((file-idx (nth 1 (nth idx flymake-err-line-patterns)))
+	       (line-idx (nth 2 (nth idx flymake-err-line-patterns))))
 
-(defun flymake-find-err-info(err-info-list line-no)
-    "find (line-err-info-list pos) for specified line-no"
-    (if err-info-list
-	(let* ((line-err-info-list  nil)
-	       (pos       0)
-	       (count     (length err-info-list)))
-
-	    (while (and (< pos count) (< (car (nth pos err-info-list)) line-no))
-		(setq pos (1+ pos))
-	    )
-	    (when (and (< pos count) (equal (car (nth pos err-info-list)) line-no))
-		(setq line-err-info-list (flymake-er-get-line-err-info-list (nth pos err-info-list)))
+	  (setq raw-file-name (if file-idx (match-string file-idx line) nil))
+	  (setq line-no       (if line-idx (string-to-int (match-string line-idx line)) 0))
+	  (setq err-text      (if (> (length (nth idx flymake-err-line-patterns)) 4)
+				  (match-string (nth 4 (nth idx flymake-err-line-patterns)) line)
+				(flymake-patch-err-text (substring line (match-end 0)))))
+	  (or err-text (setq err-text "<no error text>"))
+	  (if (and err-text (string-match "^[wW]arning" err-text))
+	      (setq err-type "w")
 	    )
-	    (list line-err-info-list pos)
-	)
-    ;else
-	'(nil 0)
-    )
-)
+	  (flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx
+		       raw-file-name line-no err-text)
+	  (setq matched t)))
+      (setq idx (1+ idx)))
+    (if matched
+	(flymake-ler-make-ler raw-file-name line-no err-type err-text)
+      ())))
+
+(defun flymake-find-err-info (err-info-list line-no)
+  "Find (line-err-info-list pos) for specified LINE-NO."
+  (if err-info-list
+      (let* ((line-err-info-list  nil)
+	     (pos       0)
+	     (count     (length err-info-list)))
 
-(defun flymake-line-err-info-is-less-or-equal(line-one line-two)
-    (or (string< (flymake-ler-get-type line-one) (flymake-ler-get-type line-two))
-	(and (string= (flymake-ler-get-type line-one) (flymake-ler-get-type line-two))
-	     (not (flymake-ler-get-file line-one)) (flymake-ler-get-file line-two)
-	)
-	(and (string= (flymake-ler-get-type line-one) (flymake-ler-get-type line-two))
-	     (or (and      (flymake-ler-get-file line-one)       (flymake-ler-get-file line-two))
-		 (and (not (flymake-ler-get-file line-one)) (not (flymake-ler-get-file line-two)))
-	     )
-	)
-    )
-)
+	(while (and (< pos count) (< (car (nth pos err-info-list)) line-no))
+	  (setq pos (1+ pos)))
+	(when (and (< pos count) (equal (car (nth pos err-info-list)) line-no))
+	  (setq line-err-info-list (flymake-er-get-line-err-info-list (nth pos err-info-list))))
+	(list line-err-info-list pos))
+    '(nil 0)))
 
-(defun flymake-add-line-err-info(line-err-info-list line-err-info)
-    "insert new err info favoring sorting: err-type e/w, filename nil/non-nill"
-    (if (not line-err-info-list)
-	(list line-err-info)
-    ;else
-	(let* ((count  (length line-err-info-list))
-	       (idx    0))
-	    (while (and (< idx count) (flymake-line-err-info-is-less-or-equal (nth idx line-err-info-list) line-err-info))
-		(setq idx (1+ idx))
-	    )
-	    (cond ((equal 0     idx)    (setq line-err-info-list (cons line-err-info line-err-info-list)))
-		  (t                    (setq line-err-info-list (flymake-ins-after line-err-info-list (1- idx) line-err-info)))
-	    )
-	    line-err-info-list
-	)
-    )
-)
+(defun flymake-line-err-info-is-less-or-equal (line-one line-two)
+  (or (string< (flymake-ler-get-type line-one) (flymake-ler-get-type line-two))
+      (and (string= (flymake-ler-get-type line-one) (flymake-ler-get-type line-two))
+	   (not (flymake-ler-get-file line-one)) (flymake-ler-get-file line-two))
+      (and (string= (flymake-ler-get-type line-one) (flymake-ler-get-type line-two))
+	   (or (and      (flymake-ler-get-file line-one)       (flymake-ler-get-file line-two))
+	       (and (not (flymake-ler-get-file line-one)) (not (flymake-ler-get-file line-two)))))))
+
+(defun flymake-add-line-err-info (line-err-info-list line-err-info)
+  "Insert new err info favoring sorting: err-type e/w, filename nil/non-nil."
+  (if (not line-err-info-list)
+      (list line-err-info)
+    (let* ((count  (length line-err-info-list))
+	   (idx    0))
+      (while (and (< idx count) (flymake-line-err-info-is-less-or-equal (nth idx line-err-info-list) line-err-info))
+	(setq idx (1+ idx)))
+      (cond ((equal 0     idx)    (setq line-err-info-list (cons line-err-info line-err-info-list)))
+	    (t                    (setq line-err-info-list (flymake-ins-after line-err-info-list (1- idx) line-err-info))))
+      line-err-info-list)))
 
-(defun flymake-add-err-info(err-info-list line-err-info)
-    "add error info (file line type text) to err info list preserving sort order"
-    (let* ((count               (length err-info-list))
-	   (line-no             (if (flymake-ler-get-file line-err-info) 1 (flymake-ler-get-line line-err-info)))
-	   (info-and-pos        (flymake-find-err-info err-info-list line-no))
-	   (exists              (car info-and-pos))
-	   (pos                 (nth 1 info-and-pos))
-	   (line-err-info-list  nil)
-	   (err-info            nil))
+(defun flymake-add-err-info (err-info-list line-err-info)
+  "Add error info (file line type text) to err info list preserving sort order."
+  (let* ((count               (length err-info-list))
+	 (line-no             (if (flymake-ler-get-file line-err-info) 1 (flymake-ler-get-line line-err-info)))
+	 (info-and-pos        (flymake-find-err-info err-info-list line-no))
+	 (exists              (car info-and-pos))
+	 (pos                 (nth 1 info-and-pos))
+	 (line-err-info-list  nil)
+	 (err-info            nil))
 
-	(if exists
-	    (setq line-err-info-list (flymake-er-get-line-err-info-list (car (nthcdr pos err-info-list))))
-	)
-	(setq line-err-info-list (flymake-add-line-err-info line-err-info-list line-err-info))
+    (if exists
+	(setq line-err-info-list (flymake-er-get-line-err-info-list (car (nthcdr pos err-info-list)))))
+    (setq line-err-info-list (flymake-add-line-err-info line-err-info-list line-err-info))
 
-	(setq err-info (flymake-er-make-er line-no line-err-info-list))
-	(cond (exists             (setq err-info-list (flymake-set-at err-info-list pos err-info)))
-	      ((equal 0 pos)      (setq err-info-list (cons err-info err-info-list)))
-	      (t                  (setq err-info-list (flymake-ins-after err-info-list (1- pos) err-info)))
-	)
-	err-info-list
-    )
-)
+    (setq err-info (flymake-er-make-er line-no line-err-info-list))
+    (cond (exists             (setq err-info-list (flymake-set-at err-info-list pos err-info)))
+	  ((equal 0 pos)      (setq err-info-list (cons err-info err-info-list)))
+	  (t                  (setq err-info-list (flymake-ins-after err-info-list (1- pos) err-info))))
+    err-info-list))
 
-(defun flymake-get-project-include-dirs-imp(basedir)
-    "include dirs for the project current file belongs to"
-    (if (flymake-get-project-include-dirs-from-cache basedir)
-	(progn
-	    (flymake-get-project-include-dirs-from-cache basedir)
-	)
-    ;else
-	(let* ((command-line  (concat "make -C\"" basedir "\" DUMPVARS=INCLUDE_DIRS dumpvars"))
-	       (output        (shell-command-to-string command-line))
-	       (lines         (flymake-split-string output "\n"))
-	       (count         (length lines))
-	       (idx           0)
-	       (inc-dirs      nil))
-	    (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines))))
-	       (setq idx (1+ idx))
-	    )
-	    (when (< idx count)
-		(let* ((inc-lines  (flymake-split-string (nth idx lines) " *-I"))
-		       (inc-count  (length inc-lines)))
-		    (while (> inc-count 0)
-			(when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines)))
-			    (setq inc-dirs (cons (flymake-replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs))
-			)
-			(setq inc-count (1- inc-count))
-		    )
-		)
-	    )
-	    (flymake-add-project-include-dirs-to-cache basedir inc-dirs)
-	    inc-dirs
-	)
-    )
-)
+(defun flymake-get-project-include-dirs-imp (basedir)
+  "Include dirs for the project current file belongs to."
+  (if (flymake-get-project-include-dirs-from-cache basedir)
+      (progn
+	(flymake-get-project-include-dirs-from-cache basedir))
+					;else
+    (let* ((command-line  (concat "make -C\"" basedir "\" DUMPVARS=INCLUDE_DIRS dumpvars"))
+	   (output        (shell-command-to-string command-line))
+	   (lines         (flymake-split-string output "\n"))
+	   (count         (length lines))
+	   (idx           0)
+	   (inc-dirs      nil))
+      (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines))))
+	(setq idx (1+ idx)))
+      (when (< idx count)
+	(let* ((inc-lines  (flymake-split-string (nth idx lines) " *-I"))
+	       (inc-count  (length inc-lines)))
+	  (while (> inc-count 0)
+	    (when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines)))
+	      (setq inc-dirs (cons (flymake-replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs)))
+	    (setq inc-count (1- inc-count)))))
+      (flymake-add-project-include-dirs-to-cache basedir inc-dirs)
+      inc-dirs)))
 
 (defcustom flymake-get-project-include-dirs-function 'flymake-get-project-include-dirs-imp
-    "function used to get project inc dirs, one paramater: basedir name"
-    :group 'flymake
-    :type 'function
-)
+  "Function used to get project inc dirs, one paramater: basedir name."
+  :group 'flymake
+  :type 'function)
 
-(defun flymake-get-project-include-dirs(basedir)
-    (funcall flymake-get-project-include-dirs-function basedir)
-)
+(defun flymake-get-project-include-dirs (basedir)
+  (funcall flymake-get-project-include-dirs-function basedir))
 
-(defun flymake-get-system-include-dirs()
-    "system include dirs - from the 'INCLUDE' env setting"
-    (let* ((includes (getenv "INCLUDE")))
-	(if includes (flymake-split-string includes path-separator) nil)
-    )
-)
+(defun flymake-get-system-include-dirs ()
+  "System include dirs - from the 'INCLUDE' env setting."
+  (let* ((includes (getenv "INCLUDE")))
+    (if includes (flymake-split-string includes path-separator) nil)))
 
 (defvar flymake-project-include-dirs-cache (flymake-makehash 'equal))
-(defun flymake-get-project-include-dirs-from-cache(base-dir)
-    (gethash base-dir flymake-project-include-dirs-cache)
-)
-(defun flymake-add-project-include-dirs-to-cache(base-dir include-dirs)
-    (puthash base-dir include-dirs flymake-project-include-dirs-cache)
-)
-(defun flymake-clear-project-include-dirs-cache()
-    (clrhash flymake-project-include-dirs-cache)
-)
+
+(defun flymake-get-project-include-dirs-from-cache (base-dir)
+  (gethash base-dir flymake-project-include-dirs-cache))
+
+(defun flymake-add-project-include-dirs-to-cache (base-dir include-dirs)
+  (puthash base-dir include-dirs flymake-project-include-dirs-cache))
+
+(defun flymake-clear-project-include-dirs-cache ()
+  (clrhash flymake-project-include-dirs-cache))
 
-(defun flymake-get-include-dirs(base-dir)
-    "dirs to use when resolving local filenames"
-    (let* ((include-dirs (append '(".") (flymake-get-project-include-dirs base-dir) (flymake-get-system-include-dirs))))
-	include-dirs
-    )
-)
+(defun flymake-get-include-dirs (base-dir)
+  "Get dirs to use when resolving local file names."
+  (let* ((include-dirs (append '(".") (flymake-get-project-include-dirs base-dir) (flymake-get-system-include-dirs))))
+    include-dirs))
 
-(defun flymake-find-file(rel-file-name include-dirs)
-    "iterate through include-dirs, return first 'include-dir/rel-file-name' that exists, or just rel-file-name if not"
-    (let* ((count          (length include-dirs))
-	   (idx            0)
-	   (found          nil)
-	   (full-file-name rel-file-name))
+(defun flymake-find-file (rel-file-name include-dirs)
+  "Iterate through include-dirs to find file REL-FILE-NAME.
+Return first 'INCLUDE-DIRS/REL-FILE-NAME' that exists,  or just REL-FILE-NAME if not."
+  (let* ((count          (length include-dirs))
+	 (idx            0)
+	 (found          nil)
+	 (full-file-name rel-file-name))
 
-	(while (and (not found) (< idx count))
-	    (let* ((dir (nth idx include-dirs)))
-		(setq full-file-name  (concat dir "/" rel-file-name))
-		(when (file-exists-p full-file-name)
-		    (setq found t)
-		)
-	    )
-	    (setq idx (1+ idx))
-	)
-	(if found
-	    full-file-name
-	;else
-	    rel-file-name
-	)
-    )
-)
+    (while (and (not found) (< idx count))
+      (let* ((dir (nth idx include-dirs)))
+	(setq full-file-name  (concat dir "/" rel-file-name))
+	(when (file-exists-p full-file-name)
+	  (setq found t)))
+      (setq idx (1+ idx)))
+    (if found
+	full-file-name
+      rel-file-name)))
 
-(defun flymake-restore-formatting(source-buffer)
-    "Remove any formatting made by flymake"
-)
+(defun flymake-restore-formatting (source-buffer)
+  "Remove any formatting made by flymake."
+  )
 
-(defun flymake-get-program-dir(buffer)
-    "dir to start profram in"
-    (unless (bufferp buffer)
-	(error "invlid buffer")
-    )
-    (save-excursion
-	(set-buffer buffer)
-	default-directory
-    )
-)
+(defun flymake-get-program-dir (buffer)
+  "Get dir to start program in."
+  (unless (bufferp buffer)
+    (error "Invlid buffer"))
+  (save-excursion
+    (set-buffer buffer)
+    default-directory))
 
-(defun flymake-safe-delete-file(file-name)
-    (when (and file-name (file-exists-p file-name))
-	(delete-file file-name)
-	(flymake-log 1 "deleted file %s" file-name)
-    )
-)
+(defun flymake-safe-delete-file (file-name)
+  (when (and file-name (file-exists-p file-name))
+    (delete-file file-name)
+    (flymake-log 1 "deleted file %s" file-name)))
 
-(defun flymake-safe-delete-directory(dir-name)
-    (condition-case err
-	(progn
-	    (delete-directory dir-name)
-	    (flymake-log 1 "deleted dir %s" dir-name)
-	)
-	(error
-	    (flymake-log 1 "failed to delete dir %s, error ignored" dir-name)
-	)
-    )
-)
+(defun flymake-safe-delete-directory (dir-name)
+  (condition-case err
+      (progn
+	(delete-directory dir-name)
+	(flymake-log 1 "deleted dir %s" dir-name))
+    (error
+     (flymake-log 1 "Failed to delete dir %s, error ignored" dir-name))))
 
 (defcustom flymake-compilation-prevents-syntax-check t
-    "if non-nil, syntax check won't be started in case compilation is running"
-    :group 'flymake
-    :type 'boolean
-)
-
-(defun flymake-start-syntax-check(buffer)
-    "start syntax checking for buffer"
-    (unless (bufferp buffer)
-	(error "expected a buffer")
-    )
-    (save-excursion
-	(set-buffer buffer)
-	(flymake-log 3 "flymake is running: %s" (flymake-get-buffer-is-running buffer))
-	(when (and (not (flymake-get-buffer-is-running buffer))
-		   (flymake-can-syntax-check-file (buffer-file-name buffer)))
-	    (when (or (not flymake-compilation-prevents-syntax-check)
-		    (not (flymake-compilation-is-running))) ;+ (flymake-rep-ort-status buffer "COMP")
-		(flymake-clear-buildfile-cache)
-		(flymake-clear-project-include-dirs-cache)
-
-		(flymake-set-buffer-check-was-interrupted buffer nil)
-		(flymake-set-buffer-data buffer (flymake-makehash 'equal))
+  "If non-nil, syntax check won't be started in case compilation is running."
+  :group 'flymake
+  :type 'boolean)
 
-		(let* ((source-file-name  (buffer-file-name buffer))
-		       (init-f (flymake-get-init-function source-file-name))
-		       (cleanup-f (flymake-get-cleanup-function source-file-name))
-		       (cmd-and-args (funcall init-f buffer))
-		       (cmd          (nth 0 cmd-and-args))
-		       (args         (nth 1 cmd-and-args))
-					   (dir          (nth 2 cmd-and-args)))
-		    (if (not cmd-and-args)
-			(progn
-			    (flymake-log 0 "init function %s for %s failed, cleaning up" init-f source-file-name)
-			    (funcall cleanup-f buffer)
-			)
-		    ;else
-			(progn
-			    (flymake-set-buffer-last-change-time buffer nil)
-			    (flymake-start-syntax-check-process buffer cmd args dir)
-			)
-		    )
-		)
-	    )
-	)
-    )
-)
+(defun flymake-start-syntax-check (buffer)
+  "Start syntax checking for buffer BUFFER."
+  (unless (bufferp buffer)
+    (error "Expected a buffer"))
+  (save-excursion
+    (set-buffer buffer)
+    (flymake-log 3 "flymake is running: %s" (flymake-get-buffer-is-running buffer))
+    (when (and (not (flymake-get-buffer-is-running buffer))
+	       (flymake-can-syntax-check-file (buffer-file-name buffer)))
+      (when (or (not flymake-compilation-prevents-syntax-check)
+		(not (flymake-compilation-is-running)))	;+ (flymake-rep-ort-status buffer "COMP")
+	(flymake-clear-buildfile-cache)
+	(flymake-clear-project-include-dirs-cache)
 
-(defun flymake-start-syntax-check-process(buffer cmd args dir)
-    "start syntax check-process"
+	(flymake-set-buffer-check-was-interrupted buffer nil)
+	(flymake-set-buffer-data buffer (flymake-makehash 'equal))
 
-    (let* ((process nil))
-	(condition-case err
+	(let* ((source-file-name  (buffer-file-name buffer))
+	       (init-f (flymake-get-init-function source-file-name))
+	       (cleanup-f (flymake-get-cleanup-function source-file-name))
+	       (cmd-and-args (funcall init-f buffer))
+	       (cmd          (nth 0 cmd-and-args))
+	       (args         (nth 1 cmd-and-args))
+	       (dir          (nth 2 cmd-and-args)))
+	  (if (not cmd-and-args)
+	      (progn
+		(flymake-log 0 "init function %s for %s failed, cleaning up" init-f source-file-name)
+		(funcall cleanup-f buffer))
 	    (progn
-			    (when dir
-					(let ((default-directory dir))
-					    (flymake-log 3 "starting process on dir %s" default-directory)
-					)
-				)
-				(setq process (get-process (apply 'start-process "flymake-proc" nil cmd args)))
-		(set-process-sentinel process 'flymake-process-sentinel)
-		(set-process-filter process 'flymake-process-filter)
+	      (flymake-set-buffer-last-change-time buffer nil)
+	      (flymake-start-syntax-check-process buffer cmd args dir))))))))
 
-		(flymake-reg-names (process-id process) (buffer-name buffer))
+(defun flymake-start-syntax-check-process (buffer cmd args dir)
+  "Start syntax check process."
+  (let* ((process nil))
+    (condition-case err
+	(progn
+	  (when dir
+	    (let ((default-directory dir))
+	      (flymake-log 3 "starting process on dir %s" default-directory)))
+	  (setq process (get-process (apply 'start-process "flymake-proc" nil cmd args)))
+	  (set-process-sentinel process 'flymake-process-sentinel)
+	  (set-process-filter process 'flymake-process-filter)
 
-		(flymake-set-buffer-is-running buffer t)
-		(flymake-set-buffer-last-change-time buffer nil)
-		(flymake-set-buffer-check-start-time buffer (flymake-float-time))
+	  (flymake-reg-names (process-id process) (buffer-name buffer))
+
+	  (flymake-set-buffer-is-running buffer t)
+	  (flymake-set-buffer-last-change-time buffer nil)
+	  (flymake-set-buffer-check-start-time buffer (flymake-float-time))
 
-		(flymake-report-status buffer nil "*")
-		(flymake-log 2 "started process %d, command=%s, dir=%s"
-			   (process-id process) (process-command process) default-directory)
-		process
-	    )
-	    (error
-		(let* ((err-str (format "Failed to launch syntax check process '%s' with args %s: %s"
-			     cmd args (error-message-string err)))
-		      (source-file-name (buffer-file-name buffer))
-		      (cleanup-f        (flymake-get-cleanup-function source-file-name)))
-		    (flymake-log 0 err-str)
-		    (funcall cleanup-f buffer)
-		    (flymake-report-fatal-status buffer "PROCERR" err-str)
-		)
-	    )
-	)
-    )
-)
+	  (flymake-report-status buffer nil "*")
+	  (flymake-log 2 "started process %d, command=%s, dir=%s"
+		       (process-id process) (process-command process) default-directory)
+	  process)
+      (error
+       (let* ((err-str (format "Failed to launch syntax check process '%s' with args %s: %s"
+			       cmd args (error-message-string err)))
+	      (source-file-name (buffer-file-name buffer))
+	      (cleanup-f        (flymake-get-cleanup-function source-file-name)))
+	 (flymake-log 0 err-str)
+	 (funcall cleanup-f buffer)
+	 (flymake-report-fatal-status buffer "PROCERR" err-str))))))
 
-(defun flymake-kill-process(pid &optional rest)
-    "kill process pid"
-    (signal-process pid 9)
-    (let* ((buffer-name (flymake-get-source-buffer-name pid)))
-	(when (and buffer-name (get-buffer buffer-name))
-	    (flymake-set-buffer-check-was-interrupted (get-buffer buffer-name) t)
-	)
-    )
-    (flymake-log 1 "killed process %d" pid)
-)
+(defun flymake-kill-process (pid &optional rest)
+  "Kill process PID."
+  (signal-process pid 9)
+  (let* ((buffer-name (flymake-get-source-buffer-name pid)))
+    (when (and buffer-name (get-buffer buffer-name))
+      (flymake-set-buffer-check-was-interrupted (get-buffer buffer-name) t)))
+  (flymake-log 1 "killed process %d" pid))
 
-(defun flymake-stop-all-syntax-checks()
-    "kill all syntax check processes"
-    (interactive)
-    (let ((pids  (copy-hash-table flymake-pid-to-names)))
-	(maphash 'flymake-kill-process pids)
-    )
-)
+(defun flymake-stop-all-syntax-checks ()
+  "Kill all syntax check processes."
+  (interactive)
+  (let ((pids  (copy-hash-table flymake-pid-to-names)))
+    (maphash 'flymake-kill-process pids)))
 
-(defun flymake-compilation-is-running()
-   (and (boundp 'compilation-in-progress)
-	compilation-in-progress)
-)
+(defun flymake-compilation-is-running ()
+  (and (boundp 'compilation-in-progress)
+       compilation-in-progress))
 
-(defun flymake-compile()
-    "kill all flymake syntax checks, start compilation"
-    (interactive)
-    (flymake-stop-all-syntax-checks)
-    (call-interactively 'compile)
-)
+(defun flymake-compile ()
+  "Kill all flymake syntax checks, start compilation."
+  (interactive)
+  (flymake-stop-all-syntax-checks)
+  (call-interactively 'compile))
 
 (defvar flymake-is-running nil
-  "t if flymake syntax check process is running for the current buffer"
-)
+  "If t, flymake syntax check process is running for the current buffer")
+
 (make-variable-buffer-local 'flymake-is-running)
-(defun flymake-get-buffer-is-running(buffer)
-    (flymake-get-buffer-var buffer 'flymake-is-running)
-)
-(defun flymake-set-buffer-is-running(buffer is-running)
-    (flymake-set-buffer-var buffer 'flymake-is-running is-running)
-)
+
+(defun flymake-get-buffer-is-running (buffer)
+  (flymake-get-buffer-var buffer 'flymake-is-running))
+
+(defun flymake-set-buffer-is-running (buffer is-running)
+  (flymake-set-buffer-var buffer 'flymake-is-running is-running))
 
 (defvar flymake-timer nil
-    "timer for starting syntax checks"
-)
+  "Timer for starting syntax check.")
+
 (make-variable-buffer-local 'flymake-timer)
-(defun flymake-get-buffer-timer(buffer)
-    (flymake-get-buffer-var buffer 'flymake-timer)
-)
-(defun flymake-set-buffer-timer(buffer timer)
-    (flymake-set-buffer-var buffer 'flymake-timer timer)
-)
+
+(defun flymake-get-buffer-timer (buffer)
+  (flymake-get-buffer-var buffer 'flymake-timer))
+
+(defun flymake-set-buffer-timer (buffer timer)
+  (flymake-set-buffer-var buffer 'flymake-timer timer))
 
 (defvar flymake-last-change-time nil
-    "time of last buffer change"
-)
+  "Time of last buffer change.")
+
 (make-variable-buffer-local 'flymake-last-change-time)
-(defun flymake-get-buffer-last-change-time(buffer)
-    (flymake-get-buffer-var buffer 'flymake-last-change-time)
-)
-(defun flymake-set-buffer-last-change-time(buffer change-time)
-    (flymake-set-buffer-var buffer 'flymake-last-change-time change-time)
-)
+
+(defun flymake-get-buffer-last-change-time (buffer)
+  (flymake-get-buffer-var buffer 'flymake-last-change-time))
+
+(defun flymake-set-buffer-last-change-time (buffer change-time)
+  (flymake-set-buffer-var buffer 'flymake-last-change-time change-time))
 
 (defvar flymake-check-start-time nil
-    "time at which syntax check was started")
+  "Time at which syntax check was started.")
+
 (make-variable-buffer-local 'flymake-check-start-time)
-(defun flymake-get-buffer-check-start-time(buffer)
-    (flymake-get-buffer-var buffer 'flymake-check-start-time)
-)
-(defun flymake-set-buffer-check-start-time(buffer check-start-time)
-    (flymake-set-buffer-var buffer 'flymake-check-start-time check-start-time)
-)
+
+(defun flymake-get-buffer-check-start-time (buffer)
+  (flymake-get-buffer-var buffer 'flymake-check-start-time))
+
+(defun flymake-set-buffer-check-start-time (buffer check-start-time)
+  (flymake-set-buffer-var buffer 'flymake-check-start-time check-start-time))
 
 (defvar flymake-check-was-interrupted nil
-    "t if syntax check was killed by flymake-compile"
-)
+  "t if syntax check was killed by flymake-compile")
+
 (make-variable-buffer-local 'flymake-check-was-interrupted)
-(defun flymake-get-buffer-check-was-interrupted(buffer)
-    (flymake-get-buffer-var buffer 'flymake-check-was-interrupted)
-)
-(defun flymake-set-buffer-check-was-interrupted(buffer interrupted)
-    (flymake-set-buffer-var buffer 'flymake-check-was-interrupted interrupted)
-)
+
+(defun flymake-get-buffer-check-was-interrupted (buffer)
+  (flymake-get-buffer-var buffer 'flymake-check-was-interrupted))
+
+(defun flymake-set-buffer-check-was-interrupted (buffer interrupted)
+  (flymake-set-buffer-var buffer 'flymake-check-was-interrupted interrupted))
 
 (defcustom flymake-no-changes-timeout 0.5
-    "time to wait after last change before starting compilation"
-    :group 'flymake
-    :type 'number
-)
-
-(defun flymake-on-timer-event(buffer)
-    "start a syntax check for buffer if necessary"
-    ;+(flymake-log 3 "timer: running=%s, time=%s, cur-time=%s" (flymake-get-buffer-is-running buffer) (flymake-get-buffer-last-change-time buffer) (flymake-float-time))
+  "Time to wait after last change before starting compilation."
+  :group 'flymake
+  :type 'number)
 
-     (when (and (bufferp buffer) (not (flymake-get-buffer-is-running buffer)))
-	(save-excursion
-	    (set-buffer buffer)
-	    (when (and (flymake-get-buffer-last-change-time buffer)
-		       (> (flymake-float-time) (+ flymake-no-changes-timeout (flymake-get-buffer-last-change-time buffer))))
-		(flymake-set-buffer-last-change-time buffer nil)
-		(flymake-log 3 "starting syntax check as more than 1 second passed since last change")
-		(flymake-start-syntax-check buffer)
-	    )
-	)
-    )
-)
+(defun flymake-on-timer-event (buffer)
+  "Start a syntax check for buffer BUFFER if necessary."
+					;+(flymake-log 3 "timer: running=%s, time=%s, cur-time=%s" (flymake-get-buffer-is-running buffer) (flymake-get-buffer-last-change-time buffer) (flymake-float-time))
+  (when (and (bufferp buffer) (not (flymake-get-buffer-is-running buffer)))
+    (save-excursion
+      (set-buffer buffer)
+      (when (and (flymake-get-buffer-last-change-time buffer)
+		 (> (flymake-float-time) (+ flymake-no-changes-timeout (flymake-get-buffer-last-change-time buffer))))
+	(flymake-set-buffer-last-change-time buffer nil)
+	(flymake-log 3 "starting syntax check as more than 1 second passed since last change")
+	(flymake-start-syntax-check buffer)))))
 
-(defun flymake-start-syntax-check-for-current-buffer()
-    "run flymake-start-syntax-check for current buffer if it isn't already running"
-    (interactive)
-    (flymake-start-syntax-check (current-buffer))
-)
+(defun flymake-start-syntax-check-for-current-buffer ()
+  "Run 'flymake-start-syntax-check' for current buffer if it isn't already running."
+  (interactive)
+  (flymake-start-syntax-check (current-buffer)))
 
-(defun flymake-current-line-no()
-    "return number of current line in current buffer"
-    (interactive)
-    (let ((beg  (point-min))
-	  (end  (if (= (point) (point-max)) (point) (1+ (point)))))
-	(count-lines beg end)
-    )
-)
+(defun flymake-current-line-no ()
+  "Return number of current line in current buffer."
+  (interactive)
+  (let ((beg  (point-min))
+	(end  (if (= (point) (point-max)) (point) (1+ (point)))))
+    (count-lines beg end)))
 
-(defun flymake-get-line-count(buffer)
-    "return number of lines in buffer"
-    (unless (bufferp buffer)
-	(error "invalid buffer")
-    )
-    (save-excursion
-	(set-buffer buffer)
-	(count-lines (point-min) (point-max))
-    )
-)
+(defun flymake-get-line-count (buffer)
+  "Return number of lines in buffer BUFFER."
+  (unless (bufferp buffer)
+    (error "Invalid buffer"))
+  (save-excursion
+    (set-buffer buffer)
+    (count-lines (point-min) (point-max))))
 
-(defun flymake-count-lines(buffer)
-    "return number of lines in buffer"
-    (save-excursion
-	(set-buffer buffer)
-	(count-lines (point-min) (point-max))
-    )
-)
+(defun flymake-count-lines (buffer)
+  "Return number of lines in buffer BUFFER."
+  (save-excursion
+    (set-buffer buffer)
+    (count-lines (point-min) (point-max))))
 
-(defun flymake-get-point-pixel-pos()
-    "return point position in pixels: (x, y)"
-    (let ((mouse-pos  (mouse-position))
-	  (pixel-pos  nil)
-	  (ret        nil))
-	(if (car (cdr mouse-pos))
-	    (progn
-		(set-mouse-position (flymake-selected-frame) (current-column) (flymake-current-row))
-		(setq pixel-pos (mouse-pixel-position))
-		(set-mouse-position (car mouse-pos) (car (cdr mouse-pos)) (cdr (cdr mouse-pos)))
-		(setq ret (list (car (cdr pixel-pos)) (cdr (cdr pixel-pos))))
-	     )
-	;else
-	    (progn
-		(setq ret '(0 0))
-	    )
-	)
-	(flymake-log 3 "mouse pos is %s" ret)
-	ret
-    )
-)
+(defun flymake-get-point-pixel-pos ()
+  "Return point position in pixels: (x, y)."
+  (let ((mouse-pos  (mouse-position))
+	(pixel-pos  nil)
+	(ret        nil))
+    (if (car (cdr mouse-pos))
+	(progn
+	  (set-mouse-position (flymake-selected-frame) (current-column) (flymake-current-row))
+	  (setq pixel-pos (mouse-pixel-position))
+	  (set-mouse-position (car mouse-pos) (car (cdr mouse-pos)) (cdr (cdr mouse-pos)))
+	  (setq ret (list (car (cdr pixel-pos)) (cdr (cdr pixel-pos)))))
+      (progn
+	(setq ret '(0 0))))
+    (flymake-log 3 "mouse pos is %s" ret)
+    ret))
 
-(defun flymake-display-err-menu-for-current-line()
-   "Display a menu with errors/warnings for current line if it has errors and/or warnings"
-   (interactive)
-   (let* ((line-no             (flymake-current-line-no))
-	  (line-err-info-list  (nth 0 (flymake-find-err-info (flymake-get-buffer-err-info (current-buffer)) line-no)))
-	  (menu-data           (flymake-make-err-menu-data line-no line-err-info-list))
-	  (choice              nil)
-	  (mouse-pos           (flymake-get-point-pixel-pos))
-	  (moved-mouse-pos     (list (car mouse-pos) (+ 10 (car (cdr mouse-pos)))))
-	  (menu-pos            (list (flymake-get-point-pixel-pos) (selected-window))))
-       (if menu-data
-	   (progn
-	       (setq choice (flymake-popup-menu menu-pos menu-data))
-			   (flymake-log 3 "choice=%s" choice)
-	       (when choice
-			       (eval choice)
-		       )
-	    )
-       ;else
-	   (flymake-log 1 "no errors for line %d" line-no)
-       )
-   )
-)
+(defun flymake-display-err-menu-for-current-line ()
+  "Display a menu with errors/warnings for current line if it has errors and/or warnings."
+  (interactive)
+  (let* ((line-no             (flymake-current-line-no))
+	 (line-err-info-list  (nth 0 (flymake-find-err-info (flymake-get-buffer-err-info (current-buffer)) line-no)))
+	 (menu-data           (flymake-make-err-menu-data line-no line-err-info-list))
+	 (choice              nil)
+	 (mouse-pos           (flymake-get-point-pixel-pos))
+	 (moved-mouse-pos     (list (car mouse-pos) (+ 10 (car (cdr mouse-pos)))))
+	 (menu-pos            (list (flymake-get-point-pixel-pos) (selected-window))))
+    (if menu-data
+	(progn
+	  (setq choice (flymake-popup-menu menu-pos menu-data))
+	  (flymake-log 3 "choice=%s" choice)
+	  (when choice
+	    (eval choice)))
+      (flymake-log 1 "no errors for line %d" line-no))))
 
-(defun flymake-make-err-menu-data(line-no line-err-info-list)
-   "Make a (menu-title (item-title item-action)*) list with errors/warnings from line-err-info"
-   (let* ((menu-items  nil))
-       (when line-err-info-list
-	   (let* ((count           (length line-err-info-list))
-		  (menu-item-text  nil))
-	       (while (> count 0)
-		    (setq menu-item-text (flymake-ler-get-text (nth (1- count) line-err-info-list)))
-		    (let* ((file       (flymake-ler-get-file (nth (1- count) line-err-info-list)))
-			   (full-file  (flymake-ler-get-full-file (nth (1- count) line-err-info-list)))
-			   (line       (flymake-ler-get-line (nth (1- count) line-err-info-list))))
-			(if file
-			    (setq menu-item-text (concat menu-item-text " - " file "(" (format "%d" line) ")"))
-			)
-			(setq menu-items (cons (list menu-item-text
-						     (if file (list 'flymake-goto-file-and-line full-file line) nil))
-					       menu-items))
-		    )
-		    (setq count (1- count))
-	       )
-	       (flymake-log 3 "created menu-items with %d item(s)" (length menu-items))
-	   )
-       )
-       (if menu-items
-	   (let* ((menu-title  (format "Line %d: %d error(s), %d warning(s)" line-no
-				      (flymake-get-line-err-count line-err-info-list "e")
-				      (flymake-get-line-err-count line-err-info-list "w"))))
-	       (list menu-title menu-items)
-	   )
-       ;else
-	   nil
-       )
-   )
-)
+(defun flymake-make-err-menu-data (line-no line-err-info-list)
+  "Make a (menu-title (item-title item-action)*) list with errors/warnings from line-err-info."
+  (let* ((menu-items  nil))
+    (when line-err-info-list
+      (let* ((count           (length line-err-info-list))
+	     (menu-item-text  nil))
+	(while (> count 0)
+	  (setq menu-item-text (flymake-ler-get-text (nth (1- count) line-err-info-list)))
+	  (let* ((file       (flymake-ler-get-file (nth (1- count) line-err-info-list)))
+		 (full-file  (flymake-ler-get-full-file (nth (1- count) line-err-info-list)))
+		 (line       (flymake-ler-get-line (nth (1- count) line-err-info-list))))
+	    (if file
+		(setq menu-item-text (concat menu-item-text " - " file "(" (format "%d" line) ")")))
+	    (setq menu-items (cons (list menu-item-text
+					 (if file (list 'flymake-goto-file-and-line full-file line) nil))
+				   menu-items)))
+	  (setq count (1- count)))
+	(flymake-log 3 "created menu-items with %d item(s)" (length menu-items))))
+    (if menu-items
+	(let* ((menu-title  (format "Line %d: %d error(s), %d warning(s)" line-no
+				    (flymake-get-line-err-count line-err-info-list "e")
+				    (flymake-get-line-err-count line-err-info-list "w"))))
+	  (list menu-title menu-items))
+      nil)))
 
-(defun flymake-goto-file-and-line(file line)
-    "try to get buffer for file and goto line line in it"
-    (if (not (file-exists-p file))
-	(flymake-log 1 "file %s does not exists" file)
-    ;else
-	(progn
-	    (find-file file)
-	    (goto-line line)
-	)
-    )
-)
+(defun flymake-goto-file-and-line (file line)
+  "Try to get buffer for file and goto line line in it"
+  (if (not (file-exists-p file))
+      (flymake-log 1 "file %s does not exists" file)
+    (progn
+      (find-file file)
+      (goto-line line))))
+
 ;; flymake minor mode declarations
+(defvar flymake-mode nil)
 
-(defvar flymake-mode nil)
 (make-variable-buffer-local 'flymake-mode)
 
 (defvar flymake-mode-line nil
-    ""
-)
+  "")
+
 (make-variable-buffer-local 'flymake-mode-line)
-(defun flymake-get-buffer-mode-line(buffer)
-    (flymake-get-buffer-var buffer 'flymake-mode-line)
-)
-(defun flymake-set-buffer-mode-line(buffer mode-line-string)
-    (flymake-set-buffer-var buffer 'flymake-mode-line mode-line-string)
-)
+
+(defun flymake-get-buffer-mode-line (buffer)
+  (flymake-get-buffer-var buffer 'flymake-mode-line))
+
+(defun flymake-set-buffer-mode-line (buffer mode-line-string)
+  (flymake-set-buffer-var buffer 'flymake-mode-line mode-line-string))
 
 (defvar flymake-mode-line-e-w nil)
+
 (make-variable-buffer-local 'flymake-mode-line-e-w)
-(defun flymake-get-buffer-mode-line-e-w(buffer)
-    (flymake-get-buffer-var buffer 'flymake-mode-line-e-w)
-)
-(defun flymake-set-buffer-mode-line-e-w(buffer e-w)
-    (flymake-set-buffer-var buffer 'flymake-mode-line-e-w e-w)
-)
+
+(defun flymake-get-buffer-mode-line-e-w (buffer)
+  (flymake-get-buffer-var buffer 'flymake-mode-line-e-w))
+
+(defun flymake-set-buffer-mode-line-e-w (buffer e-w)
+  (flymake-set-buffer-var buffer 'flymake-mode-line-e-w e-w))
 
 (defvar flymake-mode-line-status nil)
+
 (make-variable-buffer-local 'flymake-mode-line-status)
-(defun flymake-get-buffer-mode-line-status(buffer)
-    (flymake-get-buffer-var buffer 'flymake-mode-line-status)
-)
-(defun flymake-set-buffer-mode-line-status(buffer status)
-    (flymake-set-buffer-var buffer 'flymake-mode-line-status status)
-)
+
+(defun flymake-get-buffer-mode-line-status (buffer)
+  (flymake-get-buffer-var buffer 'flymake-mode-line-status))
+
+(defun flymake-set-buffer-mode-line-status (buffer status)
+  (flymake-set-buffer-var buffer 'flymake-mode-line-status status))
 
-(defun flymake-report-status(buffer e-w &optional status)
-    "show status in the mode line"
-    (when (bufferp buffer)
-	(save-excursion
-	    (set-buffer buffer)
-	    (when e-w
-		(flymake-set-buffer-mode-line-e-w buffer e-w)
-	    )
-	    (when status
-		(flymake-set-buffer-mode-line-status buffer status)
-	    )
-	    (let* ((mode-line " Flymake"))
-		(when (> (length (flymake-get-buffer-mode-line-e-w buffer)) 0)
-		    (setq mode-line (concat mode-line ":"  (flymake-get-buffer-mode-line-e-w buffer)))
-		)
-		(setq mode-line (concat mode-line (flymake-get-buffer-mode-line-status buffer)))
-		(flymake-set-buffer-mode-line buffer mode-line)
-		(force-mode-line-update)
-	    )
+(defun flymake-report-status (buffer e-w &optional status)
+  "Show status in mode line."
+  (when (bufferp buffer)
+    (save-excursion
+      (set-buffer buffer)
+      (when e-w
+	(flymake-set-buffer-mode-line-e-w buffer e-w)
 	)
-    )
-)
+      (when status
+	(flymake-set-buffer-mode-line-status buffer status))
+      (let* ((mode-line " Flymake"))
+	(when (> (length (flymake-get-buffer-mode-line-e-w buffer)) 0)
+	  (setq mode-line (concat mode-line ":"  (flymake-get-buffer-mode-line-e-w buffer))))
+	(setq mode-line (concat mode-line (flymake-get-buffer-mode-line-status buffer)))
+	(flymake-set-buffer-mode-line buffer mode-line)
+	(force-mode-line-update)))))
 
-(defun flymake-display-warning(warning)
-    "display a warning to the user"
-    (message-box warning)
-)
+(defun flymake-display-warning (warning)
+  "Display a warning to user."
+  (message-box warning))
 
 (defcustom flymake-gui-warnings-enabled t
-    "enables/disables gui warnings"
-	:group 'flymake
-	:type 'boolean
-)
+  "Enables/disables gui warnings."
+  :group 'flymake
+  :type 'boolean)
 
-(defun flymake-report-fatal-status(buffer status warning)
-    "display a warning and switch flymake mode OFF"
-	(when flymake-gui-warnings-enabled
-	(flymake-display-warning (format "Flymake: %s. Flymake will be switched OFF" warning))
-	)
-    (save-excursion
-	(set-buffer buffer)
-	(flymake-mode 0)
-	(flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s"
-		     (buffer-name buffer) status warning)
+(defun flymake-report-fatal-status (buffer status warning)
+  "Display a warning and switch flymake mode off."
+  (when flymake-gui-warnings-enabled
+    (flymake-display-warning (format "Flymake: %s. Flymake will be switched OFF" warning))
     )
-)
+  (save-excursion
+    (set-buffer buffer)
+    (flymake-mode 0)
+    (flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s"
+		 (buffer-name buffer) status warning)))
 
-(defun flymake-mode(&optional arg)
-    "toggle flymake-mode"
-    (interactive)
-    (let ((old-flymake-mode flymake-mode)
-		  (turn-on nil))
+(defun flymake-mode (&optional arg)
+  "Toggle flymake mode on/off."
+  (interactive)
+  (let ((old-flymake-mode flymake-mode)
+	(turn-on nil))
 
-	(setq turn-on
-	    (if (null arg)
-		(not flymake-mode)
-	    ;else
-		(> (prefix-numeric-value arg) 0))
-	)
+    (setq turn-on
+	  (if (null arg)
+	      (not flymake-mode)
+					;else
+	    (> (prefix-numeric-value arg) 0)))
 
-	(if turn-on
-	    (if (flymake-can-syntax-check-file (buffer-file-name))
-		(flymake-mode-on)
-	    ;else
-		(flymake-log 2 "flymake cannot check syntax in buffer %s" (buffer-name))
-	    )
-	;else
-	    (flymake-mode-off)
-	)
-	(force-mode-line-update)
-    )
-)
+    (if turn-on
+	(if (flymake-can-syntax-check-file (buffer-file-name))
+	    (flymake-mode-on)
+	  (flymake-log 2 "flymake cannot check syntax in buffer %s" (buffer-name)))
+      (flymake-mode-off))
+    (force-mode-line-update)))
+
+(defcustom flymake-start-syntax-check-on-find-file t
+  "Start syntax check on find file."
+  :group 'flymake
+  :type 'boolean)
 
 ;;;###autoload
 (unless (assq 'flymake-mode minor-mode-alist)
-    (setq minor-mode-alist (cons '(flymake-mode flymake-mode-line) minor-mode-alist))
-)
+  (setq minor-mode-alist (cons '(flymake-mode flymake-mode-line) minor-mode-alist)))
 
 ;;;###autoload
-(defun flymake-mode-on()
-    "turn flymake mode on"
-    (when (not flymake-mode)
-	(make-local-variable 'after-change-functions)
-	(setq after-change-functions (cons 'flymake-after-change-function after-change-functions))
-	(add-hook 'after-save-hook 'flymake-after-save-hook)
-	(add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook)
-	;+(add-hook 'find-file-hooks 'flymake-find-file-hook)
+(defun flymake-mode-on ()
+  "Turn flymake mode on."
+  (when (not flymake-mode)
+    (make-local-variable 'after-change-functions)
+    (setq after-change-functions (cons 'flymake-after-change-function after-change-functions))
+    (add-hook 'after-save-hook 'flymake-after-save-hook)
+    (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook)
+					;+(add-hook 'find-file-hooks 'flymake-find-file-hook)
 
-	(flymake-report-status (current-buffer) "" "")
+    (flymake-report-status (current-buffer) "" "")
 
-	(flymake-set-buffer-timer (current-buffer) (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
+    (flymake-set-buffer-timer (current-buffer) (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
 
-	(setq flymake-mode t)
-	(flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name (current-buffer)))
-	(when flymake-start-syntax-check-on-find-file
-	    (flymake-start-syntax-check-for-current-buffer) ; will be started by on-load hook
-	)
-    )
-)
+    (setq flymake-mode t)
+    (flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name (current-buffer)))
+    (when flymake-start-syntax-check-on-find-file
+      (flymake-start-syntax-check-for-current-buffer)))) ; will be started by on-load hook
 
 ;;;###autoload
-(defun flymake-mode-off()
-    "turn flymake mode off"
-    (when flymake-mode
-	(setq after-change-functions (delq 'flymake-after-change-function  after-change-functions))
-	(remove-hook 'after-save-hook (function flymake-after-save-hook) t)
-	(remove-hook 'kill-buffer-hook (function flymake-kill-buffer-hook) t)
-	;+(remove-hook 'find-file-hooks (function flymake-find-file-hook) t)
-
-	(flymake-delete-own-overlays (current-buffer))
+(defun flymake-mode-off ()
+  "Turn flymake mode off."
+  (when flymake-mode
+    (setq after-change-functions (delq 'flymake-after-change-function  after-change-functions))
+    (remove-hook 'after-save-hook (function flymake-after-save-hook) t)
+    (remove-hook 'kill-buffer-hook (function flymake-kill-buffer-hook) t)
+					;+(remove-hook 'find-file-hooks (function flymake-find-file-hook) t)
 
-	(when (flymake-get-buffer-timer (current-buffer))
-	    (cancel-timer (flymake-get-buffer-timer (current-buffer)))
-	    (flymake-set-buffer-timer (current-buffer) nil)
-	)
+    (flymake-delete-own-overlays (current-buffer))
 
-	(flymake-set-buffer-is-running (current-buffer) nil)
+    (when (flymake-get-buffer-timer (current-buffer))
+      (cancel-timer (flymake-get-buffer-timer (current-buffer)))
+      (flymake-set-buffer-timer (current-buffer) nil))
 
-	(setq flymake-mode nil)
-	(flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name (current-buffer)))
-    )
-)
+    (flymake-set-buffer-is-running (current-buffer) nil)
+
+    (setq flymake-mode nil)
+    (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name (current-buffer)))))
 
 (defcustom flymake-start-syntax-check-on-newline t
-    "start syntax check if newline char was added/removed from the buffer"
-    :group 'flymake
-    :type 'boolean
-)
+  "Start syntax check if newline char was added/removed from the buffer."
+  :group 'flymake
+  :type 'boolean)
 
-(defun flymake-after-change-function(start stop len)
-    "Start syntax check for current buffer if it isn't already running"
-    ;+(flymake-log 0 "setting change time to %s" (flymake-float-time))
-    (let((new-text (buffer-substring start stop)))
-	(when (and flymake-start-syntax-check-on-newline (equal new-text "\n"))
-	    (flymake-log 3 "starting syntax check as new-line has been seen")
-	    (flymake-start-syntax-check-for-current-buffer)
-	)
-	(flymake-set-buffer-last-change-time (current-buffer) (flymake-float-time))
-    )
-)
+(defun flymake-after-change-function (start stop len)
+  "Start syntax check for current buffer if it isn't already running"
+					;+(flymake-log 0 "setting change time to %s" (flymake-float-time))
+  (let((new-text (buffer-substring start stop)))
+    (when (and flymake-start-syntax-check-on-newline (equal new-text "\n"))
+      (flymake-log 3 "starting syntax check as new-line has been seen")
+      (flymake-start-syntax-check-for-current-buffer))
+    (flymake-set-buffer-last-change-time (current-buffer) (flymake-float-time))))
 
-(defun flymake-after-save-hook()
-    (if (local-variable-p 'flymake-mode (current-buffer)) ; (???) other way to determine whether flymake is active in buffer being saved?
-	(progn
-	    (flymake-log 3 "starting syntax check as buffer was saved")
-	    (flymake-start-syntax-check-for-current-buffer) ; no more mode 3. cannot start check if mode 3 (to temp copies) is active - (???)
-	)
-    )
-)
+(defun flymake-after-save-hook ()
+  (if (local-variable-p 'flymake-mode (current-buffer))	; (???) other way to determine whether flymake is active in buffer being saved?
+      (progn
+	(flymake-log 3 "starting syntax check as buffer was saved")
+	(flymake-start-syntax-check-for-current-buffer)))) ; no more mode 3. cannot start check if mode 3 (to temp copies) is active - (???)
 
-(defun flymake-kill-buffer-hook()
-    (when (flymake-get-buffer-timer (current-buffer))
-	(cancel-timer (flymake-get-buffer-timer (current-buffer)))
-	(flymake-set-buffer-timer (current-buffer) nil)
-    )
-)
-
-(defcustom flymake-start-syntax-check-on-find-file t
-    "statr syntax check on find file"
-    :group 'flymake
-    :type 'boolean
-)
+(defun flymake-kill-buffer-hook ()
+  (when (flymake-get-buffer-timer (current-buffer))
+    (cancel-timer (flymake-get-buffer-timer (current-buffer)))
+    (flymake-set-buffer-timer (current-buffer) nil)))
 
-(defun flymake-find-file-hook()
-    ;+(when flymake-start-syntax-check-on-find-file
-    ;+    (flymake-log 3 "starting syntax check on file open")
-    ;+    (flymake-start-syntax-check-for-current-buffer)
-    ;+)
-    (when (and (not (local-variable-p 'flymake-mode (current-buffer)))
-	   (flymake-can-syntax-check-file (buffer-file-name (current-buffer))))
-	(flymake-mode)
-	(flymake-log 3 "automatically turned ON flymake mode")
-    )
-)
+(defun flymake-find-file-hook ()
+					;+(when flymake-start-syntax-check-on-find-file
+					;+    (flymake-log 3 "starting syntax check on file open")
+					;+    (flymake-start-syntax-check-for-current-buffer)
+					;+)
+  (when (and (not (local-variable-p 'flymake-mode (current-buffer)))
+	     (flymake-can-syntax-check-file (buffer-file-name (current-buffer))))
+    (flymake-mode)
+    (flymake-log 3 "automatically turned ON flymake mode")))
 
-(defun flymake-get-first-err-line-no(err-info-list)
-    "return first line-no with error"
-    (when err-info-list
-	(flymake-er-get-line (car err-info-list))
-    )
-)
+(defun flymake-get-first-err-line-no (err-info-list)
+  "Return first line with error."
+  (when err-info-list
+    (flymake-er-get-line (car err-info-list))))
 
-(defun flymake-get-last-err-line-no(err-info-list)
-    "return last line-no with error"
-    (when err-info-list
-	(flymake-er-get-line (nth (1- (length err-info-list)) err-info-list))
-    )
-)
+(defun flymake-get-last-err-line-no (err-info-list)
+  "Return last line with error."
+  (when err-info-list
+    (flymake-er-get-line (nth (1- (length err-info-list)) err-info-list))))
 
-(defun flymake-get-next-err-line-no(err-info-list line-no)
-    "return next line with erroe"
-    (when err-info-list
-	(let* ((count  (length err-info-list))
-	       (idx    0))
-	    (while (and (< idx count) (>= line-no (flymake-er-get-line (nth idx err-info-list))))
-		(setq idx (1+ idx))
-	    )
-	    (if (< idx count)
-		(flymake-er-get-line (nth idx err-info-list))
-	    )
-	)
-    )
-)
+(defun flymake-get-next-err-line-no (err-info-list line-no)
+  "Return next line with error."
+  (when err-info-list
+    (let* ((count  (length err-info-list))
+	   (idx    0))
+      (while (and (< idx count) (>= line-no (flymake-er-get-line (nth idx err-info-list))))
+	(setq idx (1+ idx)))
+      (if (< idx count)
+	  (flymake-er-get-line (nth idx err-info-list))))))
 
-(defun flymake-get-prev-err-line-no(err-info-list line-no)
-    "return prev line with error"
-    (when err-info-list
-	(let* ((count (length err-info-list)))
-	    (while (and (> count 0) (<= line-no (flymake-er-get-line (nth (1- count) err-info-list))))
-		(setq count (1- count))
-	    )
-	    (if (> count 0)
-		(flymake-er-get-line (nth (1- count) err-info-list))
-	    )
-	)
-    )
-)
+(defun flymake-get-prev-err-line-no (err-info-list line-no)
+  "Return prev line with error."
+  (when err-info-list
+    (let* ((count (length err-info-list)))
+      (while (and (> count 0) (<= line-no (flymake-er-get-line (nth (1- count) err-info-list))))
+	(setq count (1- count)))
+      (if (> count 0)
+	  (flymake-er-get-line (nth (1- count) err-info-list))))))
 
-(defun flymake-skip-whitespace()
-    "move forward until nonwhitespace is reached"
-    (while (looking-at "[ \t]")
-	(forward-char)
-    )
-)
+(defun flymake-skip-whitespace ()
+  "Move forward until non-whitespace is reached."
+  (while (looking-at "[ \t]")
+    (forward-char)))
 
-(defun flymake-goto-line(line-no)
-    "goto-line, then skip whitespace"
-    (goto-line line-no)
-    (flymake-skip-whitespace)
-)
+(defun flymake-goto-line (line-no)
+  "goto-line, then skip whitespace"
+  (goto-line line-no)
+  (flymake-skip-whitespace))
 
-(defun flymake-goto-next-error()
-    "go to next error in err ring"
-    (interactive)
-    (let ((line-no (flymake-get-next-err-line-no (flymake-get-buffer-err-info (current-buffer)) (flymake-current-line-no))))
-	(when (not line-no)
-	    (setq line-no (flymake-get-first-err-line-no (flymake-get-buffer-err-info (current-buffer))))
-	    (flymake-log 1 "passed end of file")
-	)
-	(if line-no
-	    (flymake-goto-line line-no)
-	;else
-	    (flymake-log 1 "no errors in current buffer")
-	)
-    )
-)
+(defun flymake-goto-next-error ()
+  "go to next error in err ring"
+  (interactive)
+  (let ((line-no (flymake-get-next-err-line-no (flymake-get-buffer-err-info (current-buffer)) (flymake-current-line-no))))
+    (when (not line-no)
+      (setq line-no (flymake-get-first-err-line-no (flymake-get-buffer-err-info (current-buffer))))
+      (flymake-log 1 "passed end of file"))
+    (if line-no
+	(flymake-goto-line line-no)
+      (flymake-log 1 "no errors in current buffer"))))
 
-(defun flymake-goto-prev-error()
-    "go to prev error in err ring"
-    (interactive)
-    (let ((line-no (flymake-get-prev-err-line-no (flymake-get-buffer-err-info (current-buffer)) (flymake-current-line-no))))
-	(when (not line-no)
-	    (setq line-no (flymake-get-last-err-line-no (flymake-get-buffer-err-info (current-buffer))))
-	    (flymake-log 1 "passed beginning of file")
-	)
-	(if line-no
-	    (flymake-goto-line line-no)
-	;else
-	    (flymake-log 1 "no errors in current buffer")
-	)
-    )
-)
+(defun flymake-goto-prev-error ()
+  "go to prev error in err ring"
+  (interactive)
+  (let ((line-no (flymake-get-prev-err-line-no (flymake-get-buffer-err-info (current-buffer)) (flymake-current-line-no))))
+    (when (not line-no)
+      (setq line-no (flymake-get-last-err-line-no (flymake-get-buffer-err-info (current-buffer))))
+      (flymake-log 1 "passed beginning of file"))
+    (if line-no
+	(flymake-goto-line line-no)
+      (flymake-log 1 "no errors in current buffer"))))
 
-(defun flymake-patch-err-text(string)
-    (if (string-match "^[\n\t :0-9]*\\(.*\\)$" string)
-	(match-string 1 string)
-    ;else
-	string
-    )
-)
+(defun flymake-patch-err-text (string)
+  (if (string-match "^[\n\t :0-9]*\\(.*\\)$" string)
+      (match-string 1 string)
+    string))
 
 ;;;; general init-cleanup and helper routines
+(defun flymake-create-temp-inplace (file-name prefix)
+  (unless (stringp file-name)
+    (error "Invalid file-name"))
+  (or prefix
+      (setq prefix "flymake"))
+  (let* ((temp-name   (concat (file-name-sans-extension file-name)
+			      "_" prefix
+			      (and (file-name-extension file-name)
+				   (concat "." (file-name-extension file-name))))))
+    (flymake-log 3 "create-temp-inplace: file=%s temp=%s" file-name temp-name)
+    temp-name))
 
-(defun flymake-create-temp-inplace(file-name prefix)
-    (unless (stringp file-name)
-	(error "invalid file-name")
-    )
-    (or prefix
-	(setq prefix "flymake")
-    )
-    (let* ((temp-name   (concat (file-name-sans-extension file-name)
-				"_" prefix
-				(and (file-name-extension file-name)
-				     (concat "." (file-name-extension file-name))))))
-	(flymake-log 3 "create-temp-inplace: file=%s temp=%s" file-name temp-name)
-	temp-name
-    )
-)
-
-(defun flymake-create-temp-with-folder-structure(file-name prefix)
-    (unless (stringp file-name)
-	(error "invalid file-name")
-    )
+(defun flymake-create-temp-with-folder-structure (file-name prefix)
+  (unless (stringp file-name)
+    (error "Invalid file-name"))
 
-    (let* ((dir       (file-name-directory file-name))
-		   (slash-pos (string-match "/" dir))
-		   (temp-dir  (concat (flymake-ensure-ends-with-slash (flymake-get-temp-dir)) (substring dir (1+ slash-pos)))))
+  (let* ((dir       (file-name-directory file-name))
+	 (slash-pos (string-match "/" dir))
+	 (temp-dir  (concat (flymake-ensure-ends-with-slash (flymake-get-temp-dir)) (substring dir (1+ slash-pos)))))
 
-	    (file-truename (concat (flymake-ensure-ends-with-slash temp-dir)
-				(file-name-nondirectory file-name)))
-    )
-)
+    (file-truename (concat (flymake-ensure-ends-with-slash temp-dir)
+			   (file-name-nondirectory file-name)))))
 
-(defun flymake-strrchr(str ch)
-    (let* ((count  (length str))
-	   (pos    nil))
-	(while (and (not pos) (> count 0))
-	    (if (= ch (elt str (1- count)))
-		(setq pos (1- count))
-	    )
-	    (setq count (1- count))
-	)
-	pos
-    )
-)
+(defun flymake-strrchr (str ch)
+  (let* ((count  (length str))
+	 (pos    nil))
+    (while (and (not pos) (> count 0))
+      (if (= ch (elt str (1- count)))
+	  (setq pos (1- count)))
+      (setq count (1- count)))
+    pos))
 
-(defun flymake-delete-temp-directory(dir-name)
-    "attempt to delete temp dir created by flymake-create-temp-with-folder-structure, do not fail on error"
-    (let* ((temp-dir    (flymake-get-temp-dir))
-	   (suffix      (substring dir-name (1+ (length temp-dir))))
-	   (slash-pos   nil))
+(defun flymake-delete-temp-directory (dir-name)
+  "attempt to delete temp dir created by flymake-create-temp-with-folder-structure, do not fail on error."
+  (let* ((temp-dir    (flymake-get-temp-dir))
+	 (suffix      (substring dir-name (1+ (length temp-dir))))
+	 (slash-pos   nil))
 
-	(while (> (length suffix) 0)
-	    ;+(flymake-log 0 "suffix=%s" suffix)
-			(flymake-safe-delete-directory (file-truename (concat (flymake-ensure-ends-with-slash temp-dir) suffix)))
-	    (setq slash-pos (flymake-strrchr suffix (string-to-char "/")))
-	    (if slash-pos
-		(setq suffix (substring suffix 0 slash-pos))
-	    ;else
-		(setq suffix "")
-	    )
-	)
-    )
-)
+    (while (> (length suffix) 0)
+					;+(flymake-log 0 "suffix=%s" suffix)
+      (flymake-safe-delete-directory (file-truename (concat (flymake-ensure-ends-with-slash temp-dir) suffix)))
+      (setq slash-pos (flymake-strrchr suffix (string-to-char "/")))
+      (if slash-pos
+	  (setq suffix (substring suffix 0 slash-pos))
+	(setq suffix "")))))
 
-(defun flymake-init-create-temp-buffer-copy(buffer create-temp-f)
-    "make a temporary copy of the current buffer, save its name in buffer data and return the name"
-    (let*  ((source-file-name       (buffer-file-name buffer))
-	    (temp-source-file-name  (funcall create-temp-f source-file-name "flymake")))
+(defun flymake-init-create-temp-buffer-copy (buffer create-temp-f)
+  "Make a temporary copy of the current buffer, save its name in buffer data and return the name."
+  (let*  ((source-file-name       (buffer-file-name buffer))
+	  (temp-source-file-name  (funcall create-temp-f source-file-name "flymake")))
 
-	(flymake-save-buffer-in-file buffer temp-source-file-name)
-	(flymake-set-buffer-value buffer "temp-source-file-name" temp-source-file-name)
-
-	temp-source-file-name
-    )
-)
+    (flymake-save-buffer-in-file buffer temp-source-file-name)
+    (flymake-set-buffer-value buffer "temp-source-file-name" temp-source-file-name)
+    temp-source-file-name))
 
-(defun flymake-simple-cleanup(buffer)
-    "cleanup after flymake-init-create-temp-buffer-copy -- delete temp file"
-    (let* ((temp-source-file-name (flymake-get-buffer-value buffer "temp-source-file-name")))
-	(flymake-safe-delete-file temp-source-file-name)
-	(flymake-set-buffer-last-change-time buffer nil)
-    )
-)
+(defun flymake-simple-cleanup (buffer)
+  "Do cleanup after 'flymake-init-create-temp-buffer-copy'.
+Delete temp file."
+  (let* ((temp-source-file-name (flymake-get-buffer-value buffer "temp-source-file-name")))
+    (flymake-safe-delete-file temp-source-file-name)
+    (flymake-set-buffer-last-change-time buffer nil)))
 
-(defun flymake-get-real-file-name(buffer file-name-from-err-msg)
-    "Translate file name from error message to `real' file name. Return full-name. Names are real, not patched"
-    (let* ((real-name              nil)
-	   (source-file-name       (buffer-file-name buffer))
-	   (master-file-name       (flymake-get-buffer-value buffer "master-file-name"))
-	   (temp-source-file-name  (flymake-get-buffer-value buffer "temp-source-file-name"))
-	   (temp-master-file-name  (flymake-get-buffer-value buffer "temp-master-file-name"))
-	   (base-dirs              (list (flymake-get-buffer-value buffer "base-dir")
-					 (file-name-directory source-file-name)
-					 (if master-file-name (file-name-directory master-file-name) nil)))
-	   (files                  (list (list source-file-name       source-file-name)
-					 (list temp-source-file-name  source-file-name)
-					 (list master-file-name       master-file-name)
-					 (list temp-master-file-name  master-file-name))))
+(defun flymake-get-real-file-name (buffer file-name-from-err-msg)
+  "Translate file name from error message to `real' file name.
+Return full-name. Names are real, not patched."
+  (let* ((real-name              nil)
+	 (source-file-name       (buffer-file-name buffer))
+	 (master-file-name       (flymake-get-buffer-value buffer "master-file-name"))
+	 (temp-source-file-name  (flymake-get-buffer-value buffer "temp-source-file-name"))
+	 (temp-master-file-name  (flymake-get-buffer-value buffer "temp-master-file-name"))
+	 (base-dirs              (list (flymake-get-buffer-value buffer "base-dir")
+				       (file-name-directory source-file-name)
+				       (if master-file-name (file-name-directory master-file-name) nil)))
+	 (files                  (list (list source-file-name       source-file-name)
+				       (list temp-source-file-name  source-file-name)
+				       (list master-file-name       master-file-name)
+				       (list temp-master-file-name  master-file-name))))
 
-	(when (equal 0 (length file-name-from-err-msg))
-	    (setq file-name-from-err-msg source-file-name)
-	)
+    (when (equal 0 (length file-name-from-err-msg))
+      (setq file-name-from-err-msg source-file-name))
 
-	(setq real-name (flymake-get-full-patched-file-name file-name-from-err-msg base-dirs files))
-	; if real-name is nil, than file name from err msg is none of the files we've patched
-	(if (not real-name)
-	    (setq real-name (flymake-get-full-nonpatched-file-name file-name-from-err-msg base-dirs))
-	)
-	(if (not real-name)
-	    (setq real-name file-name-from-err-msg)
-	)
-	(setq real-name (flymake-fix-path-name real-name))
-	(flymake-log 3 "get-real-file-name: file-name=%s real-name=%s" file-name-from-err-msg real-name)
-	real-name
-    )
-)
+    (setq real-name (flymake-get-full-patched-file-name file-name-from-err-msg base-dirs files))
+					; if real-name is nil, than file name from err msg is none of the files we've patched
+    (if (not real-name)
+	(setq real-name (flymake-get-full-nonpatched-file-name file-name-from-err-msg base-dirs)))
+    (if (not real-name)
+	(setq real-name file-name-from-err-msg))
+    (setq real-name (flymake-fix-file-name real-name))
+    (flymake-log 3 "get-real-file-name: file-name=%s real-name=%s" file-name-from-err-msg real-name)
+    real-name))
+
+(defun flymake-get-full-patched-file-name (file-name-from-err-msg base-dirs files)
+  (let* ((base-dirs-count  (length base-dirs))
+	 (file-count       (length files))
+	 (real-name        nil))
 
-(defun flymake-get-full-patched-file-name(file-name-from-err-msg base-dirs files)
-    (let* ((base-dirs-count  (length base-dirs))
-	   (file-count       (length files))
-	   (real-name        nil))
+    (while (and (not real-name) (> base-dirs-count 0))
+      (setq file-count (length files))
+      (while (and (not real-name) (> file-count 0))
+	(let* ((this-dir        (nth (1- base-dirs-count) base-dirs))
+	       (this-file       (nth 0 (nth (1- file-count) files)))
+	       (this-real-name  (nth 1 (nth (1- file-count) files))))
+					;+(flymake-log 0 "this-dir=%s this-file=%s this-real=%s msg-file=%s" this-dir this-file this-real-name file-name-from-err-msg)
+	  (when (and this-dir this-file (flymake-same-files
+					 (flymake-get-absolute-file-name-basedir file-name-from-err-msg this-dir)
+					 this-file))
+	    (setq real-name this-real-name)))
+	(setq file-count (1- file-count)))
+      (setq base-dirs-count (1- base-dirs-count)))
+    real-name))
 
+(defun flymake-get-full-nonpatched-file-name (file-name-from-err-msg base-dirs)
+  (let* ((real-name  nil))
+    (if (file-name-absolute-p file-name-from-err-msg)
+	(setq real-name file-name-from-err-msg)
+      (let* ((base-dirs-count  (length base-dirs)))
 	(while (and (not real-name) (> base-dirs-count 0))
-	    (setq file-count (length files))
-	    (while (and (not real-name) (> file-count 0))
-		(let* ((this-dir        (nth (1- base-dirs-count) base-dirs))
-		       (this-file       (nth 0 (nth (1- file-count) files)))
-		       (this-real-name  (nth 1 (nth (1- file-count) files))))
-		    ;+(flymake-log 0 "this-dir=%s this-file=%s this-real=%s msg-file=%s" this-dir this-file this-real-name file-name-from-err-msg)
-		    (when (and this-dir this-file (flymake-same-files
-						   (flymake-get-absolute-file-name-basedir file-name-from-err-msg this-dir)
-						   this-file))
-			(setq real-name this-real-name)
-		    )
-		)
-		(setq file-count (1- file-count))
-	    )
-	    (setq base-dirs-count (1- base-dirs-count))
-	)
-	real-name
-    )
-)
+	  (let* ((full-name (flymake-get-absolute-file-name-basedir file-name-from-err-msg
+								    (nth (1- base-dirs-count) base-dirs))))
+	    (if (file-exists-p full-name)
+		(setq real-name full-name))
+	    (setq base-dirs-count (1- base-dirs-count))))))
+    real-name))
 
-(defun flymake-get-full-nonpatched-file-name(file-name-from-err-msg base-dirs)
-    (let* ((real-name  nil))
-	(if (file-name-absolute-p file-name-from-err-msg)
-	    (setq real-name file-name-from-err-msg)
-	;else
-	    (let* ((base-dirs-count  (length base-dirs)))
-		(while (and (not real-name) (> base-dirs-count 0))
-		    (let* ((full-name (flymake-get-absolute-file-name-basedir file-name-from-err-msg
-									      (nth (1- base-dirs-count) base-dirs))))
-			(if (file-exists-p full-name)
-			    (setq real-name full-name)
-			)
-			(setq base-dirs-count (1- base-dirs-count))
-		    )
-		)
-	    )
-	)
-	real-name
-    )
-)
+(defun flymake-get-absolute-file-name-basedir (file-name dir-name)
+  (if (file-name-absolute-p file-name)
+      file-name
+    (concat dir-name "/" file-name)))
 
-(defun flymake-get-absolute-file-name-basedir(file-name dir-name)
-    (if (file-name-absolute-p file-name)
-	file-name
-    ;else
-	(concat dir-name "/" file-name)
-    )
-)
+(defun flymake-init-find-buildfile-dir (buffer source-file-name buildfile-name)
+  "Find buildfile, store its dir in buffer data and return its dir, if found."
+  (let* ((buildfile-dir  (flymake-find-buildfile buildfile-name
+						 (file-name-directory source-file-name)
+						 flymake-buildfile-dirs)))
+    (if (not buildfile-dir)
+	(progn
+	  (flymake-log 1 "no buildfile (%s) for %s" buildfile-name source-file-name)
+	  (flymake-report-fatal-status buffer "NOMK" (format "No buildfile (%s) found for %s" buildfile-name source-file-name))
+	  )
+      (progn
+	(flymake-set-buffer-value buffer "base-dir" buildfile-dir)))
+    buildfile-dir))
 
-(defun flymake-init-find-buildfile-dir(buffer source-file-name buildfile-name)
-    "find buildfile, store its dir in buffer data and return its dir, if found"
-    (let* ((buildfile-dir  (flymake-find-buildfile buildfile-name
-						   (file-name-directory source-file-name)
-						   flymake-buildfile-dirs)))
-	(if (not buildfile-dir)
-	    (progn
-		(flymake-log 1 "no buildfile (%s) for %s" buildfile-name source-file-name)
-		(flymake-report-fatal-status buffer "NOMK" (format "No buildfile (%s) found for %s" buildfile-name source-file-name))
-	    )
-	;else
-	    (progn
-		(flymake-set-buffer-value buffer "base-dir" buildfile-dir)
-	    )
-	)
-	buildfile-dir
-    )
-)
+(defun flymake-init-create-temp-source-and-master-buffer-copy (buffer get-incl-dirs-f create-temp-f master-file-masks include-regexp-list)
+  "Find master file (or buffer), create it's copy along with a copy of the source file."
+  (let* ((source-file-name       (buffer-file-name buffer))
+	 (temp-source-file-name  (flymake-init-create-temp-buffer-copy buffer create-temp-f))
+	 (master-file-name       nil)
+	 (temp-master-file-name  nil)
+	 (master-and-temp-master (flymake-create-master-file
+				  source-file-name temp-source-file-name
+				  get-incl-dirs-f create-temp-f
+				  master-file-masks include-regexp-list)))
 
-(defun flymake-init-create-temp-source-and-master-buffer-copy(buffer get-incl-dirs-f create-temp-f master-file-masks include-regexp-list)
-    "find master file (or buffer), create it's copy along with a copy of the source file"
-    (let* ((source-file-name       (buffer-file-name buffer))
-	   (temp-source-file-name  (flymake-init-create-temp-buffer-copy buffer create-temp-f))
-	   (master-file-name       nil)
-	   (temp-master-file-name  nil)
-	   (master-and-temp-master (flymake-create-master-file
-				    source-file-name temp-source-file-name
-				    get-incl-dirs-f create-temp-f
-				    master-file-masks include-regexp-list)))
+    (if (not master-and-temp-master)
+	(progn
+	  (flymake-log 1 "cannot find master file for %s" source-file-name)
+	  (flymake-report-status buffer "!" "")	; NOMASTER
+	  )
+      (progn
+	(setq master-file-name       (nth 0 master-and-temp-master))
+	(setq temp-master-file-name  (nth 1 master-and-temp-master))
+	(flymake-set-buffer-value buffer "master-file-name"      master-file-name)
+	(flymake-set-buffer-value buffer "temp-master-file-name" temp-master-file-name)
+	))
+    temp-master-file-name))
 
-	(if (not master-and-temp-master)
-	    (progn
-		(flymake-log 1 "cannot find master file for %s" source-file-name)
-		(flymake-report-status buffer "!" "") ; NOMASTER
-	    )
-	;else
-	    (progn
-		(setq master-file-name       (nth 0 master-and-temp-master))
-		(setq temp-master-file-name  (nth 1 master-and-temp-master))
-		(flymake-set-buffer-value buffer "master-file-name"      master-file-name)
-		(flymake-set-buffer-value buffer "temp-master-file-name" temp-master-file-name)
-	    )
-	)
-	temp-master-file-name
-    )
-)
-
-(defun flymake-master-cleanup(buffer)
-    (flymake-simple-cleanup buffer)
-    (flymake-safe-delete-file (flymake-get-buffer-value buffer "temp-master-file-name"))
-)
+(defun flymake-master-cleanup (buffer)
+  (flymake-simple-cleanup buffer)
+  (flymake-safe-delete-file (flymake-get-buffer-value buffer "temp-master-file-name")))
 
 ;;;; make-specific init-cleanup routines
-
-(defun flymake-get-syntax-check-program-args(source-file-name base-dir use-relative-base-dir use-relative-source get-cmd-line-f)
-    "create a command line for the syntax check command, using get-cmd-line-f"
-    (let* ((my-base-dir  base-dir)
-	   (my-source    source-file-name))
+(defun flymake-get-syntax-check-program-args (source-file-name base-dir use-relative-base-dir use-relative-source get-cmd-line-f)
+  "Create a command line for syntax check using GET-CMD-LINE-F."
+  (let* ((my-base-dir  base-dir)
+	 (my-source    source-file-name))
 
-	(when use-relative-base-dir
-	    (setq my-base-dir (flymake-build-relative-path (file-name-directory source-file-name) base-dir))
-	)
+    (when use-relative-base-dir
+      (setq my-base-dir (flymake-build-relative-filename (file-name-directory source-file-name) base-dir)))
 
-	(when use-relative-source
-	    (setq my-source (concat (flymake-build-relative-path base-dir (file-name-directory source-file-name))
-				    (file-name-nondirectory source-file-name)))
-	)
+    (when use-relative-source
+      (setq my-source (concat (flymake-build-relative-filename base-dir (file-name-directory source-file-name))
+			      (file-name-nondirectory source-file-name))))
+    (funcall get-cmd-line-f my-source my-base-dir)))
 
-	(funcall get-cmd-line-f my-source my-base-dir)
-    )
-)
+(defun flymake-get-make-cmdline (source base-dir)
+  (list "make"
+	(list "-s"
+	      "-C"
+	      base-dir
+	      (concat "CHK_SOURCES=" source)
+	      "SYNTAX_CHECK_MODE=1"
+	      "check-syntax")))
 
-(defun flymake-get-make-cmdline(source base-dir)
-    (list "make"
-	  (list "-s"
-			"-C"
-			base-dir
-			(concat "CHK_SOURCES=" source)
-			"SYNTAX_CHECK_MODE=1"
-			"check-syntax"))
-)
-
-(defun flymake-get-ant-cmdline(source base-dir)
-    (list "ant"
-	  (list "-buildfile"
-		(concat base-dir "/" "build.xml")
-		(concat "-DCHK_SOURCES=" source)
-		"check-syntax"))
-)
+(defun flymake-get-ant-cmdline (source base-dir)
+  (list "ant"
+	(list "-buildfile"
+	      (concat base-dir "/" "build.xml")
+	      (concat "-DCHK_SOURCES=" source)
+	      "check-syntax")))
 
-(defun flymake-simple-make-init-impl(buffer create-temp-f use-relative-base-dir use-relative-source build-file-name get-cmdline-f)
-    "create syntax check command line for a directly checked source file, use create-temp-f for creating temp copy"
-    (let* ((args          nil)
-	   (source-file-name   (buffer-file-name buffer))
-	   (buildfile-dir      (flymake-init-find-buildfile-dir buffer source-file-name build-file-name)))
-	(if buildfile-dir
-	    (let* ((temp-source-file-name  (flymake-init-create-temp-buffer-copy buffer create-temp-f)))
-		(setq args (flymake-get-syntax-check-program-args temp-source-file-name buildfile-dir
-							       use-relative-base-dir use-relative-source
-							       get-cmdline-f))
-	    )
-	)
+(defun flymake-simple-make-init-impl (buffer create-temp-f use-relative-base-dir use-relative-source build-file-name get-cmdline-f)
+  "Create syntax check command line for a directly checked source file.
+Use CREATE-TEMP-F for creating temp copy."
+  (let* ((args nil)
+	 (source-file-name   (buffer-file-name buffer))
+	 (buildfile-dir      (flymake-init-find-buildfile-dir buffer source-file-name build-file-name)))
+    (if buildfile-dir
+	(let* ((temp-source-file-name  (flymake-init-create-temp-buffer-copy buffer create-temp-f)))
+	  (setq args (flymake-get-syntax-check-program-args temp-source-file-name buildfile-dir
+							    use-relative-base-dir use-relative-source
+							    get-cmdline-f))))
+    args))
 
-	args
-    )
-)
-
-(defun flymake-simple-make-init(buffer)
-    (flymake-simple-make-init-impl buffer 'flymake-create-temp-inplace t t "Makefile" 'flymake-get-make-cmdline)
-)
+(defun flymake-simple-make-init (buffer)
+  (flymake-simple-make-init-impl buffer 'flymake-create-temp-inplace t t "Makefile" 'flymake-get-make-cmdline))
 
-(defun flymake-master-make-init(buffer get-incl-dirs-f master-file-masks include-regexp-list)
-    "create make command line for a source file checked via master file compilation"
-    (let* ((make-args          nil)
-	   (temp-master-file-name (flymake-init-create-temp-source-and-master-buffer-copy
-				   buffer get-incl-dirs-f 'flymake-create-temp-inplace
-				   master-file-masks include-regexp-list)))
-	(when temp-master-file-name
-	    (let* ((buildfile-dir (flymake-init-find-buildfile-dir buffer temp-master-file-name "Makefile")))
-		(if  buildfile-dir
-				    (setq make-args (flymake-get-syntax-check-program-args
-									 temp-master-file-name buildfile-dir nil nil 'flymake-get-make-cmdline))
-		)
-	    )
-	)
+(defun flymake-master-make-init (buffer get-incl-dirs-f master-file-masks include-regexp-list)
+  "create make command line for a source file checked via master file compilation"
+  (let* ((make-args nil)
+	 (temp-master-file-name (flymake-init-create-temp-source-and-master-buffer-copy
+				 buffer get-incl-dirs-f 'flymake-create-temp-inplace
+				 master-file-masks include-regexp-list)))
+    (when temp-master-file-name
+      (let* ((buildfile-dir (flymake-init-find-buildfile-dir buffer temp-master-file-name "Makefile")))
+	(if  buildfile-dir
+	    (setq make-args (flymake-get-syntax-check-program-args
+			     temp-master-file-name buildfile-dir nil nil 'flymake-get-make-cmdline)))))
+    make-args))
 
-		make-args
-    )
-)
-
-(defun flymake-find-make-buildfile(source-dir)
-    (flymake-find-buildfile "Makefile" source-dir flymake-buildfile-dirs)
-)
+(defun flymake-find-make-buildfile (source-dir)
+  (flymake-find-buildfile "Makefile" source-dir flymake-buildfile-dirs))
 
 ;;;; .h/make specific
-(defun flymake-master-make-header-init(buffer)
-    (flymake-master-make-init buffer
-			      'flymake-get-include-dirs
-			      '(".+\\.cpp$" ".+\\.c$")
-			      '("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2))
-)
+(defun flymake-master-make-header-init (buffer)
+  (flymake-master-make-init buffer
+			    'flymake-get-include-dirs
+			    '(".+\\.cpp$" ".+\\.c$")
+			    '("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2)))
 
 ;;;; .java/make specific
-(defun flymake-simple-make-java-init(buffer)
-    (flymake-simple-make-init-impl buffer 'flymake-create-temp-with-folder-structure nil nil "Makefile" 'flymake-get-make-cmdline)
-)
+(defun flymake-simple-make-java-init (buffer)
+  (flymake-simple-make-init-impl buffer 'flymake-create-temp-with-folder-structure nil nil "Makefile" 'flymake-get-make-cmdline))
 
-(defun flymake-simple-ant-java-init(buffer)
-    (flymake-simple-make-init-impl buffer 'flymake-create-temp-with-folder-structure nil nil "build.xml" 'flymake-get-ant-cmdline)
-)
+(defun flymake-simple-ant-java-init (buffer)
+  (flymake-simple-make-init-impl buffer 'flymake-create-temp-with-folder-structure nil nil "build.xml" 'flymake-get-ant-cmdline))
 
-(defun flymake-simple-java-cleanup(buffer)
-    "cleanup after flymake-simple-make-java-init -- delete temp file and dirs"
-    (let* ((temp-source-file-name (flymake-get-buffer-value buffer "temp-source-file-name")))
-	(flymake-safe-delete-file temp-source-file-name)
-	(when temp-source-file-name
-	    (flymake-delete-temp-directory (file-name-directory temp-source-file-name))
-	)
-    )
-)
+(defun flymake-simple-java-cleanup (buffer)
+  "cleanup after flymake-simple-make-java-init -- delete temp file and dirs"
+  (let* ((temp-source-file-name (flymake-get-buffer-value buffer "temp-source-file-name")))
+    (flymake-safe-delete-file temp-source-file-name)
+    (when temp-source-file-name
+      (flymake-delete-temp-directory (file-name-directory temp-source-file-name)))))
 
 ;;;; perl-specific init-cleanup routines
-
-(defun flymake-perl-init(buffer)
-    (let* ((temp-file   (flymake-init-create-temp-buffer-copy buffer 'flymake-create-temp-inplace))
-		   (local-file  (concat (flymake-build-relative-path (file-name-directory (buffer-file-name (current-buffer)))
-															 (file-name-directory temp-file))
-								(file-name-nondirectory temp-file))))
-	(list "perl" (list "-wc " local-file))
-	)
-)
+(defun flymake-perl-init (buffer)
+  (let* ((temp-file   (flymake-init-create-temp-buffer-copy buffer 'flymake-create-temp-inplace))
+	 (local-file  (concat (flymake-build-relative-filename (file-name-directory (buffer-file-name (current-buffer)))
+							   (file-name-directory temp-file))
+			      (file-name-nondirectory temp-file))))
+    (list "perl" (list "-wc " local-file))))
 
 ;;;; tex-specific init-cleanup routines
+(defun flymake-get-tex-args (file-name)
+					;(list "latex" (list "-c-style-errors" file-name))
+  (list "texify" (list "--pdf" "--tex-option=-c-style-errors" file-name)))
 
-(defun flymake-get-tex-args(file-name)
-    ;(list "latex" (list "-c-style-errors" file-name))
-    (list "texify" (list "--pdf" "--tex-option=-c-style-errors" file-name))
-)
-
-(defun flymake-simple-tex-init(buffer)
-    (flymake-get-tex-args (flymake-init-create-temp-buffer-copy buffer 'flymake-create-temp-inplace))
-)
+(defun flymake-simple-tex-init (buffer)
+  (flymake-get-tex-args (flymake-init-create-temp-buffer-copy buffer 'flymake-create-temp-inplace)))
 
-(defun flymake-master-tex-init(buffer)
-    (let* ((temp-master-file-name (flymake-init-create-temp-source-and-master-buffer-copy
-				   buffer 'flymake-get-include-dirs-dot 'flymake-create-temp-inplace
-				   '(".+\\.tex$")
-				   '("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2))))
-	(when temp-master-file-name
-	    (flymake-get-tex-args temp-master-file-name)
-	)
-    )
-)
+(defun flymake-master-tex-init (buffer)
+  (let* ((temp-master-file-name (flymake-init-create-temp-source-and-master-buffer-copy
+				 buffer 'flymake-get-include-dirs-dot 'flymake-create-temp-inplace
+				 '(".+\\.tex$")
+				 '("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2))))
+    (when temp-master-file-name
+      (flymake-get-tex-args temp-master-file-name))))
 
-(defun flymake-get-include-dirs-dot(base-dir)
-    '(".")
-)
+(defun flymake-get-include-dirs-dot (base-dir)
+  '("."))
 
 ;;;; xml-specific init-cleanup routines
+(defun flymake-xml-init(buffer)
+  (list "xml" (list "val" (flymake-init-create-temp-buffer-copy buffer 'flymake-create-temp-inplace))))
 
-(defun flymake-xml-init(buffer)
-    (list "xml" (list "val" (flymake-init-create-temp-buffer-copy buffer 'flymake-create-temp-inplace)))
-)
+(provide 'flymake)
 
 ;;; arch-tag: 8f0d6090-061d-4cac-8862-7c151c4a02dd
 ;;; flymake.el ends here
--- a/lisp/progmodes/gdb-ui.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/gdb-ui.el	Wed Dec 08 22:20:27 2004 +0000
@@ -62,15 +62,52 @@
 (defvar gdb-current-frame nil)
 (defvar gdb-current-stack-level nil)
 (defvar gdb-current-language nil)
-(defvar gdb-view-source t "Non-nil means that source code can be viewed.")
-(defvar gdb-selected-view 'source "Code type that user wishes to view.")
 (defvar gdb-var-list nil "List of variables in watch window.")
 (defvar gdb-var-changed nil "Non-nil means that gdb-var-list has changed.")
 (defvar gdb-buffer-type nil)
 (defvar gdb-overlay-arrow-position nil)
-(defvar gdb-variables '()
-  "A list of variables that are local to the GUD buffer.")
 (defvar gdb-server-prefix nil)
+(defvar gdb-flush-pending-output nil)
+
+(defvar gdb-buffer-type nil
+  "One of the symbols bound in `gdb-buffer-rules'.")
+
+(defvar gdb-input-queue ()
+  "A list of gdb command objects.")
+
+(defvar gdb-prompting nil
+  "True when gdb is idle with no pending input.")
+
+(defvar gdb-output-sink 'user
+  "The disposition of the output of the current gdb command.
+Possible values are these symbols:
+
+    `user' -- gdb output should be copied to the GUD buffer
+              for the user to see.
+
+    `inferior' -- gdb output should be copied to the inferior-io buffer
+
+    `pre-emacs' -- output should be ignored util the post-prompt
+                   annotation is received.  Then the output-sink
+		   becomes:...
+    `emacs' -- output should be collected in the partial-output-buffer
+	       for subsequent processing by a command.  This is the
+	       disposition of output generated by commands that
+	       gdb mode sends to gdb on its own behalf.
+    `post-emacs' -- ignore output until the prompt annotation is
+		    received, then go to USER disposition.
+
+gdba (gdb-ui.el) uses all five values,  gdbmi (gdb-mi.el) only two
+\(`user' and `emacs').")
+
+(defvar gdb-current-item nil
+  "The most recent command item sent to gdb.")
+
+(defvar gdb-pending-triggers '()
+  "A list of trigger functions that have run later than their output
+handlers.")
+
+;; end of gdb variables
 
 ;;;###autoload
 (defun gdba (command-line)
@@ -185,8 +222,6 @@
   (setq gdb-previous-frame nil)
   (setq gdb-current-frame nil)
   (setq gdb-current-stack-level nil)
-  (setq gdb-view-source t)
-  (setq gdb-selected-view 'source)
   (setq gdb-var-list nil)
   (setq gdb-var-changed nil)
   (setq gdb-first-prompt nil)
@@ -196,8 +231,8 @@
   (setq gdb-pending-triggers nil)
   (setq gdb-output-sink 'user)
   (setq gdb-server-prefix "server ")
+  (setq gdb-flush-pending-output nil)
   ;;
-  (mapc 'make-local-variable gdb-variables)
   (setq gdb-buffer-type 'gdba)
   ;;
   (if gdb-use-inferior-io-buffer (gdb-clear-inferior-io))
@@ -236,7 +271,7 @@
 	    (concat "server interpreter mi \"-var-create - * "  expr "\"\n")
 	  (concat"-var-create - * "  expr "\n"))
 	     `(lambda () (gdb-var-create-handler ,expr))))))
-  (select-window (get-buffer-window gud-comint-buffer 'visible)))
+  (select-window (get-buffer-window gud-comint-buffer 0)))
 
 (defun gdb-goto-info ()
   "Go to Emacs info node: GDB Graphical Interface."
@@ -276,7 +311,7 @@
     (goto-char (point-min))
     (re-search-forward ".*value=\"\\(.*?\\)\"" nil t)
     (catch 'var-found
-      (let ((var-list nil) (num 0))
+      (let ((num 0))
 	(dolist (var gdb-var-list)
 	  (if (string-equal varnum (cadr var))
 	      (progn
@@ -412,46 +447,6 @@
 	   (if (string-match (concat token "\\.") (nth 1 var))
 	       (setq gdb-var-list (delq var gdb-var-list))))
 	 (setq gdb-var-changed t))))
-
-(defvar gdb-buffer-type nil
-  "One of the symbols bound in `gdb-buffer-rules'.")
-
-(defvar gdb-input-queue ()
-  "A list of gdb command objects.")
-
-(defvar gdb-prompting nil
-  "True when gdb is idle with no pending input.")
-
-(defvar gdb-output-sink 'user
-  "The disposition of the output of the current gdb command.
-Possible values are these symbols:
-
-    `user' -- gdb output should be copied to the GUD buffer
-              for the user to see.
-
-    `inferior' -- gdb output should be copied to the inferior-io buffer
-
-    `pre-emacs' -- output should be ignored util the post-prompt
-                   annotation is received.  Then the output-sink
-		   becomes:...
-    `emacs' -- output should be collected in the partial-output-buffer
-	       for subsequent processing by a command.  This is the
-	       disposition of output generated by commands that
-	       gdb mode sends to gdb on its own behalf.
-    `post-emacs' -- ignore output until the prompt annotation is
-		    received, then go to USER disposition.
-
-gdba (gdb-ui.el) uses all five values,  gdbmi (gdb-mi.el) only two
-\(`user' and `emacs').")
-
-(defvar gdb-current-item nil
-  "The most recent command item sent to gdb.")
-
-(defvar gdb-pending-triggers '()
-  "A list of trigger functions that have run later than their output
-handlers.")
-
-;; end of gdb variables
 
 (defun gdb-get-target-string ()
   (with-current-buffer gud-comint-buffer
@@ -644,6 +639,27 @@
 	 (let ((last (car (last queue))))
 	   (unless (nbutlast queue) (setq gdb-input-queue '()))
 	   last))))
+
+(defun gdb-send-item (item)
+  (setq gdb-flush-pending-output nil)
+  (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log))
+  (setq gdb-current-item item)
+  (with-current-buffer gud-comint-buffer
+    (if (eq gud-minor-mode 'gdba)
+	(if (stringp item)
+	    (progn
+	      (setq gdb-output-sink 'user)
+	      (process-send-string (get-buffer-process gud-comint-buffer) item))
+	  (progn
+	    (gdb-clear-partial-output)
+	    (setq gdb-output-sink 'pre-emacs)
+	    (process-send-string (get-buffer-process gud-comint-buffer)
+				 (car item))))
+      ;; case: eq gud-minor-mode 'gdbmi
+      (gdb-clear-partial-output)
+      (setq gdb-output-sink 'emacs)
+      (process-send-string (get-buffer-process gud-comint-buffer)
+			   (car item)))))
 
 ;;
 ;; output -- things gdb prints to emacs
@@ -688,6 +704,14 @@
     ("stopped" gdb-stopped)
     ) "An assoc mapping annotation tags to functions which process them.")
 
+(defun gdb-resync()
+  (setq gdb-flush-pending-output t)
+  (setq gud-running nil)
+  (setq gdb-output-sink 'user)
+  (setq gdb-input-queue nil)
+  (setq gdb-pending-triggers nil)
+  (setq gdb-prompting t))
+
 (defconst gdb-source-spec-regexp
   "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:\\(0x[a-f0-9]*\\)")
 
@@ -700,31 +724,10 @@
 	 (match-string 1 args)
 	 (string-to-int (match-string 2 args))))
   (setq gdb-current-address (match-string 3 args))
-  (setq gdb-view-source t)
   ;; cover for auto-display output which comes *before*
   ;; stopped annotation
   (if (eq gdb-output-sink 'inferior) (setq gdb-output-sink 'user)))
 
-(defun gdb-send-item (item)
-  (if gdb-enable-debug-log (push (cons 'send item) gdb-debug-log))
-  (setq gdb-current-item item)
-  (with-current-buffer gud-comint-buffer
-    (if (eq gud-minor-mode 'gdba)
-	(if (stringp item)
-	    (progn
-	      (setq gdb-output-sink 'user)
-	      (process-send-string (get-buffer-process gud-comint-buffer) item))
-	  (progn
-	    (gdb-clear-partial-output)
-	    (setq gdb-output-sink 'pre-emacs)
-	    (process-send-string (get-buffer-process gud-comint-buffer)
-				 (car item))))
-      ;; case: eq gud-minor-mode 'gdbmi
-      (gdb-clear-partial-output)
-      (setq gdb-output-sink 'emacs)
-      (process-send-string (get-buffer-process gud-comint-buffer)
-			   (car item)))))
-
 (defun gdb-pre-prompt (ignored)
   "An annotation handler for `pre-prompt'.
 This terminates the collection of output from a previous command if that
@@ -735,7 +738,7 @@
      ((eq sink 'emacs)
       (setq gdb-output-sink 'post-emacs))
      (t
-      (setq gdb-output-sink 'user)
+      (gdb-resync)
       (error "Phase error in gdb-pre-prompt (got %s)" sink)))))
 
 (defun gdb-prompt (ignored)
@@ -752,7 +755,7 @@
 	(with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
 	  (funcall handler))))
      (t
-      (setq gdb-output-sink 'user)
+      (gdb-resync)
       (error "Phase error in gdb-prompt (got %s)" sink))))
   (let ((input (gdb-dequeue-input)))
     (if input
@@ -776,7 +779,9 @@
 	(setq gud-running t)
 	(if gdb-use-inferior-io-buffer
 	    (setq gdb-output-sink 'inferior))))
-     (t (error "Unexpected `starting' annotation")))))
+     (t 
+      (gdb-resync)
+      (error "Unexpected `starting' annotation")))))
 
 (defun gdb-stopping (ignored)
   "An annotation handler for `exited' and other annotations.
@@ -787,7 +792,9 @@
 	(cond
 	 ((eq sink 'inferior)
 	  (setq gdb-output-sink 'user))
-	 (t (error "Unexpected stopping annotation"))))))
+	 (t
+	  (gdb-resync)
+	  (error "Unexpected stopping annotation"))))))
 
 (defun gdb-frame-begin (ignored)
   (let ((sink gdb-output-sink))
@@ -796,7 +803,9 @@
       (setq gdb-output-sink 'user))
      ((eq sink 'user) t)
      ((eq sink 'emacs) t)
-     (t (error "Unexpected frame-begin annotation (%S)" sink)))))
+     (t
+      (gdb-resync)
+      (error "Unexpected frame-begin annotation (%S)" sink)))))
 
 (defun gdb-stopped (ignored)
   "An annotation handler for `stopped'.
@@ -808,7 +817,9 @@
      ((eq sink 'inferior)
       (setq gdb-output-sink 'user))
      ((eq sink 'user) t)
-     (t (error "Unexpected stopped annotation")))))
+     (t
+      (gdb-resync)
+      (error "Unexpected stopped annotation")))))
 
 (defun gdb-post-prompt (ignored)
   "An annotation handler for `post-prompt'.
@@ -837,66 +848,68 @@
      ((eq sink 'pre-emacs)
       (setq gdb-output-sink 'emacs))
      (t
-      (setq gdb-output-sink 'user)
+      (gdb-resync)
       (error "Phase error in gdb-post-prompt (got %s)" sink)))))
 
 (defun gud-gdba-marker-filter (string)
   "A gud marker filter for gdb.  Handle a burst of output from GDB."
-  (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log))
-  ;; Recall the left over gud-marker-acc from last time
-  (setq gud-marker-acc (concat gud-marker-acc string))
-  ;; Start accumulating output for the GUD buffer
-  (let ((output ""))
-    ;;
-    ;; Process all the complete markers in this chunk.
-    (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
-      (let ((annotation (match-string 1 gud-marker-acc)))
+  (if gdb-flush-pending-output
+      nil
+    (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log))
+    ;; Recall the left over gud-marker-acc from last time
+    (setq gud-marker-acc (concat gud-marker-acc string))
+    ;; Start accumulating output for the GUD buffer
+    (let ((output ""))
+      ;;
+      ;; Process all the complete markers in this chunk.
+      (while (string-match "\n\032\032\\(.*\\)\n" gud-marker-acc)
+	(let ((annotation (match-string 1 gud-marker-acc)))
+	  ;;
+	  ;; Stuff prior to the match is just ordinary output.
+	  ;; It is either concatenated to OUTPUT or directed
+	  ;; elsewhere.
+	  (setq output
+		(gdb-concat-output
+		 output
+		 (substring gud-marker-acc 0 (match-beginning 0))))
+	  ;;
+	  ;; Take that stuff off the gud-marker-acc.
+	  (setq gud-marker-acc (substring gud-marker-acc (match-end 0)))
+	  ;;
+	  ;; Parse the tag from the annotation, and maybe its arguments.
+	  (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
+	  (let* ((annotation-type (match-string 1 annotation))
+		 (annotation-arguments (match-string 2 annotation))
+		 (annotation-rule (assoc annotation-type
+					 gdb-annotation-rules)))
+	    ;; Call the handler for this annotation.
+	    (if annotation-rule
+		(funcall (car (cdr annotation-rule))
+			 annotation-arguments)
+	      ;; Else the annotation is not recognized.  Ignore it silently,
+	      ;; so that GDB can add new annotations without causing
+	      ;; us to blow up.
+	      ))))
+      ;;
+      ;; Does the remaining text end in a partial line?
+      ;; If it does, then keep part of the gud-marker-acc until we get more.
+      (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
+			gud-marker-acc)
+	  (progn
+	    ;; Everything before the potential marker start can be output.
+	    (setq output
+		  (gdb-concat-output output
+				     (substring gud-marker-acc 0
+						(match-beginning 0))))
+	    ;;
+	    ;; Everything after, we save, to combine with later input.
+	    (setq gud-marker-acc (substring gud-marker-acc (match-beginning 0))))
 	;;
-	;; Stuff prior to the match is just ordinary output.
-	;; It is either concatenated to OUTPUT or directed
-	;; elsewhere.
-	(setq output
-	      (gdb-concat-output
-	       output
-	       (substring gud-marker-acc 0 (match-beginning 0))))
-        ;;
-	;; Take that stuff off the gud-marker-acc.
-	(setq gud-marker-acc (substring gud-marker-acc (match-end 0)))
-        ;;
-	;; Parse the tag from the annotation, and maybe its arguments.
-	(string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
-	(let* ((annotation-type (match-string 1 annotation))
-	       (annotation-arguments (match-string 2 annotation))
-	       (annotation-rule (assoc annotation-type
-				       gdb-annotation-rules)))
-	  ;; Call the handler for this annotation.
-	  (if annotation-rule
-	      (funcall (car (cdr annotation-rule))
-		       annotation-arguments)
-	    ;; Else the annotation is not recognized.  Ignore it silently,
-	    ;; so that GDB can add new annotations without causing
-	    ;; us to blow up.
-	    ))))
-    ;;
-    ;; Does the remaining text end in a partial line?
-    ;; If it does, then keep part of the gud-marker-acc until we get more.
-    (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
-		      gud-marker-acc)
+	;; In case we know the gud-marker-acc contains no partial annotations:
 	(progn
-	  ;; Everything before the potential marker start can be output.
-	  (setq output
-		(gdb-concat-output output
-				   (substring gud-marker-acc 0
-					      (match-beginning 0))))
-	  ;;
-	  ;; Everything after, we save, to combine with later input.
-	  (setq gud-marker-acc (substring gud-marker-acc (match-beginning 0))))
-      ;;
-      ;; In case we know the gud-marker-acc contains no partial annotations:
-      (progn
-	(setq output (gdb-concat-output output gud-marker-acc))
-	(setq gud-marker-acc "")))
-    output))
+	  (setq output (gdb-concat-output output gud-marker-acc))
+	  (setq gud-marker-acc "")))
+      output)))
 
 (defun gdb-concat-output (so-far new)
   (let ((sink gdb-output-sink))
@@ -909,7 +922,9 @@
      ((eq sink 'inferior)
       (gdb-append-to-inferior-io new)
       so-far)
-     (t (error "Bogon output sink %S" sink)))))
+     (t
+      (gdb-resync)
+      (error "Bogon output sink %S" sink)))))
 
 (defun gdb-append-to-partial-output (string)
   (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
@@ -1101,7 +1116,7 @@
 
 ;;-put breakpoint icons in relevant margins (even those set in the GUD buffer)
 (defun gdb-info-breakpoints-custom ()
-  (let ((flag)(address))
+  (let ((flag))
     ;;
     ;; remove all breakpoint-icons in source buffers but not assembler buffer
     (dolist (buffer (buffer-list))
@@ -1168,7 +1183,7 @@
    (gdb-get-create-buffer 'gdb-breakpoints-buffer)))
 
 (defconst gdb-frame-parameters
-  '((height . 12) (width . 60)
+  '((height . 14) (width . 80)
     (unsplittable . t)
     (tool-bar-lines . nil)
     (menu-bar-lines . nil)
@@ -1177,9 +1192,9 @@
 (defun gdb-frame-breakpoints-buffer ()
   "Display status of user-settable breakpoints in a new frame."
   (interactive)
-  (select-frame (make-frame gdb-frame-parameters))
-  (switch-to-buffer (gdb-get-create-buffer 'gdb-breakpoints-buffer))
-  (set-window-dedicated-p (selected-window) t))
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+	(special-display-frame-alist gdb-frame-parameters))
+    (display-buffer (gdb-get-create-buffer 'gdb-breakpoints-buffer))))
 
 (defvar gdb-breakpoints-mode-map
   (let ((map (make-sparse-keymap))
@@ -1192,6 +1207,7 @@
     (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu))
     (define-key map " " 'gdb-toggle-breakpoint)
     (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)
     map))
@@ -1256,7 +1272,7 @@
 	    (let* ((buf (find-file-noselect (if (file-exists-p file)
 						file
 					      (expand-file-name file gdb-cdir))))
-		   (window (gdb-display-buffer buf)))
+		   (window (display-buffer buf)))
 	      (with-current-buffer buf
 		(goto-line (string-to-number line))
 		(set-window-point window (point))))))
@@ -1313,13 +1329,14 @@
 (defun gdb-frame-stack-buffer ()
   "Display backtrace of current stack in a new frame."
   (interactive)
-  (select-frame (make-frame gdb-frame-parameters))
-  (switch-to-buffer (gdb-get-create-buffer 'gdb-stack-buffer))
-  (set-window-dedicated-p (selected-window) t))
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+	(special-display-frame-alist gdb-frame-parameters))
+    (display-buffer (gdb-get-create-buffer 'gdb-stack-buffer))))
 
 (defvar gdb-frames-mode-map
   (let ((map (make-sparse-keymap)))
     (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)
     map))
@@ -1394,13 +1411,14 @@
 (defun gdb-frame-threads-buffer ()
   "Display IDs of currently known threads in a new frame."
   (interactive)
-  (select-frame (make-frame gdb-frame-parameters))
-  (switch-to-buffer (gdb-get-create-buffer 'gdb-threads-buffer))
-  (set-window-dedicated-p (selected-window) t))
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+	(special-display-frame-alist gdb-frame-parameters))
+    (display-buffer (gdb-get-create-buffer 'gdb-threads-buffer))))
 
 (defvar gdb-threads-mode-map
   (let ((map (make-sparse-keymap)))
     (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)
     map))
@@ -1453,7 +1471,8 @@
 (defvar gdb-registers-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
-    map))
+    (define-key map "q" 'kill-this-buffer)
+     map))
 
 (defun gdb-registers-mode ()
   "Major mode for gdb registers.
@@ -1480,9 +1499,9 @@
 (defun gdb-frame-registers-buffer ()
   "Display integer register contents in a new frame."
   (interactive)
-  (select-frame (make-frame gdb-frame-parameters))
-  (switch-to-buffer (gdb-get-create-buffer 'gdb-registers-buffer))
-  (set-window-dedicated-p (selected-window) t))
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+	(special-display-frame-alist gdb-frame-parameters))
+    (display-buffer (gdb-get-create-buffer 'gdb-registers-buffer))))
 
 ;;
 ;; Locals buffer.
@@ -1529,7 +1548,8 @@
 (defvar gdb-locals-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
-    map))
+    (define-key map "q" 'kill-this-buffer)
+     map))
 
 (defun gdb-locals-mode ()
   "Major mode for gdb locals.
@@ -1558,52 +1578,33 @@
 (defun gdb-frame-locals-buffer ()
   "Display local variables of current stack and their values in a new frame."
   (interactive)
-  (select-frame (make-frame gdb-frame-parameters))
-  (switch-to-buffer (gdb-get-create-buffer 'gdb-locals-buffer))
-  (set-window-dedicated-p (selected-window) t))
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+	(special-display-frame-alist gdb-frame-parameters))
+    (display-buffer (gdb-get-create-buffer 'gdb-locals-buffer))))
 
 
 ;;;; Window management
-
-;;; The way we abuse the dedicated-p flag is pretty gross, but seems
-;;; to do the right thing.  Seeing as there is no way for Lisp code to
-;;; get at the use_time field of a window, I'm not sure there exists a
-;;; more elegant solution without writing C code.
-
 (defun gdb-display-buffer (buf &optional size)
-  (let ((must-split nil)
-	(answer nil))
-    (unwind-protect
-	(progn
-	  (walk-windows
-	   #'(lambda (win)
-	      (if (eq gud-comint-buffer (window-buffer win))
-		  (set-window-dedicated-p win t))))
-	  (setq answer (get-buffer-window buf 'visible))
-	  (if (not answer)
-	      (let ((window (get-lru-window 'visible)))
-		(if window
-		    (progn
-		      (set-window-buffer window buf)
-		      (setq answer window))
-		  (setq must-split t)))))
-      (walk-windows
-       #'(lambda (win)
-	  (if (eq gud-comint-buffer (window-buffer win))
-	      (set-window-dedicated-p win nil)))))
-    (if must-split
-	(let* ((largest (get-largest-window 'visible))
-	       (cur-size (window-height largest))
-	       (new-size (and size (< size cur-size) (- cur-size size))))
-	  (setq answer (split-window largest new-size))
-	  (set-window-buffer answer buf)))
-    answer))
-
-(defun gdb-display-source-buffer (buffer)
-  (if (eq gdb-selected-view 'source)
-	(gdb-display-buffer buffer)
-    (gdb-display-buffer (gdb-get-buffer 'gdb-assembler-buffer)))
-    (get-buffer-window buffer 'visible))
+  (let ((answer (get-buffer-window buf 0))
+	(must-split nil))
+    (if answer
+	(display-buffer buf)		;Raise the frame if necessary.
+      ;; The buffer is not yet displayed.
+      (pop-to-buffer gud-comint-buffer)	;Select the right frame.
+      (let ((window (get-lru-window)))
+	(if window
+	    (progn
+	      (set-window-buffer window buf)
+	      (setq answer window))
+	  (setq must-split t)))
+      (if must-split
+	  (let* ((largest (get-largest-window))
+		 (cur-size (window-height largest))
+		 (new-size (and size (< size cur-size) (- cur-size size))))
+	    (setq answer (split-window largest new-size))
+	    (set-window-buffer answer buf)
+	    (set-window-dedicated-p answer t)))
+      answer)))
 
 
 ;;; Shared keymap initialization:
@@ -1630,19 +1631,6 @@
   (define-key menu [frames] '("Stack" . gdb-display-stack-buffer))
   (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer)))
 
-(let ((menu (make-sparse-keymap "View")))
-   (define-key gud-menu-map [view]
-     `(menu-item "View" ,menu :visible (eq gud-minor-mode 'gdba)))
-;  (define-key menu [both] '(menu-item "Both" gdb-view-both
-;	       :help "Display both source and assembler"
-;	       :button (:radio . (eq gdb-selected-view 'both))))
-   (define-key menu [assembler] '(menu-item "Machine" gdb-view-assembler
-	       :help "Display assembler only"
-	       :button (:radio . (eq gdb-selected-view 'assembler))))
-   (define-key menu [source] '(menu-item "Source" gdb-view-source-function
-	       :help "Display source only"
-	       :button (:radio . (eq gdb-selected-view 'source)))))
-
 (let ((menu (make-sparse-keymap "GDB-UI")))
   (define-key gud-menu-map [ui]
     `(menu-item "GDB-UI" ,menu :visible (eq gud-minor-mode 'gdba)))
@@ -1668,33 +1656,16 @@
 
 (defvar gdb-main-file nil "Source file from which program execution begins.")
 
-(defun gdb-view-source-function ()
-  "Select source view."
-  (interactive)
-  (if gdb-view-source
-      (gdb-display-buffer
-       (if gud-last-last-frame
-	   (gud-find-file (car gud-last-last-frame))
-	 (gud-find-file gdb-main-file))))
-  (setq gdb-selected-view 'source))
-
-(defun gdb-view-assembler()
-  "Select disassembly view."
-  (interactive)
-  (gdb-display-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))
-  (gdb-invalidate-assembler)
-  (setq gdb-selected-view 'assembler))
-
-;(defun gdb-view-both()
-;(interactive)
-;(setq gdb-selected-view 'both))
-
 (defcustom gdb-show-main nil
   "Nil means don't display source file containing the main routine."
   :type 'boolean
   :group 'gud
   :version "21.4")
 
+(defun gdb-set-window-buffer (name)
+  (set-window-buffer (selected-window) (get-buffer name))
+  (set-window-dedicated-p (selected-window) t))
+
 (defun gdb-setup-windows ()
   "Layout the window pattern for gdb-many-windows."
   (gdb-display-locals-buffer)
@@ -1702,29 +1673,27 @@
   (delete-other-windows)
   (gdb-display-breakpoints-buffer)
   (delete-other-windows)
-  (switch-to-buffer gud-comint-buffer)
+  ; Don't dedicate.
+  (pop-to-buffer gud-comint-buffer)
   (split-window nil ( / ( * (window-height) 3) 4))
   (split-window nil ( / (window-height) 3))
   (split-window-horizontally)
   (other-window 1)
-  (switch-to-buffer (gdb-locals-buffer-name))
+  (gdb-set-window-buffer (gdb-locals-buffer-name))
   (other-window 1)
   (switch-to-buffer
-   (if (and gdb-view-source
-	    (eq gdb-selected-view 'source))
        (if gud-last-last-frame
 	   (gud-find-file (car gud-last-last-frame))
-	 (gud-find-file gdb-main-file))
-     (gdb-get-create-buffer 'gdb-assembler-buffer)))
+	 (gud-find-file gdb-main-file)))
   (when gdb-use-inferior-io-buffer
     (split-window-horizontally)
     (other-window 1)
-    (switch-to-buffer (gdb-inferior-io-name)))
+    (gdb-set-window-buffer (gdb-inferior-io-name)))
   (other-window 1)
-  (switch-to-buffer (gdb-stack-buffer-name))
+  (gdb-set-window-buffer (gdb-stack-buffer-name))
   (split-window-horizontally)
   (other-window 1)
-  (switch-to-buffer (gdb-breakpoints-buffer-name))
+  (gdb-set-window-buffer (gdb-breakpoints-buffer-name))
   (other-window 1))
 
 (defcustom gdb-many-windows nil
@@ -1752,22 +1721,16 @@
   "Restore the basic arrangement of windows used by gdba.
 This arrangement depends on the value of `gdb-many-windows'."
   (interactive)
+  (pop-to-buffer gud-comint-buffer)	;Select the right window and frame.
+    (delete-other-windows)
   (if gdb-many-windows
-      (progn
-	(switch-to-buffer gud-comint-buffer)
-	(delete-other-windows)
-	(gdb-setup-windows))
-    (switch-to-buffer gud-comint-buffer)
-    (delete-other-windows)
+      (gdb-setup-windows)
     (split-window)
     (other-window 1)
     (switch-to-buffer
-     (if (and gdb-view-source
-	      (eq gdb-selected-view 'source))
 	 (if gud-last-last-frame
 	     (gud-find-file (car gud-last-last-frame))
-	   (gud-find-file gdb-main-file))
-       (gdb-get-create-buffer 'gdb-assembler-buffer)))
+	   (gud-find-file gdb-main-file)))
     (other-window 1)))
 
 (defun gdb-reset ()
@@ -1800,21 +1763,13 @@
 	(setq gdb-cdir (match-string 0))))
   (if (search-forward "Located in " nil t)
       (if (looking-at "\\S-*")
-	  (setq gdb-main-file (match-string 0)))
-    (setq gdb-view-source nil))
-  (if gdb-many-windows
+	  (setq gdb-main-file (match-string 0))))
+ (if gdb-many-windows
       (gdb-setup-windows)
     (gdb-get-create-buffer 'gdb-breakpoints-buffer)
-    (when gdb-show-main
-      (switch-to-buffer gud-comint-buffer)
-      (delete-other-windows)
-      (split-window)
-      (other-window 1)
-      (switch-to-buffer
-       (if gdb-view-source
-	   (gud-find-file gdb-main-file)
-	 (gdb-get-create-buffer 'gdb-assembler-buffer)))
-      (other-window 1))))
+    (if gdb-show-main
+      (let ((pop-up-windows t))
+	(display-buffer (gud-find-file gdb-main-file))))))
 
 ;;from put-image
 (defun gdb-put-string (putstring pos &optional dprop)
@@ -1860,9 +1815,9 @@
 	  (when (< left-margin-width 2)
 	    (save-current-buffer
 	      (setq left-margin-width 2)
-	      (if (get-buffer-window (current-buffer) 'visible)
+	      (if (get-buffer-window (current-buffer) 0)
 		  (set-window-margins
-		   (get-buffer-window (current-buffer) 'visible)
+		   (get-buffer-window (current-buffer) 0)
 		   left-margin-width right-margin-width))))
 	  (put-image
 	   (if enabled
@@ -1887,9 +1842,9 @@
       (when (< left-margin-width 2)
 	(save-current-buffer
 	  (setq left-margin-width 2)
-	  (if (get-buffer-window (current-buffer) 'visible)
+	  (if (get-buffer-window (current-buffer) 0)
 	      (set-window-margins
-	       (get-buffer-window (current-buffer) 'visible)
+	       (get-buffer-window (current-buffer) 0)
 	       left-margin-width right-margin-width))))
       (gdb-put-string (if enabled "B" "b") (1+ start)))))
 
@@ -1899,9 +1854,9 @@
       (remove-images start end))
   (when remove-margin
     (setq left-margin-width 0)
-    (if (get-buffer-window (current-buffer) 'visible)
+    (if (get-buffer-window (current-buffer) 0)
 	(set-window-margins
-	 (get-buffer-window (current-buffer) 'visible)
+	 (get-buffer-window (current-buffer) 0)
 	 left-margin-width right-margin-width))))
 
 
@@ -1953,12 +1908,13 @@
 		  (if (re-search-forward address nil t)
 		      (gdb-put-breakpoint-icon (eq flag ?y))))))))
     (if (not (equal gdb-current-address "main"))
-	(set-window-point (get-buffer-window buffer 'visible) pos))))
+	(set-window-point (get-buffer-window buffer 0) pos))))
 
 (defvar gdb-assembler-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map)
-    map))
+    (define-key map "q" 'kill-this-buffer)
+     map))
 
 (defvar gdb-assembler-font-lock-keywords
   '(;; <__function.name+n>
@@ -2007,9 +1963,9 @@
 (defun gdb-frame-assembler-buffer ()
   "Display disassembly view in a new frame."
   (interactive)
-  (select-frame (make-frame gdb-frame-parameters))
-  (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))
-  (set-window-dedicated-p (selected-window) t))
+  (let ((special-display-regexps (append special-display-regexps '(".*")))
+	(special-display-frame-alist gdb-frame-parameters))
+    (display-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))))
 
 ;; modified because if gdb-current-address has changed value a new command
 ;; must be enqueued to update the buffer with the new output
@@ -2024,7 +1980,7 @@
 	  (progn
 	    ;; take previous disassemble command off the queue
 	    (with-current-buffer gud-comint-buffer
-	      (let ((queue gdb-input-queue) (item))
+	      (let ((queue gdb-input-queue))
 		(dolist (item queue)
 		  (if (equal (cdr item) '(gdb-assembler-handler))
 		      (setq gdb-input-queue
@@ -2064,14 +2020,9 @@
 		(setq gdb-current-address
 		      (concat "0x" (match-string 1 address)))
 	      (setq gdb-current-address (concat "0x" address))))
-	  (if (or (if (not (re-search-forward "(\\S-*:[0-9]*);" nil t))
-		      (progn (setq gdb-view-source nil) t))
-		  (eq gdb-selected-view 'assembler))
-	      (progn
-		(gdb-display-buffer
-		 (gdb-get-create-buffer 'gdb-assembler-buffer))
+	  (if (not (re-search-forward "(\\S-*:[0-9]*);" nil t))
 		;;update with new frame for machine code if necessary
-		(gdb-invalidate-assembler))))))
+		(gdb-invalidate-assembler)))))
     (if (re-search-forward " source language \\(\\S-*\\)\." nil t)
 	(setq gdb-current-language (match-string 1))))
 
--- a/lisp/progmodes/grep.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/grep.el	Wed Dec 08 22:20:27 2004 +0000
@@ -247,9 +247,12 @@
 
 ;;;###autoload
 (defvar grep-regexp-alist
-  '(("^\\(.+?\\)[:( \t]+\
+  ;; rms: I removed the code to match parens around the line number
+  ;; because it causes confusion and so we will find out if anyone needs it.
+  ;; It causes confusion with a file name that contains a number in parens.
+  '(("^\\(.+?\\)[: \t]+\
 \\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\
-\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[:) \t]" 1 (2 . 5) (4 . 6))
+\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[: \t]" 1 (2 . 5) (4 . 6))
     ("^\\(.+?\\)[:(]+\\([0-9]+\\)\\([:)]\\).*?\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)"
      1 2
      ;; Calculate column positions (beg . end) of first grep match on a line
--- a/lisp/progmodes/gud.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/gud.el	Wed Dec 08 22:20:27 2004 +0000
@@ -2587,9 +2587,7 @@
 	  (with-current-buffer gud-comint-buffer
 	    (gud-find-file true-file)))
 	 (window (and buffer (or (get-buffer-window buffer)
-				 (if (memq gud-minor-mode '(gdbmi gdba))
-				     (gdb-display-source-buffer buffer)
-				   (display-buffer buffer)))))
+				   (display-buffer buffer))))
 	 (pos))
     (if buffer
 	(progn
--- a/lisp/progmodes/prolog.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/prolog.el	Wed Dec 08 22:20:27 2004 +0000
@@ -101,7 +101,7 @@
   (make-local-variable 'paragraph-ignore-fill-prefix)
   (setq paragraph-ignore-fill-prefix t)
   (make-local-variable 'imenu-generic-expression)
-  (setq imenu-generic-expression "^[a-z][a-zA-Z0-9_]+")
+  (setq imenu-generic-expression '((nil "^\\sw+" 0)))
   (make-local-variable 'indent-line-function)
   (setq indent-line-function 'prolog-indent-line)
   (make-local-variable 'comment-start)
--- a/lisp/progmodes/python.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/python.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,6 @@
 ;;; python.el --- silly walks for Python
 
-;; Copyright (C) 2003, 04  Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004  Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Maintainer: FSF
@@ -103,7 +103,9 @@
 (defconst python-font-lock-syntactic-keywords
   ;; Make outer chars of matching triple-quote sequences into generic
   ;; string delimiters.  Fixme: Is there a better way?
-  `((,(rx (and (group (optional (any "uUrR"))) ; prefix gets syntax property
+  `((,(rx (and (or line-start buffer-start (not (syntax escape))) ; avoid escaped
+						       ; leading quote
+	       (group (optional (any "uUrR"))) ; prefix gets syntax property
 	       (optional (any "rR"))	; possible second prefix
 	       (group (syntax string-quote))	; maybe gets property
 	       (backref 2)			; per first quote
@@ -130,32 +132,31 @@
   ;;  ur"""ar""" x='"' # """
   ;; x = ''' """ ' a
   ;; '''
-  ;; x '"""' x
+  ;; x '"""' x """ \"""" x
   (save-excursion
     (goto-char (match-beginning 0))
-    (unless (eq ?\\ (char-before))
-      (cond
-       ;; Consider property for the last char if in a fenced string.
-       ((= n 3)
-	(let ((syntax (syntax-ppss)))
-	  (when (eq t (nth 3 syntax))	 ; after unclosed fence
-	    (goto-char (nth 8 syntax))	 ; fence position
-	    ;; Skip any prefix.
-	    (if (memq (char-after) '(?u ?U ?R ?r))
-		(skip-chars-forward "uUrR"))
-	    ;; Is it a matching sequence?
-	    (if (eq (char-after) (char-after (match-beginning 2)))
-		(eval-when-compile (string-to-syntax "|"))))))
-       ;; Consider property for initial char, accounting for prefixes.
-       ((or (and (= n 2)				; not prefix
-		 (= (match-beginning 1) (match-end 1)))	; prefix is null
-	    (and (= n 1)				; prefix
-		 (/= (match-beginning 1) (match-end 1)))) ; non-empty
-	(unless (eq 'string (syntax-ppss-context (syntax-ppss)))
-	  (eval-when-compile (string-to-syntax "|")))))
-      ;; Otherwise (we're in a non-matching string) the property is
-      ;; nil, which is OK.
-      )))
+    (cond
+     ;; Consider property for the last char if in a fenced string.
+     ((= n 3)
+      (let ((syntax (syntax-ppss)))
+	(when (eq t (nth 3 syntax))	; after unclosed fence
+	  (goto-char (nth 8 syntax))	; fence position
+	  ;; Skip any prefix.
+	  (if (memq (char-after) '(?u ?U ?R ?r))
+	      (skip-chars-forward "uUrR"))
+	  ;; Is it a matching sequence?
+	  (if (eq (char-after) (char-after (match-beginning 2)))
+	      (eval-when-compile (string-to-syntax "|"))))))
+     ;; Consider property for initial char, accounting for prefixes.
+     ((or (and (= n 2)			; not prefix
+	       (= (match-beginning 1) (match-end 1))) ; prefix is null
+	  (and (= n 1)			; prefix
+	       (/= (match-beginning 1) (match-end 1)))) ; non-empty
+      (unless (eq 'string (syntax-ppss-context (syntax-ppss)))
+	(eval-when-compile (string-to-syntax "|"))))
+     ;; Otherwise (we're in a non-matching string) the property is
+     ;; nil, which is OK.
+     )))
 
 ;; This isn't currently in `font-lock-defaults' as probably not worth
 ;; it -- we basically only mess with a few normally-symbol characters.
@@ -1127,7 +1128,7 @@
 buffer automatically.
 If there is a process already running in `*Python*', switch to
 that buffer.  Interactively, a prefix arg allows you to edit the initial
-command line (default is `python-command'); `-i' etc. args will be added
+command line (default is `python-command'); `-i' etc.  args will be added
 to this as appropriate.  Runs the hook `inferior-python-mode-hook'
 \(after the `comint-mode-hook' is run).
 \(Type \\[describe-mode] in the process buffer for a list of commands.)"
@@ -1143,12 +1144,12 @@
     (let* ((cmdlist (append (python-args-to-list cmd) '("-i")))
 	   (path (getenv "PYTHONPATH"))
 	   (process-environment		; to import emacs.py
-	    (push (concat "PYTHONPATH=" data-directory
+	    (cons (concat "PYTHONPATH=" data-directory
 			  (if path (concat ":" path)))
 		  process-environment)))
       (set-buffer (apply 'make-comint "Python" (car cmdlist) nil
 			 (cdr cmdlist)))
-      (setq python-buffer "*Python*"))
+      (setq python-buffer (buffer-name)))
     (inferior-python-mode)
     ;; Load function defintions we need.
     ;; Before the preoutput function was used, this was done via -c in
@@ -1204,13 +1205,12 @@
 	(set-marker orig-start (line-beginning-position 0)))
       (write-region "if True:\n" nil f nil 'nomsg))
     (write-region start end f t 'nomsg)
-    (let ((proc (python-proc)))		;Make sure we're running a process.
-      (with-current-buffer python-buffer
-	(python-send-command command)
-	;; Tell compile.el to redirect error locations in file `f' to
-	;; positions past marker `orig-start'.  It has to be done *after*
-	;; python-send-command's call to compilation-forget-errors.
-	(compilation-fake-loc orig-start f)))))
+    (with-current-buffer (process-buffer (python-proc))	;Runs python if needed.
+      (python-send-command command)
+      ;; Tell compile.el to redirect error locations in file `f' to
+      ;; positions past marker `orig-start'.  It has to be done *after*
+      ;; python-send-command's call to compilation-forget-errors.
+      (compilation-fake-loc orig-start f))))
 
 (defun python-send-string (string)
   "Evaluate STRING in inferior Python process."
@@ -1235,13 +1235,7 @@
   "Switch to the Python process buffer.
 With prefix arg, position cursor at end of buffer."
   (interactive "P")
-  ;; Start python unless we have a buffer.
-  (unless (and python-buffer
-	       (get-buffer python-buffer))
-    (run-python nil t))
-  (pop-to-buffer python-buffer)
-  ;; Make extra sure python is running in this buffer.
-  (python-proc)
+  (pop-to-buffer (process-buffer (python-proc))) ;Runs python if needed.
   (when eob-p
     (push-mark)
     (goto-char (point-max))))
@@ -1277,17 +1271,16 @@
   (comint-check-source file-name)     ; Check to see if buffer needs saving.
   (setq python-prev-dir/file (cons (file-name-directory file-name)
 				   (file-name-nondirectory file-name)))
-  (let ((proc (python-proc)))		;Make sure we have a process.
-    (with-current-buffer python-buffer
-      ;; Fixme: I'm not convinced by this logic from python-mode.el.
-      (python-send-command
-       (if (string-match "\\.py\\'" file-name)
-	   (let ((module (file-name-sans-extension
-			  (file-name-nondirectory file-name))))
-	     (format "emacs.eimport(%S,%S)"
-		     module (file-name-directory file-name)))
-	 (format "execfile(%S)" file-name)))
-      (message "%s loaded" file-name))))
+  (with-current-buffer (process-buffer (python-proc)) ;Runs python if needed.
+    ;; Fixme: I'm not convinced by this logic from python-mode.el.
+    (python-send-command
+     (if (string-match "\\.py\\'" file-name)
+	 (let ((module (file-name-sans-extension
+			(file-name-nondirectory file-name))))
+	   (format "emacs.eimport(%S,%S)"
+		   module (file-name-directory file-name)))
+       (format "execfile(%S)" file-name)))
+    (message "%s loaded" file-name)))
 
 ;; Fixme: If we need to start the process, wait until we've got the OK
 ;; from the startup.
--- a/lisp/progmodes/sh-script.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/sh-script.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1102,7 +1102,7 @@
   :type `(choice ,@ sh-number-or-symbol-list )
   :group 'sh-indentation)
 
-(defcustom sh-indent-for-then '+
+(defcustom sh-indent-for-then 0
   "*How much to indent a then relative to an if."
   :type `(choice ,@ sh-number-or-symbol-list )
   :group 'sh-indentation)
--- a/lisp/progmodes/tcl.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/tcl.el	Wed Dec 08 22:20:27 2004 +0000
@@ -438,7 +438,7 @@
 ;;    proc foo { \n {arg1 def} \n arg2 } {
 ;; The current setting handles the first case properly but not the second.
 ;; It also fails if `proc' is not in column-0 (e.g. it's in a namespace).
-(defconst tcl-omit-ws-regexp "^[^] \t\n#}].+[ \t]+")
+(defconst tcl-omit-ws-regexp "^[^]\" \t\n#}][^\n\"#]+[ \t]+")
 
 
 
--- a/lisp/progmodes/which-func.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/progmodes/which-func.el	Wed Dec 08 22:20:27 2004 +0000
@@ -243,15 +243,9 @@
 Uses `which-function-functions', `imenu--index-alist'
 or `add-log-current-defun-function'.
 If no function name is found, return nil."
-  (let (name)
-    ;; Try the which-function-functions functions first.
-    (let ((hooks which-func-functions))
-      (while hooks
-	(let ((value (funcall (car hooks))))
-	  (when value
-	    (setq name value
-		  hooks nil)))
-	(setq hooks (cdr hooks))))
+  (let ((name
+	 ;; Try the `which-function-functions' functions first.
+	 (run-hook-with-args-until-success 'which-func-functions)))
 
     ;; If Imenu is loaded, try to make an index alist with it.
     (when (and (null name)
--- a/lisp/replace.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/replace.el	Wed Dec 08 22:20:27 2004 +0000
@@ -734,18 +734,23 @@
   "Move to the Nth (default 1) next match in an Occur mode buffer.
 Compatibility function for \\[next-error] invocations."
   (interactive "p")
-  (when reset
-    (occur-find-match 0 #'next-single-property-change "No first match"))
-  (occur-find-match
-   (prefix-numeric-value argp)
-   (if (> 0 (prefix-numeric-value argp))
-       #'previous-single-property-change
-     #'next-single-property-change)
-   "No more matches")
-  ;; In case the *Occur* buffer is visible in a nonselected window.
-  (set-window-point (get-buffer-window (current-buffer)) (point))
-  (occur-mode-goto-occurrence))
-
+  ;; we need to run occur-find-match from within the Occur buffer
+  (with-current-buffer 
+      (if (next-error-buffer-p (current-buffer))
+	  (current-buffer)
+	(next-error-find-buffer nil nil (lambda() (eq major-mode 'occur-mode))))
+    
+    (when reset
+      (goto-char (point-min)))
+    (occur-find-match
+     (abs (prefix-numeric-value argp))
+     (if (> 0 (prefix-numeric-value argp))
+	 #'previous-single-property-change
+       #'next-single-property-change)
+     "No more matches")
+    ;; In case the *Occur* buffer is visible in a nonselected window.
+    (set-window-point (get-buffer-window (current-buffer)) (point))
+    (occur-mode-goto-occurrence)))
 
 (defcustom list-matching-lines-default-context-lines 0
   "*Default number of context lines included around `list-matching-lines' matches.
@@ -768,7 +773,7 @@
   :type 'face
   :group 'matching)
 
-(defun occur-accumulate-lines (count &optional no-props)
+(defun occur-accumulate-lines (count &optional keep-props)
   (save-excursion
     (let ((forwardp (> count 0))
 	  (result nil))
@@ -778,9 +783,9 @@
 			(bobp))))
 	(setq count (+ count (if forwardp -1 1)))
 	(push
-	 (funcall (if no-props
-		      #'buffer-substring-no-properties
-		    #'buffer-substring)
+	 (funcall (if keep-props
+		      #'buffer-substring
+		    #'buffer-substring-no-properties)
 	  (line-beginning-position)
 	  (line-end-position))
 	 result)
@@ -915,7 +920,7 @@
 		    (and case-fold-search
 			 (isearch-no-upper-case-p regexp t))
 		    list-matching-lines-buffer-name-face
-		    nil list-matching-lines-face nil)))
+		    nil list-matching-lines-face t)))
 	(let* ((bufcount (length active-bufs))
 	       (diff (- (length bufs) bufcount)))
 	  (message "Searched %d buffer%s%s; %s match%s for `%s'"
@@ -998,7 +1003,11 @@
 					     (append
 					      `(occur-match t)
 					      (when match-face
-						`(font-lock-face ,match-face)))
+						;; Use `face' rather than
+						;; `font-lock-face' here
+						;; so as to override faces
+						;; copied from the buffer.
+						`(face ,match-face)))
 					     curstring)
 			(setq start (match-end 0))))
 		    ;; Generate the string to insert for this match
--- a/lisp/reveal.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/reveal.el	Wed Dec 08 22:20:27 2004 +0000
@@ -151,6 +151,13 @@
 		 (overlay-put ol 'invisible inv))))))))
    (error (message "Reveal: %s" err)))))
 
+(defvar reveal-mode-map
+  (let ((map (make-sparse-keymap)))
+    ;; Override the default move-end-of-line which skips valuable
+    ;; invisible text.
+    (define-key map [?\C-e] 'end-of-line)
+    map))
+
 ;;;###autoload
 (define-minor-mode reveal-mode
   "Toggle Reveal mode on or off.
@@ -160,6 +167,7 @@
 With universal prefix ARG (or if ARG is nil) turn mode on.
 With zero or negative ARG turn mode off."
   :lighter (global-reveal-mode nil " Reveal")
+  :keymap reveal-mode-map
   (if reveal-mode
       (progn
 	(set (make-local-variable 'search-invisible) t)
--- a/lisp/ses.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/ses.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,4 +1,4 @@
-;;; ses.el -- Simple Emacs Spreadsheet
+;;; ses.el -- Simple Emacs Spreadsheet  -*- coding: utf-8 -*-
 
 ;; Copyright (C) 2002,03,04  Free Software Foundation, Inc.
 
@@ -23,7 +23,10 @@
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
 ;;; To-do list:
+
 ;; * Use $ or … for truncated fields
 ;; * Add command to make a range of columns be temporarily invisible.
 ;; * Allow paste of one cell to a range of cells -- copy formula to each.
@@ -35,12 +38,15 @@
 ;; * Left-margin column for row number.
 ;; * Move a row by dragging its number in the left-margin.
 
+
+;;; Code:
+
 (require 'unsafep)
 
 
-;;;----------------------------------------------------------------------------
-;;;; User-customizable variables
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; User-customizable variables
+;;----------------------------------------------------------------------------
 
 (defgroup ses nil
   "Simple Emacs Spreadsheet"
@@ -66,8 +72,9 @@
 		  function))
 
 (defcustom ses-after-entry-functions '(forward-char)
-  "Things to do after entering a value into a cell.  An abnormal hook that
-usually runs a cursor-movement function.  Each function is called with ARG=1."
+  "Things to do after entering a value into a cell.
+An abnormal hook that usually runs a cursor-movement function.
+Each function is called with ARG=1."
   :group 'ses
   :type 'hook
   :options '(forward-char backward-char next-line previous-line))
@@ -78,9 +85,9 @@
   :type 'hook)
 
 
-;;;----------------------------------------------------------------------------
-;;;; Global variables and constants
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Global variables and constants
+;;----------------------------------------------------------------------------
 
 (defvar ses-read-cell-history nil
   "List of formulas that have been typed in.")
@@ -92,7 +99,7 @@
   "Context menu when mouse-3 is used on the header-line in an SES buffer."
   '("SES header row"
     ["Set current row" ses-set-header-row t]
-    ["Unset row" ses-unset-header-row (> header-row 0)]))
+    ["Unset row" ses-unset-header-row (> ses--header-row 0)]))
 
 (defconst ses-mode-map
   (let ((keys `("\C-c\M-\C-l" ses-reconstruct-all
@@ -208,14 +215,14 @@
     map))
 
 (defconst ses-print-data-boundary "\n\014\n"
-  "Marker string denoting the boundary between print area and data area")
+  "Marker string denoting the boundary between print area and data area.")
 
 (defconst ses-initial-global-parameters
   "\n( ;Global parameters (these are read first)\n 2 ;SES file-format\n 1 ;numrows\n 1 ;numcols\n)\n\n"
-  "Initial contents for the three-element list at the bottom of the data area")
+  "Initial contents for the three-element list at the bottom of the data area.")
 
 (defconst ses-initial-file-trailer
-  ";;; Local Variables:\n;;; mode: ses\n;;; End:\n"
+  ";; Local Variables:\n;; mode: ses\n;; End:\n"
   "Initial contents for the file-trailer area at the bottom of the file.")
 
 (defconst ses-initial-file-contents
@@ -231,10 +238,6 @@
 	  ses-initial-file-trailer)
   "The initial contents of an empty spreadsheet.")
 
-(defconst ses-cell-size 4
-  "A cell consists of a SYMBOL, a FORMULA, a PRINTER-function, and a list of
-REFERENCES.")
-
 (defconst ses-paramlines-plist
   '(ses--col-widths  2 ses--col-printers  3 ses--default-printer  4
     ses--header-row  5 ses--file-format   8 ses--numrows          9
@@ -271,13 +274,13 @@
     (set x nil)))
 
 
-;;;
-;;;  "Side-effect variables".  They are set in one function, altered in
-;;;  another as a side effect, then read back by the first, as a way of
-;;;  passing back more than one value.  These declarations are just to make
-;;;  the compiler happy, and to conform to standard Emacs-Lisp practice (I
-;;;  think the make-local-variable trick above is cleaner).
-;;;
+;;
+;;  "Side-effect variables".  They are set in one function, altered in
+;;  another as a side effect, then read back by the first, as a way of
+;;  passing back more than one value.  These declarations are just to make
+;;  the compiler happy, and to conform to standard Emacs-Lisp practice (I
+;;  think the make-local-variable trick above is cleaner).
+;;
 
 (defvar ses-relocate-return nil
   "Set by `ses-relocate-formula' and `ses-relocate-range', read by
@@ -296,14 +299,19 @@
 when to emit a progress message.")
 
 
-;;;----------------------------------------------------------------------------
-;;;; Macros
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Macros
+;;----------------------------------------------------------------------------
 
 (defmacro ses-get-cell (row col)
   "Return the cell structure that stores information about cell (ROW,COL)."
   `(aref (aref ses--cells ,row) ,col))
 
+;; We might want to use defstruct here, but cells are explicitly used as
+;; arrays in ses-set-cell, so we'd need to fix this first.  --Stef
+(defsubst ses-make-cell (&optional symbol formula printer references)
+  (vector symbol formula printer references))
+
 (defmacro ses-cell-symbol (row &optional col)
   "From a CELL or a pair (ROW,COL), get the symbol that names the local-variable holding its value.  (0,0) => A1."
   `(aref ,(if col `(ses-get-cell ,row ,col) row) 0))
@@ -355,7 +363,7 @@
 	(setq printer `(ses-safe-printer ,printer)))
     (aset (aref ses--cells (car rowcol))
 	  (cdr rowcol)
-	  (vector sym formula printer references)))
+	  (ses-make-cell sym formula printer references)))
   (set sym value)
   sym)
 
@@ -455,9 +463,9 @@
   form)
 
 
-;;;----------------------------------------------------------------------------
-;;;; Utility functions
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Utility functions
+;;----------------------------------------------------------------------------
 
 (defun ses-vector-insert (array idx new)
   "Create a new vector which is one larger than ARRAY and has NEW inserted
@@ -538,9 +546,9 @@
 	(put sym 'ses-cell (cons xrow xcol))
 	(make-local-variable sym)))))
 
-;;;We do not delete the ses-cell properties for the cell-variables, in case a
-;;;formula that refers to this cell is in the kill-ring and is later pasted
-;;;back in.
+;;We do not delete the ses-cell properties for the cell-variables, in case a
+;;formula that refers to this cell is in the kill-ring and is later pasted
+;;back in.
 (defun ses-destroy-cell-variable-range (minrow maxrow mincol maxcol)
   "Destroy buffer-local variables for cells.  This is undoable."
   (let (sym)
@@ -570,9 +578,9 @@
   nil)
 
 
-;;;----------------------------------------------------------------------------
-;;;; The cells
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; The cells
+;;----------------------------------------------------------------------------
 
 (defun ses-set-cell (row col field val)
   "Install VAL as the contents for field FIELD (named by a quoted symbol) of
@@ -634,8 +642,7 @@
 the old and FORCE is nil."
   (let ((cell (ses-get-cell row col))
 	formula-error printer-error)
-    (let ((symbol  (ses-cell-symbol  cell))
-	  (oldval  (ses-cell-value   cell))
+    (let ((oldval  (ses-cell-value   cell))
 	  (formula (ses-cell-formula cell))
 	  newval)
       (if (eq (car-safe formula) 'ses-safe-formula)
@@ -717,17 +724,17 @@
     (goto-char pos)))
 
 
-;;;----------------------------------------------------------------------------
-;;;; The print area
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; The print area
+;;----------------------------------------------------------------------------
 
 (defun ses-in-print-area ()
   "Returns t if point is in print area of spreadsheet."
   (eq (get-text-property (point) 'keymap) 'ses-mode-print-map))
 
-;;;We turn off point-motion-hooks and explicitly position the cursor, in case
-;;;the intangible properties have gotten screwed up (e.g., when
-;;;ses-goto-print is called during a recursive ses-print-cell).
+;;We turn off point-motion-hooks and explicitly position the cursor, in case
+;;the intangible properties have gotten screwed up (e.g., when
+;;ses-goto-print is called during a recursive ses-print-cell).
 (defun ses-goto-print (row col)
   "Move point to print area for cell (ROW,COL)."
   (let ((inhibit-point-motion-hooks t))
@@ -772,11 +779,11 @@
     (error "Need a range"))))
 
 (defun ses-print-cell (row col)
-  "Format and print the value of cell (ROW,COL) to the print area, using the
-cell's printer function.  If the cell's new print form is too wide, it will
-spill over into the following cell, but will not run off the end of the row
-or overwrite the next non-nil field.  Result is nil for normal operation, or
-the error signal if the printer function failed and the cell was formatted
+  "Format and print the value of cell (ROW,COL) to the print area.
+Use the cell's printer function.  If the cell's new print form is too wide,
+it will spill over into the following cell, but will not run off the end of the
+row or overwrite the next non-nil field.  Result is nil for normal operation,
+or the error signal if the printer function failed and the cell was formatted
 with \"%s\".  If the cell's value is *skip*, nothing is printed because the
 preceding cell has spilled over."
   (catch 'ses-print-cell
@@ -948,16 +955,18 @@
       (ses-print-cell (car rowcol) (cdr rowcol)))))
 
 
-;;;----------------------------------------------------------------------------
-;;;; The data area
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; The data area
+;;----------------------------------------------------------------------------
+
+(defun ses-narrowed-p () (/= (- (point-max) (point-min)) (buffer-size)))
 
 (defun ses-goto-data (def &optional col)
   "Move point to data area for (DEF,COL).  If DEF is a row
 number, COL is the column number for a data cell -- otherwise DEF
 is one of the symbols ses--col-widths, ses--col-printers,
 ses--default-printer, ses--numrows, or ses--numcols."
-  (if (< (point-max) (buffer-size))
+  (if (ses-narrowed-p)
       (setq ses--deferred-narrow t))
   (widen)
   (let ((inhibit-point-motion-hooks t)) ;In case intangible attrs are wrong
@@ -971,10 +980,9 @@
     (forward-line (+ (* ses--numrows (+ ses--numcols 2)) def)))))
 
 (defun ses-set-parameter (def value &optional elem)
-  "Sets parameter DEF to VALUE (with undo) and writes the value to the data
-area.  See `ses-goto-data' for meaning of DEF.  Newlines in the data
-are escaped.  If ELEM is specified, it is the array subscript within DEF to
-be set to VALUE."
+  "Set parameter DEF to VALUE (with undo) and write the value to the data area.
+See `ses-goto-data' for meaning of DEF.  Newlines in the data are escaped.
+If ELEM is specified, it is the array subscript within DEF to be set to VALUE."
   (save-excursion
     ;;We call ses-goto-data early, using the old values of numrows and
     ;;numcols in case one of them is being changed.
@@ -995,8 +1003,8 @@
       (insert (format fmt (symbol-value def))))))
 
 (defun ses-write-cells ()
-  "`ses--deferred-write' is a list of (ROW,COL) for cells to be written from
-buffer-local variables to data area.  Newlines in the data are escaped."
+  "Write cells in `ses--deferred-write' from local variables to data area.
+Newlines in the data are escaped."
   (let* ((inhibit-read-only t)
 	 (print-escape-newlines t)
 	 rowcol row col cell sym formula printer text)
@@ -1041,9 +1049,9 @@
       (message " "))))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Formula relocation
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Formula relocation
+;;----------------------------------------------------------------------------
 
 (defun ses-formula-references (formula &optional result-so-far)
   "Produce a list of symbols for cells that this formula's value
@@ -1284,9 +1292,9 @@
       (message nil))))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Undo control
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; 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
@@ -1308,7 +1316,7 @@
 	ad-do-it
       ;;Here is some extra code for SES mode.
       (setq ses--deferred-narrow
-	    (or ses--deferred-narrow (< (point-max) (buffer-size))))
+	    (or ses--deferred-narrow (ses-narrowed-p)))
       (widen)
       (condition-case x
 	  ad-do-it
@@ -1353,9 +1361,9 @@
     t))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Startup for major mode
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Startup for major mode
+;;----------------------------------------------------------------------------
 
 (defun ses-load ()
   "Parse the current buffer and sets up buffer-local variables.  Does not
@@ -1363,10 +1371,9 @@
   (widen)
   ;;Read our global parameters, which should be a 3-element list
   (goto-char (point-max))
-  (search-backward ";;; Local Variables:\n" nil t)
+  (search-backward ";; Local Variables:\n" nil t)
   (backward-list 1)
-  (let ((params (condition-case nil (read (current-buffer)) (error nil)))
-	sym)
+  (let ((params (condition-case nil (read (current-buffer)) (error nil))))
     (or (and (= (safe-length params) 3)
 	     (numberp (car params))
 	     (numberp (cadr params))
@@ -1481,7 +1488,7 @@
 	(put-text-property pos end 'intangible sym)))
     ;;Adding these properties did not actually alter the text
     (unless was-modified
-      (set-buffer-modified-p nil)
+      (restore-buffer-modified-p nil)
       (buffer-disable-undo)
       (buffer-enable-undo)))
   ;;Create the underlining overlay.  It's impossible for (point) to be 2,
@@ -1494,8 +1501,7 @@
 overlay, remove special text properties."
   (widen)
   (let ((inhibit-read-only t)
-	(was-modified      (buffer-modified-p))
-	end)
+	(was-modified      (buffer-modified-p)))
     ;;Delete read-only, keymap, and intangible properties
     (set-text-properties (point-min) (point-max) nil)
     ;;Delete overlay
@@ -1639,50 +1645,37 @@
      (message (error-message-string err))))
   nil) ;Make coverage-tester happy
 
-(defun ses-header-string-left-offset ()
-  "Number of characters in left fringe and left scrollbar (if any)."
-  (let ((left-fringe    (round (or (frame-parameter nil 'left-fringe) 0)
-			       (frame-char-width)))
-	(left-scrollbar (if (not (eq (frame-parameter nil
-						      'vertical-scroll-bars)
-				     'left))
-			    0
-			  (let ((x (frame-parameter nil 'scroll-bar-width)))
-			    ;;Non-toolkil bar is always 14 pixels?
-			    (unless x (setq x 14))
-			    ;;Always round up
-			    (ceiling x (frame-char-width))))))
-    (+ left-fringe left-scrollbar)))
-
 (defun ses-create-header-string ()
-  "Sets up `ses--header-string' as the buffer's header line, based on the
-current set of columns and window-scroll position."
-  (let* ((left-offset (ses-header-string-left-offset))
-	 (totwidth (- left-offset (window-hscroll)))
-	 result width result x)
+  "Set up `ses--header-string' as the buffer's header line.
+Based on the current set of columns and `window-hscroll' position."
+  (let ((totwidth (- (window-hscroll)))
+	result width x)
     ;;Leave room for the left-side fringe and scrollbar
-    (push (make-string left-offset ? ) result)
+    (push (propertize " " 'display '((space :align-to 0))) result)
     (dotimes (col ses--numcols)
       (setq width    (ses-col-width col)
 	    totwidth (+ totwidth width 1))
-      (if (= totwidth (+ left-offset 1))
+      (if (= totwidth 1)
 	  ;;Scrolled so intercolumn space is leftmost
 	  (push " " result))
-      (when (> totwidth (+ left-offset 1))
+      (when (> totwidth 1)
 	(if (> ses--header-row 0)
 	    (save-excursion
 	      (ses-goto-print (1- ses--header-row) col)
 	      (setq x (buffer-substring-no-properties (point)
 						      (+ (point) width)))
-	      (if (>= width (- totwidth left-offset))
-		  (setq x (substring x (- width totwidth left-offset -1))))
-	      (push (propertize x 'face ses-box-prop) result))
-	  (setq x (ses-column-letter col))
+	      ;; Strip trailing space.
+	      (if (string-match "[ \t]+\\'" x)
+		  (setq x (substring x 0 (match-beginning 0))))
+	      ;; Cut off excess text.
+	      (if (>= (length x) totwidth)
+		  (setq x (substring x 0 (- totwidth -1)))))
+	  (setq x (ses-column-letter col)))
 	  (push (propertize x 'face ses-box-prop) result)
-	  (push (propertize (make-string (- width (length x)) ?.)
+	(push (propertize "."
 			    'display    `((space :align-to ,(1- totwidth)))
 			    'face       ses-box-prop)
-		result))
+	      result)
 	;;Allow the following space to be squished to make room for the 3-D box
 	;;Coverage test ignores properties, thinks this is always a space!
 	(push (1value (propertize " " 'display `((space :align-to ,totwidth))))
@@ -1694,9 +1687,9 @@
     (setq ses--header-string (apply 'concat (nreverse result)))))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Redisplay and recalculation
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Redisplay and recalculation
+;;----------------------------------------------------------------------------
 
 (defun ses-jump (sym)
   "Move point to cell SYM."
@@ -1814,7 +1807,7 @@
   (interactive "*")
   (ses-begin-change)
   ;;Reconstruct reference lists.
-  (let (refs x yrow ycol)
+  (let (x yrow ycol)
     ;;Delete old reference lists
     (ses-dotimes-msg (row ses--numrows) "Deleting references..."
       (dotimes (col ses--numcols)
@@ -1830,12 +1823,12 @@
 			(cons (ses-cell-symbol row col)
 			      (ses-cell-references yrow ycol)))))))
   ;;Delete everything and reconstruct basic data area
-  (if (< (point-max) (buffer-size))
+  (if (ses-narrowed-p)
       (setq ses--deferred-narrow t))
   (widen)
   (let ((inhibit-read-only t))
     (goto-char (point-max))
-    (if (search-backward ";;; Local Variables:\n" nil t)
+    (if (search-backward ";; Local Variables:\n" nil t)
 	(delete-region (point-min) (point))
       ;;Buffer is quite screwed up - can't even save the user-specified locals
       (delete-region (point-min) (point-max))
@@ -1862,9 +1855,9 @@
   (goto-char (point-min)))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Input of cell formulas
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Input of cell formulas
+;;----------------------------------------------------------------------------
 
 (defun ses-edit-cell (row col newval)
   "Display current cell contents in minibuffer, for editing.  Returns nil if
@@ -1968,9 +1961,9 @@
 	(ses-clear-cell (car rowcol) (cdr rowcol))))))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Input of cell-printer functions
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Input of cell-printer functions
+;;----------------------------------------------------------------------------
 
 (defun ses-read-printer (prompt default)
   "Common code for `ses-read-cell-printer', `ses-read-column-printer', and `ses-read-default-printer'.
@@ -2009,7 +2002,7 @@
 right-justified) or a list of one string (will be left-justified)."
   (interactive
    (let ((default t)
-	 prompt x)
+	 x)
      (ses-check-curcell 'range)
      ;;Default is none if not all cells in range have same printer
      (catch 'ses-read-cell-printer
@@ -2059,9 +2052,9 @@
     (ses-reprint-all t)))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Spreadsheet size adjustments
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Spreadsheet size adjustments
+;;----------------------------------------------------------------------------
 
 (defun ses-insert-row (count)
   "Insert a new row before the current one.  With prefix, insert COUNT rows
@@ -2085,7 +2078,7 @@
       ;;the call to ses-relocate-all.
       (setq newrow (make-vector ses--numcols nil))
       (dotimes (col ses--numcols)
-	(aset newrow col (make-vector ses-cell-size nil)))
+	(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)
       (insert ses--blank-line))
@@ -2122,8 +2115,7 @@
   (or (> count 0) (signal 'args-out-of-range nil))
   (let ((inhibit-quit t)
 	(inhibit-read-only t)
-	(row (car (ses-sym-rowcol ses--curcell)))
-	pos)
+	(row (car (ses-sym-rowcol ses--curcell))))
     (setq count (min count (- ses--numrows row)))
     (ses-begin-change)
     (ses-set-parameter 'ses--numrows (- ses--numrows count))
@@ -2149,10 +2141,10 @@
   (ses-jump-safe ses--curcell))
 
 (defun ses-insert-column (count &optional col width printer)
-  "Insert a new column before COL (default is the current one).  With prefix,
-insert COUNT columns before current one.  If COL is specified, the new
-column(s) get the specified WIDTH and PRINTER (otherwise they're taken from
-the current column)."
+  "Insert a new column before COL (default is the current one).
+With prefix, insert COUNT columns before current one.
+If COL is specified, the new column(s) get the specified WIDTH and PRINTER
+\(otherwise they're taken from the current column)."
   (interactive "*p")
   (ses-check-curcell)
   (or (> count 0) (signal 'args-out-of-range nil))
@@ -2181,8 +2173,7 @@
 	     (setq has-skip t))
 	(ses-aset-with-undo ses--cells row
 			    (ses-vector-insert (aref ses--cells row)
-					       col
-					      (make-vector ses-cell-size nil)))
+					       col (ses-make-cell)))
 	;;Insert empty lines in cell data area (will be replaced by
 	;;ses-relocate-all)
 	(ses-goto-data row col)
@@ -2217,7 +2208,7 @@
 	(inhibit-read-only t)
 	(rowcol  (ses-sym-rowcol ses--curcell))
 	(width 0)
-	new col origrow has-skip)
+	col origrow has-skip)
     (setq origrow (car rowcol)
 	  col     (cdr rowcol)
 	  count   (min count (- ses--numcols col)))
@@ -2320,9 +2311,9 @@
       (ses-print-cell-new-width row col))))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Cut and paste, import and export
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Cut and paste, import and export
+;;----------------------------------------------------------------------------
 
 (defadvice copy-region-as-kill (around ses-copy-region-as-kill
 				activate preactivate)
@@ -2654,9 +2645,9 @@
     (kill-new result)))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Other user commands
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Other user commands
+;;----------------------------------------------------------------------------
 
 (defun ses-unset-header-row ()
   "Select the default header row."
@@ -2829,9 +2820,9 @@
   (ses-insert-ses-range))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Checking formulas for safety
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Checking formulas for safety
+;;----------------------------------------------------------------------------
 
 (defun ses-safe-printer (printer)
   "Returns PRINTER if safe, or the substitute printer `ses-unsafe' otherwise."
@@ -2862,9 +2853,9 @@
 			formula checker)))))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Standard formulas
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Standard formulas
+;;----------------------------------------------------------------------------
 
 (defmacro ses-range (from to)
   "Expands to a list of cell-symbols for the range.  The range automatically
@@ -2880,8 +2871,8 @@
   "Return ARGS reversed, with the blank elements (nil and *skip*) removed."
   (let (result)
     (dolist (cur args)
-      (and cur (not (eq cur '*skip*))
-	   (push cur result)))
+      (unless (memq cur '(nil *skip*))
+	(push cur result)))
     result))
 
 (defun ses+ (&rest args)
@@ -2916,9 +2907,9 @@
   (put x 'side-effect-free t))
 
 
-;;;----------------------------------------------------------------------------
-;;;; Standard print functions
-;;;----------------------------------------------------------------------------
+;;----------------------------------------------------------------------------
+;; Standard print functions
+;;----------------------------------------------------------------------------
 
 ;;These functions use the variables 'row' and 'col' that are
 ;;dynamically bound by ses-print-cell.  We define these varables at
@@ -2982,5 +2973,5 @@
 
 (provide 'ses)
 
-;;; arch-tag: 88c1ccf0-4293-4824-8c5d-0757b52217f3
-;; ses.el ends here.
+;; arch-tag: 88c1ccf0-4293-4824-8c5d-0757b52217f3
+;;; ses.el ends here
--- a/lisp/simple.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/simple.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1,7 +1,7 @@
 ;;; simple.el --- basic editing commands for Emacs
 
-;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 99,
-;;               2000, 01, 02, 03, 2004
+;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+;;               2000, 2001, 2002, 2003, 2004
 ;;        Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -123,21 +123,33 @@
 
 (make-variable-buffer-local 'next-error-function)
 
-(defsubst next-error-buffer-p (buffer &optional extra-test)
-  "Test if BUFFER is a next-error capable buffer."
+(defsubst next-error-buffer-p (buffer 
+			       &optional 
+			       extra-test-inclusive 
+			       extra-test-exclusive)
+  "Test if BUFFER is a next-error capable buffer.
+EXTRA-TEST-INCLUSIVE is called to allow extra buffers.
+EXTRA-TEST-INCLUSIVE is called to disallow buffers."
   (with-current-buffer buffer
-    (or (and extra-test (funcall extra-test))
-	next-error-function)))
-
-(defun next-error-find-buffer (&optional other-buffer extra-test)
-  "Return a next-error capable buffer."
+    (or (and extra-test-inclusive (funcall extra-test-inclusive))
+	(and (if extra-test-exclusive (funcall extra-test-exclusive) t)
+	 next-error-function))))
+
+(defun next-error-find-buffer (&optional other-buffer 
+					 extra-test-inclusive 
+					 extra-test-exclusive)
+  "Return a next-error capable buffer.
+OTHER-BUFFER will disallow the current buffer.
+EXTRA-TEST-INCLUSIVE is called to allow extra buffers.
+EXTRA-TEST-INCLUSIVE is called to disallow buffers."
   (or
    ;; 1. If one window on the selected frame displays such buffer, return it.
    (let ((window-buffers
           (delete-dups
            (delq nil (mapcar (lambda (w)
                                (if (next-error-buffer-p
-                                    (window-buffer w) extra-test)
+                                    (window-buffer w) 
+				    extra-test-inclusive extra-test-exclusive)
                                    (window-buffer w)))
                              (window-list))))))
      (if other-buffer
@@ -147,24 +159,29 @@
    ;; 2. If next-error-last-buffer is set to a live buffer, use that.
    (if (and next-error-last-buffer
             (buffer-name next-error-last-buffer)
-            (next-error-buffer-p next-error-last-buffer extra-test)
+            (next-error-buffer-p next-error-last-buffer 
+				 extra-test-inclusive extra-test-exclusive)
             (or (not other-buffer)
                 (not (eq next-error-last-buffer (current-buffer)))))
        next-error-last-buffer)
    ;; 3. If the current buffer is a next-error capable buffer, return it.
    (if (and (not other-buffer)
-            (next-error-buffer-p (current-buffer) extra-test))
+            (next-error-buffer-p (current-buffer) 
+				 extra-test-inclusive extra-test-exclusive))
        (current-buffer))
    ;; 4. Look for a next-error capable buffer in a buffer list.
    (let ((buffers (buffer-list)))
      (while (and buffers
-                 (or (not (next-error-buffer-p (car buffers) extra-test))
+                 (or (not (next-error-buffer-p 
+			   (car buffers) 
+			   extra-test-inclusive extra-test-exclusive))
                      (and other-buffer (eq (car buffers) (current-buffer)))))
        (setq buffers (cdr buffers)))
      (if buffers
          (car buffers)
        (or (and other-buffer
-                (next-error-buffer-p (current-buffer) extra-test)
+                (next-error-buffer-p (current-buffer) 
+				     extra-test-inclusive extra-test-exclusive)
                 ;; The current buffer is a next-error capable buffer.
                 (progn
                   (if other-buffer
@@ -719,7 +736,7 @@
 (defun what-line ()
   "Print the current buffer line number and narrowed line number of point."
   (interactive)
-  (let ((opoint (point)) (start (point-min))
+  (let ((start (point-min))
 	(n (line-number-at-pos)))
     (if (= start 1)
 	(message "Line %d" n)
@@ -3111,8 +3128,7 @@
   ;; for intermediate positions.
   (let ((inhibit-point-motion-hooks t)
 	(opoint (point))
-	(forward (> arg 0))
-	new line-end line-beg)
+	(forward (> arg 0)))
     (unwind-protect
 	(progn
 	  (if (not (memq last-command '(next-line previous-line)))
@@ -3915,16 +3931,12 @@
 		   (setq blinkpos (scan-sexps oldpos -1)))
 	       (error nil)))
 	   (and blinkpos
-		(save-excursion
-		  (goto-char blinkpos)
-		  (not (looking-at "\\s$")))
+		(not (eq (car (syntax-after blinkpos)) 8)) ;Not syntax '$'.
 		(setq matching-paren
-		      (or (and parse-sexp-lookup-properties
-			       (let ((prop (get-text-property blinkpos 'syntax-table)))
-				 (and (consp prop)
-				      (eq (car prop) 4)
-				      (cdr prop))))
-			  (matching-paren (char-after blinkpos)))
+		      (let ((syntax (syntax-after blinkpos)))
+			(and (consp syntax)
+			     (eq (car syntax) 4)
+			     (cdr syntax)))
 		      mismatch
 		      (or (null matching-paren)
 			  (/= (char-after (1- oldpos))
--- a/lisp/startup.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/startup.el	Wed Dec 08 22:20:27 2004 +0000
@@ -959,6 +959,19 @@
 
   (run-hooks 'after-init-hook)
 
+  ;; Decode all default-directory.
+  (if (and default-enable-multibyte-characters locale-coding-system)
+      (save-excursion
+	(dolist (elt (buffer-list))
+	  (set-buffer elt)
+	  (if default-directory
+	      (setq default-directory
+		    (decode-coding-string default-directory
+					  locale-coding-system t))))
+	(setq command-line-default-directory
+	      (decode-coding-string command-line-default-directory
+				    locale-coding-system t))))
+
   ;; If *scratch* exists and init file didn't change its mode, initialize it.
   (if (get-buffer "*scratch*")
       (with-current-buffer "*scratch*"
--- a/lisp/subr.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/subr.el	Wed Dec 08 22:20:27 2004 +0000
@@ -422,7 +422,8 @@
 	    (nconc (nreverse skipped) newdef)))
       ;; Look past a symbol that names a keymap.
       (setq inner-def
-	    (condition-case nil (indirect-function defn) (error defn)))
+	    (and defn
+		 (condition-case nil (indirect-function defn) (error defn))))
       ;; For nested keymaps, we use `inner-def' rather than `defn' so as to
       ;; avoid autoloading a keymap.  This is mostly done to preserve the
       ;; original non-autoloading behavior of pre-map-keymap times.
@@ -2199,6 +2200,46 @@
       ;; Reconstruct a string from the pieces.
       (setq matches (cons (substring string start l) matches)) ; leftover
       (apply #'concat (nreverse matches)))))
+
+(defun subregexp-context-p (regexp pos &optional start)
+  "Return non-nil if POS is in a normal subregexp context in REGEXP.
+A subregexp context is one where a sub-regexp can appear.
+A non-subregexp context is for example within brackets, or within a repetition
+bounds operator \\{..\\}, or right after a \\.
+If START is non-nil, it should be a position in REGEXP, smaller than POS,
+and known to be in a subregexp context."
+  ;; Here's one possible implementation, with the great benefit that it
+  ;; reuses the regexp-matcher's own parser, so it understands all the
+  ;; details of the syntax.  A disadvantage is that it needs to match the
+  ;; error string.
+  (condition-case err
+      (progn
+        (string-match (substring regexp (or start 0) pos) "")
+        t)
+    (invalid-regexp
+     (not (member (cadr err) '("Unmatched [ or [^"
+                               "Unmatched \\{"
+                               "Trailing backslash")))))
+  ;; An alternative implementation:
+  ;; (defconst re-context-re
+  ;;   (let* ((harmless-ch "[^\\[]")
+  ;;          (harmless-esc "\\\\[^{]")
+  ;;          (class-harmless-ch "[^][]")
+  ;;          (class-lb-harmless "[^]:]")
+  ;;          (class-lb-colon-maybe-charclass ":\\([a-z]+:]\\)?")
+  ;;          (class-lb (concat "\\[\\(" class-lb-harmless
+  ;;                            "\\|" class-lb-colon-maybe-charclass "\\)"))
+  ;;          (class
+  ;;           (concat "\\[^?]?"
+  ;;                   "\\(" class-harmless-ch
+  ;;                   "\\|" class-lb "\\)*"
+  ;;                   "\\[?]"))     ; special handling for bare [ at end of re
+  ;;          (braces "\\\\{[0-9,]+\\\\}"))
+  ;;     (concat "\\`\\(" harmless-ch "\\|" harmless-esc
+  ;;             "\\|" class "\\|" braces "\\)*\\'"))
+  ;;   "Matches any prefix that corresponds to a normal subregexp context.")
+  ;; (string-match re-context-re (substring regexp (or start 0) pos))
+  )
 
 (defun shell-quote-argument (argument)
   "Quote an argument for passing as argument to an inferior shell."
@@ -2239,20 +2280,12 @@
     table))
 
 (defun syntax-after (pos)
-  "Return the syntax of the char after POS.
-The value is either a syntax class character (a character that designates
-a syntax in `modify-syntax-entry'), or a cons cell
-of the form (CLASS . MATCH), where CLASS is the syntax class character
-and MATCH is the matching parenthesis."
+  "Return the raw syntax of the char after POS."
   (unless (or (< pos (point-min)) (>= pos (point-max)))
-    (let* ((st (if parse-sexp-lookup-properties
-		   (get-char-property pos 'syntax-table)))
-	   (value
-	    (if (consp st) st
-	      (aref (or st (syntax-table)) (char-after pos))))
-	   (code (if (consp value) (car value) value)))
-      (setq code (aref "-.w_()'\"$\\/<>@!|" code))
-      (if (consp value) (cons code (cdr value)) code))))
+    (let ((st (if parse-sexp-lookup-properties
+		  (get-char-property pos 'syntax-table))))
+      (if (consp st) st
+	(aref (or st (syntax-table)) (char-after pos))))))
 
 (defun add-to-invisibility-spec (arg)
   "Add elements to `buffer-invisibility-spec'.
--- a/lisp/term.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/term.el	Wed Dec 08 22:20:27 2004 +0000
@@ -626,7 +626,7 @@
   "Keyboard map for sending characters directly to the inferior process.")
 (defvar term-escape-char nil
   "Escape character for char-sub-mode of term mode.
-Do not change it directly;  use term-set-escape-char instead.")
+Do not change it directly;  use `term-set-escape-char' instead.")
 (defvar term-raw-escape-map nil)
 
 (defvar term-pager-break-map nil)
@@ -959,7 +959,8 @@
 
 There are two submodes: line mode and char mode.  By default, you are
 in char mode.  In char sub-mode, each character (except
-`term-escape-char') is set immediately.
+`term-escape-char') is sent immediately to the subprocess.
+The escape character is equivalent to the usual meaning of C-x.
 
 In line mode, you send a line of input at a time; use
 \\[term-send-input] to send.
--- a/lisp/term/mac-win.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/term/mac-win.el	Wed Dec 08 22:20:27 2004 +0000
@@ -189,16 +189,406 @@
 (define-ccl-program ccl-encode-mac-roman-font
   `(0
     (if (r0 != ,(charset-id 'ascii))
-	(if (r0 == ,(charset-id 'latin-iso8859-1))
+	(if (r0 <= ?\x8f)
 	    (translate-character mac-roman-encoder r0 r1)
 	  ((r1 <<= 7)
 	   (r1 |= r2)
 	   (translate-character mac-roman-encoder r0 r1)))))
   "CCL program for Mac Roman font")
 
+(let
+    ((encoding-vector (make-vector 256 nil))
+     (i 0)
+     (vec	;; mac-centraleuropean (128..255) -> UCS mapping
+      [	#x00C4	;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS
+	#x0100	;; 129:LATIN CAPITAL LETTER A WITH MACRON
+	#x0101	;; 130:LATIN SMALL LETTER A WITH MACRON
+	#x00C9	;; 131:LATIN CAPITAL LETTER E WITH ACUTE
+	#x0104	;; 132:LATIN CAPITAL LETTER A WITH OGONEK
+	#x00D6	;; 133:LATIN CAPITAL LETTER O WITH DIAERESIS
+	#x00DC	;; 134:LATIN CAPITAL LETTER U WITH DIAERESIS
+	#x00E1	;; 135:LATIN SMALL LETTER A WITH ACUTE
+	#x0105	;; 136:LATIN SMALL LETTER A WITH OGONEK
+	#x010C	;; 137:LATIN CAPITAL LETTER C WITH CARON
+	#x00E4	;; 138:LATIN SMALL LETTER A WITH DIAERESIS
+	#x010D	;; 139:LATIN SMALL LETTER C WITH CARON
+	#x0106	;; 140:LATIN CAPITAL LETTER C WITH ACUTE
+	#x0107	;; 141:LATIN SMALL LETTER C WITH ACUTE
+	#x00E9	;; 142:LATIN SMALL LETTER E WITH ACUTE
+	#x0179	;; 143:LATIN CAPITAL LETTER Z WITH ACUTE
+	#x017A	;; 144:LATIN SMALL LETTER Z WITH ACUTE
+	#x010E	;; 145:LATIN CAPITAL LETTER D WITH CARON
+	#x00ED	;; 146:LATIN SMALL LETTER I WITH ACUTE
+	#x010F	;; 147:LATIN SMALL LETTER D WITH CARON
+	#x0112	;; 148:LATIN CAPITAL LETTER E WITH MACRON
+	#x0113	;; 149:LATIN SMALL LETTER E WITH MACRON
+	#x0116	;; 150:LATIN CAPITAL LETTER E WITH DOT ABOVE
+	#x00F3	;; 151:LATIN SMALL LETTER O WITH ACUTE
+	#x0117	;; 152:LATIN SMALL LETTER E WITH DOT ABOVE
+	#x00F4	;; 153:LATIN SMALL LETTER O WITH CIRCUMFLEX
+	#x00F6	;; 154:LATIN SMALL LETTER O WITH DIAERESIS
+	#x00F5	;; 155:LATIN SMALL LETTER O WITH TILDE
+	#x00FA	;; 156:LATIN SMALL LETTER U WITH ACUTE
+	#x011A	;; 157:LATIN CAPITAL LETTER E WITH CARON
+	#x011B	;; 158:LATIN SMALL LETTER E WITH CARON
+	#x00FC	;; 159:LATIN SMALL LETTER U WITH DIAERESIS
+	#x2020	;; 160:DAGGER
+	#x00B0	;; 161:DEGREE SIGN
+	#x0118	;; 162:LATIN CAPITAL LETTER E WITH OGONEK
+	#x00A3	;; 163:POUND SIGN
+	#x00A7	;; 164:SECTION SIGN
+	#x2022	;; 165:BULLET
+	#x00B6	;; 166:PILCROW SIGN
+	#x00DF	;; 167:LATIN SMALL LETTER SHARP S
+	#x00AE	;; 168:REGISTERED SIGN
+	#x00A9	;; 169:COPYRIGHT SIGN
+	#x2122	;; 170:TRADE MARK SIGN
+	#x0119	;; 171:LATIN SMALL LETTER E WITH OGONEK
+	#x00A8	;; 172:DIAERESIS
+	#x2260	;; 173:NOT EQUAL TO
+	#x0123	;; 174:LATIN SMALL LETTER G WITH CEDILLA
+	#x012E	;; 175:LATIN CAPITAL LETTER I WITH OGONEK
+	#x012F	;; 176:LATIN SMALL LETTER I WITH OGONEK
+	#x012A	;; 177:LATIN CAPITAL LETTER I WITH MACRON
+	#x2264	;; 178:LESS-THAN OR EQUAL TO
+	#x2265	;; 179:GREATER-THAN OR EQUAL TO
+	#x012B	;; 180:LATIN SMALL LETTER I WITH MACRON
+	#x0136	;; 181:LATIN CAPITAL LETTER K WITH CEDILLA
+	#x2202	;; 182:PARTIAL DIFFERENTIAL
+	#x2211	;; 183:N-ARY SUMMATION
+	#x0142	;; 184:LATIN SMALL LETTER L WITH STROKE
+	#x013B	;; 185:LATIN CAPITAL LETTER L WITH CEDILLA
+	#x013C	;; 186:LATIN SMALL LETTER L WITH CEDILLA
+	#x013D	;; 187:LATIN CAPITAL LETTER L WITH CARON
+	#x013E	;; 188:LATIN SMALL LETTER L WITH CARON
+	#x0139	;; 189:LATIN CAPITAL LETTER L WITH ACUTE
+	#x013A	;; 190:LATIN SMALL LETTER L WITH ACUTE
+	#x0145	;; 191:LATIN CAPITAL LETTER N WITH CEDILLA
+	#x0146	;; 192:LATIN SMALL LETTER N WITH CEDILLA
+	#x0143	;; 193:LATIN CAPITAL LETTER N WITH ACUTE
+	#x00AC	;; 194:NOT SIGN
+	#x221A	;; 195:SQUARE ROOT
+	#x0144	;; 196:LATIN SMALL LETTER N WITH ACUTE
+	#x0147	;; 197:LATIN CAPITAL LETTER N WITH CARON
+	#x2206	;; 198:INCREMENT
+	#x00AB	;; 199:LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+	#x00BB	;; 200:RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+	#x2026	;; 201:HORIZONTAL ELLIPSIS
+	#x00A0	;; 202:NO-BREAK SPACE
+	#x0148	;; 203:LATIN SMALL LETTER N WITH CARON
+	#x0150	;; 204:LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+	#x00D5	;; 205:LATIN CAPITAL LETTER O WITH TILDE
+	#x0151	;; 206:LATIN SMALL LETTER O WITH DOUBLE ACUTE
+	#x014C	;; 207:LATIN CAPITAL LETTER O WITH MACRON
+	#x2013	;; 208:EN DASH
+	#x2014	;; 209:EM DASH
+	#x201C	;; 210:LEFT DOUBLE QUOTATION MARK
+	#x201D	;; 211:RIGHT DOUBLE QUOTATION MARK
+	#x2018	;; 212:LEFT SINGLE QUOTATION MARK
+	#x2019	;; 213:RIGHT SINGLE QUOTATION MARK
+	#x00F7	;; 214:DIVISION SIGN
+	#x25CA	;; 215:LOZENGE
+	#x014D	;; 216:LATIN SMALL LETTER O WITH MACRON
+	#x0154	;; 217:LATIN CAPITAL LETTER R WITH ACUTE
+	#x0155	;; 218:LATIN SMALL LETTER R WITH ACUTE
+	#x0158	;; 219:LATIN CAPITAL LETTER R WITH CARON
+	#x2039	;; 220:SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+	#x203A	;; 221:SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+	#x0159	;; 222:LATIN SMALL LETTER R WITH CARON
+	#x0156	;; 223:LATIN CAPITAL LETTER R WITH CEDILLA
+	#x0157	;; 224:LATIN SMALL LETTER R WITH CEDILLA
+	#x0160	;; 225:LATIN CAPITAL LETTER S WITH CARON
+	#x201A	;; 226:SINGLE LOW-9 QUOTATION MARK
+	#x201E	;; 227:DOUBLE LOW-9 QUOTATION MARK
+	#x0161	;; 228:LATIN SMALL LETTER S WITH CARON
+	#x015A	;; 229:LATIN CAPITAL LETTER S WITH ACUTE
+	#x015B	;; 230:LATIN SMALL LETTER S WITH ACUTE
+	#x00C1	;; 231:LATIN CAPITAL LETTER A WITH ACUTE
+	#x0164	;; 232:LATIN CAPITAL LETTER T WITH CARON
+	#x0165	;; 233:LATIN SMALL LETTER T WITH CARON
+	#x00CD	;; 234:LATIN CAPITAL LETTER I WITH ACUTE
+	#x017D	;; 235:LATIN CAPITAL LETTER Z WITH CARON
+	#x017E	;; 236:LATIN SMALL LETTER Z WITH CARON
+	#x016A	;; 237:LATIN CAPITAL LETTER U WITH MACRON
+	#x00D3	;; 238:LATIN CAPITAL LETTER O WITH ACUTE
+	#x00D4	;; 239:LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+	#x016B	;; 240:LATIN SMALL LETTER U WITH MACRON
+	#x016E	;; 241:LATIN CAPITAL LETTER U WITH RING ABOVE
+	#x00DA	;; 242:LATIN CAPITAL LETTER U WITH ACUTE
+	#x016F	;; 243:LATIN SMALL LETTER U WITH RING ABOVE
+	#x0170	;; 244:LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+	#x0171	;; 245:LATIN SMALL LETTER U WITH DOUBLE ACUTE
+	#x0172	;; 246:LATIN CAPITAL LETTER U WITH OGONEK
+	#x0173	;; 247:LATIN SMALL LETTER U WITH OGONEK
+	#x00DD	;; 248:LATIN CAPITAL LETTER Y WITH ACUTE
+	#x00FD	;; 249:LATIN SMALL LETTER Y WITH ACUTE
+	#x0137	;; 250:LATIN SMALL LETTER K WITH CEDILLA
+	#x017B	;; 251:LATIN CAPITAL LETTER Z WITH DOT ABOVE
+	#x0141	;; 252:LATIN CAPITAL LETTER L WITH STROKE
+	#x017C	;; 253:LATIN SMALL LETTER Z WITH DOT ABOVE
+	#x0122	;; 254:LATIN CAPITAL LETTER G WITH CEDILLA
+	#x02C7	;; 255:CARON
+	])
+     translation-table)
+  (while (< i 128)
+    (aset encoding-vector i i)
+    (setq i (1+ i)))
+  (while (< i 256)
+    (aset encoding-vector i
+	  (decode-char 'ucs (aref vec (- i 128))))
+    (setq i (1+ i)))
+  (setq translation-table
+	(make-translation-table-from-vector encoding-vector))
+;;  (define-translation-table 'mac-centraleuropean-decoder translation-table)
+  (define-translation-table 'mac-centraleuropean-encoder
+    (char-table-extra-slot translation-table 0)))
+
+(let
+    ((encoding-vector (make-vector 256 nil))
+     (i 0)
+     (vec	;; mac-cyrillic (128..255) -> UCS mapping
+      [	#x0410	;; 128:CYRILLIC CAPITAL LETTER A
+	#x0411	;; 129:CYRILLIC CAPITAL LETTER BE
+	#x0412	;; 130:CYRILLIC CAPITAL LETTER VE
+	#x0413	;; 131:CYRILLIC CAPITAL LETTER GHE
+	#x0414	;; 132:CYRILLIC CAPITAL LETTER DE
+	#x0415	;; 133:CYRILLIC CAPITAL LETTER IE
+	#x0416	;; 134:CYRILLIC CAPITAL LETTER ZHE
+	#x0417	;; 135:CYRILLIC CAPITAL LETTER ZE
+	#x0418	;; 136:CYRILLIC CAPITAL LETTER I
+	#x0419	;; 137:CYRILLIC CAPITAL LETTER SHORT I
+	#x041A	;; 138:CYRILLIC CAPITAL LETTER KA
+	#x041B	;; 139:CYRILLIC CAPITAL LETTER EL
+	#x041C	;; 140:CYRILLIC CAPITAL LETTER EM
+	#x041D	;; 141:CYRILLIC CAPITAL LETTER EN
+	#x041E	;; 142:CYRILLIC CAPITAL LETTER O
+	#x041F	;; 143:CYRILLIC CAPITAL LETTER PE
+	#x0420	;; 144:CYRILLIC CAPITAL LETTER ER
+	#x0421	;; 145:CYRILLIC CAPITAL LETTER ES
+	#x0422	;; 146:CYRILLIC CAPITAL LETTER TE
+	#x0423	;; 147:CYRILLIC CAPITAL LETTER U
+	#x0424	;; 148:CYRILLIC CAPITAL LETTER EF
+	#x0425	;; 149:CYRILLIC CAPITAL LETTER HA
+	#x0426	;; 150:CYRILLIC CAPITAL LETTER TSE
+	#x0427	;; 151:CYRILLIC CAPITAL LETTER CHE
+	#x0428	;; 152:CYRILLIC CAPITAL LETTER SHA
+	#x0429	;; 153:CYRILLIC CAPITAL LETTER SHCHA
+	#x042A	;; 154:CYRILLIC CAPITAL LETTER HARD SIGN
+	#x042B	;; 155:CYRILLIC CAPITAL LETTER YERU
+	#x042C	;; 156:CYRILLIC CAPITAL LETTER SOFT SIGN
+	#x042D	;; 157:CYRILLIC CAPITAL LETTER E
+	#x042E	;; 158:CYRILLIC CAPITAL LETTER YU
+	#x042F	;; 159:CYRILLIC CAPITAL LETTER YA
+	#x2020	;; 160:DAGGER
+	#x00B0	;; 161:DEGREE SIGN
+	#x0490	;; 162:CYRILLIC CAPITAL LETTER GHE WITH UPTURN
+	#x00A3	;; 163:POUND SIGN
+	#x00A7	;; 164:SECTION SIGN
+	#x2022	;; 165:BULLET
+	#x00B6	;; 166:PILCROW SIGN
+	#x0406	;; 167:CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+	#x00AE	;; 168:REGISTERED SIGN
+	#x00A9	;; 169:COPYRIGHT SIGN
+	#x2122	;; 170:TRADE MARK SIGN
+	#x0402	;; 171:CYRILLIC CAPITAL LETTER DJE
+	#x0452	;; 172:CYRILLIC SMALL LETTER DJE
+	#x2260	;; 173:NOT EQUAL TO
+	#x0403	;; 174:CYRILLIC CAPITAL LETTER GJE
+	#x0453	;; 175:CYRILLIC SMALL LETTER GJE
+	#x221E	;; 176:INFINITY
+	#x00B1	;; 177:PLUS-MINUS SIGN
+	#x2264	;; 178:LESS-THAN OR EQUAL TO
+	#x2265	;; 179:GREATER-THAN OR EQUAL TO
+	#x0456	;; 180:CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+	#x00B5	;; 181:MICRO SIGN
+	#x0491	;; 182:CYRILLIC SMALL LETTER GHE WITH UPTURN
+	#x0408	;; 183:CYRILLIC CAPITAL LETTER JE
+	#x0404	;; 184:CYRILLIC CAPITAL LETTER UKRAINIAN IE
+	#x0454	;; 185:CYRILLIC SMALL LETTER UKRAINIAN IE
+	#x0407	;; 186:CYRILLIC CAPITAL LETTER YI
+	#x0457	;; 187:CYRILLIC SMALL LETTER YI
+	#x0409	;; 188:CYRILLIC CAPITAL LETTER LJE
+	#x0459	;; 189:CYRILLIC SMALL LETTER LJE
+	#x040A	;; 190:CYRILLIC CAPITAL LETTER NJE
+	#x045A	;; 191:CYRILLIC SMALL LETTER NJE
+	#x0458	;; 192:CYRILLIC SMALL LETTER JE
+	#x0405	;; 193:CYRILLIC CAPITAL LETTER DZE
+	#x00AC	;; 194:NOT SIGN
+	#x221A	;; 195:SQUARE ROOT
+	#x0192	;; 196:LATIN SMALL LETTER F WITH HOOK
+	#x2248	;; 197:ALMOST EQUAL TO
+	#x2206	;; 198:INCREMENT
+	#x00AB	;; 199:LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+	#x00BB	;; 200:RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+	#x2026	;; 201:HORIZONTAL ELLIPSIS
+	#x00A0	;; 202:NO-BREAK SPACE
+	#x040B	;; 203:CYRILLIC CAPITAL LETTER TSHE
+	#x045B	;; 204:CYRILLIC SMALL LETTER TSHE
+	#x040C	;; 205:CYRILLIC CAPITAL LETTER KJE
+	#x045C	;; 206:CYRILLIC SMALL LETTER KJE
+	#x0455	;; 207:CYRILLIC SMALL LETTER DZE
+	#x2013	;; 208:EN DASH
+	#x2014	;; 209:EM DASH
+	#x201C	;; 210:LEFT DOUBLE QUOTATION MARK
+	#x201D	;; 211:RIGHT DOUBLE QUOTATION MARK
+	#x2018	;; 212:LEFT SINGLE QUOTATION MARK
+	#x2019	;; 213:RIGHT SINGLE QUOTATION MARK
+	#x00F7	;; 214:DIVISION SIGN
+	#x201E	;; 215:DOUBLE LOW-9 QUOTATION MARK
+	#x040E	;; 216:CYRILLIC CAPITAL LETTER SHORT U
+	#x045E	;; 217:CYRILLIC SMALL LETTER SHORT U
+	#x040F	;; 218:CYRILLIC CAPITAL LETTER DZHE
+	#x045F	;; 219:CYRILLIC SMALL LETTER DZHE
+	#x2116	;; 220:NUMERO SIGN
+	#x0401	;; 221:CYRILLIC CAPITAL LETTER IO
+	#x0451	;; 222:CYRILLIC SMALL LETTER IO
+	#x044F	;; 223:CYRILLIC SMALL LETTER YA
+	#x0430	;; 224:CYRILLIC SMALL LETTER A
+	#x0431	;; 225:CYRILLIC SMALL LETTER BE
+	#x0432	;; 226:CYRILLIC SMALL LETTER VE
+	#x0433	;; 227:CYRILLIC SMALL LETTER GHE
+	#x0434	;; 228:CYRILLIC SMALL LETTER DE
+	#x0435	;; 229:CYRILLIC SMALL LETTER IE
+	#x0436	;; 230:CYRILLIC SMALL LETTER ZHE
+	#x0437	;; 231:CYRILLIC SMALL LETTER ZE
+	#x0438	;; 232:CYRILLIC SMALL LETTER I
+	#x0439	;; 233:CYRILLIC SMALL LETTER SHORT I
+	#x043A	;; 234:CYRILLIC SMALL LETTER KA
+	#x043B	;; 235:CYRILLIC SMALL LETTER EL
+	#x043C	;; 236:CYRILLIC SMALL LETTER EM
+	#x043D	;; 237:CYRILLIC SMALL LETTER EN
+	#x043E	;; 238:CYRILLIC SMALL LETTER O
+	#x043F	;; 239:CYRILLIC SMALL LETTER PE
+	#x0440	;; 240:CYRILLIC SMALL LETTER ER
+	#x0441	;; 241:CYRILLIC SMALL LETTER ES
+	#x0442	;; 242:CYRILLIC SMALL LETTER TE
+	#x0443	;; 243:CYRILLIC SMALL LETTER U
+	#x0444	;; 244:CYRILLIC SMALL LETTER EF
+	#x0445	;; 245:CYRILLIC SMALL LETTER HA
+	#x0446	;; 246:CYRILLIC SMALL LETTER TSE
+	#x0447	;; 247:CYRILLIC SMALL LETTER CHE
+	#x0448	;; 248:CYRILLIC SMALL LETTER SHA
+	#x0449	;; 249:CYRILLIC SMALL LETTER SHCHA
+	#x044A	;; 250:CYRILLIC SMALL LETTER HARD SIGN
+	#x044B	;; 251:CYRILLIC SMALL LETTER YERU
+	#x044C	;; 252:CYRILLIC SMALL LETTER SOFT SIGN
+	#x044D	;; 253:CYRILLIC SMALL LETTER E
+	#x044E	;; 254:CYRILLIC SMALL LETTER YU
+	#x20AC	;; 255:EURO SIGN
+	])
+     translation-table)
+  (while (< i 128)
+    (aset encoding-vector i i)
+    (setq i (1+ i)))
+  (while (< i 256)
+    (aset encoding-vector i
+	  (decode-char 'ucs (aref vec (- i 128))))
+    (setq i (1+ i)))
+  (setq translation-table
+	(make-translation-table-from-vector encoding-vector))
+;;  (define-translation-table 'mac-cyrillic-decoder translation-table)
+  (define-translation-table 'mac-cyrillic-encoder
+    (char-table-extra-slot translation-table 0)))
+
+(defvar mac-font-encoder-list
+  '(("mac-roman" mac-roman-encoder
+     ccl-encode-mac-roman-font "%s")
+    ("mac-centraleuropean" mac-centraleuropean-encoder
+     ccl-encode-mac-centraleuropean-font "%s ce")
+    ("mac-cyrillic" mac-cyrillic-encoder
+     ccl-encode-mac-cyrillic-font "%s cy")))
+
+(let ((encoder-list
+       (mapcar (lambda (lst) (nth 1 lst)) mac-font-encoder-list))
+      (charset-list
+       '(latin-iso8859-2
+	 latin-iso8859-3 latin-iso8859-4
+	 cyrillic-iso8859-5 greek-iso8859-7 hebrew-iso8859-8
+	 latin-iso8859-9 latin-iso8859-14 latin-iso8859-15)))
+  (dolist (encoder encoder-list)
+    (let ((table (get encoder 'translation-table)))
+      (dolist (charset charset-list)
+	(dotimes (i 96)
+	  (let* ((c (make-char charset (+ i 32)))
+		 (mu (aref ucs-mule-to-mule-unicode c))
+		 (mac-encoded (and mu (aref table mu))))
+	    (if mac-encoded
+		(aset table c mac-encoded))))))))
+
+(define-ccl-program ccl-encode-mac-centraleuropean-font
+  `(0
+    (if (r0 != ,(charset-id 'ascii))
+	(if (r0 <= ?\x8f)
+	    (translate-character mac-centraleuropean-encoder r0 r1)
+	  ((r1 <<= 7)
+	   (r1 |= r2)
+	   (translate-character mac-centraleuropean-encoder r0 r1)))))
+  "CCL program for Mac Central European font")
+
+(define-ccl-program ccl-encode-mac-cyrillic-font
+  `(0
+    (if (r0 != ,(charset-id 'ascii))
+	(if (r0 <= ?\x8f)
+	    (translate-character mac-cyrillic-encoder r0 r1)
+	  ((r1 <<= 7)
+	   (r1 |= r2)
+	   (translate-character mac-cyrillic-encoder r0 r1)))))
+  "CCL program for Mac Cyrillic font")
+
+
 (setq font-ccl-encoder-alist
-      (cons '("mac-roman" . ccl-encode-mac-roman-font)
-	    font-ccl-encoder-alist))
+      (nconc
+       (mapcar (lambda (lst) (cons (nth 0 lst) (nth 2 lst)))
+	       mac-font-encoder-list)
+       font-ccl-encoder-alist))
+
+(defun fontset-add-mac-fonts (fontset &optional base-family)
+  (if base-family
+      (setq base-family (downcase base-family))
+    (let ((ascii-font
+	   (downcase (x-resolve-font-name
+		      (fontset-font fontset (charset-id 'ascii))))))
+      (setq base-family (aref (x-decompose-font-name ascii-font)
+			      xlfd-regexp-family-subnum))))
+;;  (if (not (string-match "^fontset-" fontset))
+;;      (setq fontset
+;;	    (concat "fontset-" (aref (x-decompose-font-name fontset)
+;;				     xlfd-regexp-encoding-subnum))))
+  (dolist
+      (font-encoder
+       (nreverse
+	(mapcar (lambda (lst)
+		  (cons (cons (format (nth 3 lst) base-family) (nth 0 lst))
+			(nth 1 lst)))
+		mac-font-encoder-list)))
+    (let ((font (car font-encoder))
+	  (encoder (cdr font-encoder)))
+      (map-char-table
+       (lambda (key val)
+	 (or (null val)
+	     (generic-char-p key)
+	     (memq (char-charset key)
+		   '(ascii eight-bit-control eight-bit-graphic))
+	     (set-fontset-font fontset key font)))
+       (get encoder 'translation-table)))))
+ 
+(defun create-fontset-from-mac-roman-font (font &optional resolved-font
+						fontset-name)
+  "Create a fontset from a Mac roman font FONT.
+
+Optional 1st arg RESOLVED-FONT is a resolved name of FONT.  If
+omitted, `x-resolve-font-name' is called to get the resolved name.  At
+this time, if FONT is not available, error is signaled.
+
+Optional 2nd arg FONTSET-NAME is a string to be used in
+`<CHARSET_ENCODING>' fields of a new fontset name.  If it is omitted,
+an appropriate name is generated automatically.
+
+It returns a name of the created fontset."
+  (let ((fontset
+	 (create-fontset-from-ascii-font font resolved-font fontset-name)))
+    (fontset-add-mac-fonts fontset)
+    fontset))
 
 ;; Create a fontset that uses mac-roman font.  With this fontset,
 ;; characters decoded from mac-roman encoding (ascii, latin-iso8859-1,
@@ -211,15 +601,7 @@
       (create-fontset-from-fontset-spec
        "-etl-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-mac,
 ascii:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman")
-      (let ((monaco-font '("monaco" . "mac-roman")))
-	(map-char-table
-	 (function
-	  (lambda (key val)
-	    (or (generic-char-p key)
-		(memq (char-charset val)
-		      '(ascii eight-bit-control eight-bit-graphic))
-		(set-fontset-font "fontset-mac" val monaco-font))))
-	 (get 'mac-roman-decoder 'translation-table)))))
+      (fontset-add-mac-fonts "fontset-mac")))
 
 (if (eq system-type 'darwin)
     ;; On Darwin filenames are encoded in UTF-8
@@ -1025,7 +1407,7 @@
 		   "GhostWhite"
 		   "ghost white"
 		   "snow")
-  "The list of X colors from the `rgb.txt' file.
+ "The list of X colors from the `rgb.txt' file.
 XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
 
 ;;; arch-tag: 71dfcd14-cde8-4d66-b05c-85ec94fb23a6
--- a/lisp/term/x-win.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/term/x-win.el	Wed Dec 08 22:20:27 2004 +0000
@@ -2101,7 +2101,11 @@
   "The value of the PRIMARY X selection last time we selected or
 pasted text.")
 (defvar x-last-selected-text-cut nil
-  "The value of the X cut buffer last time we selected or pasted text.")
+  "The value of the X cut buffer last time we selected or pasted text.
+The actual text stored in the X cut buffer is what encoded from this value.")
+(defvar x-last-selected-text-cut-encoded nil
+  "The value of the X cut buffer last time we selected or pasted text.
+This is the actual text stored in the X cut buffer.")
 
 ;;; It is said that overlarge strings are slow to put into the cut buffer.
 ;;; Note this value is overridden below.
@@ -2124,19 +2128,14 @@
   ;; It becomes slow, and if really big it causes errors.
   (cond ((>= (length text) x-cut-buffer-max)
 	 (x-set-cut-buffer "" push)
-	 (setq x-last-selected-text-cut ""))
-	;; Don't store a multibyte string that contains
-	;; eight-bit-control/graphic chars because they can't be
-	;; restored correctly by x-get-cut-buffer.
-	((and (multibyte-string-p text)
-	      (let ((charsets (find-charset-string text)))
-		(or (memq 'eight-bit-control charsets)
-		    (memq 'eight-bit-graphic charsets))))
-	 (x-set-cut-buffer "" push)
-	 (setq x-last-selected-text-cut ""))
+	 (setq x-last-selected-text-cut ""
+	       x-last-selected-text-cut-encoded ""))
 	(t
-	 (x-set-cut-buffer text push)
-	 (setq x-last-selected-text-cut text)))
+	 (setq x-last-selected-text-cut text
+	       x-last-selected-text-cut-encoded
+	       (encode-coding-string text (or locale-coding-system
+					      'iso-latin-1)))
+	 (x-set-cut-buffer x-last-selected-text-cut-encoded push)))
   (x-set-selection 'PRIMARY text)
   (setq x-last-selected-text-primary text)
   (when x-select-enable-clipboard
@@ -2296,17 +2295,23 @@
     ;; from what we remebered them to be last time we did a
     ;; cut/paste operation.
     (setq cut-text
-	  (cond;; check primary selection
+	  (cond;; check cut buffer
 	   ((or (not cut-text) (string= cut-text ""))
 	    (setq x-last-selected-text-cut nil))
-	   ((eq      cut-text x-last-selected-text-cut) nil)
-	   ((string= cut-text x-last-selected-text-cut)
+	   ;; This short cut doesn't work because x-get-cut-buffer
+	   ;; always returns a newly created string.
+	   ;; ((eq      cut-text x-last-selected-text-cut) nil)
+	   ((string= cut-text x-last-selected-text-cut-encoded)
+	    ;; See the comment above.  No need of this recording.
 	    ;; Record the newer string,
 	    ;; so subsequent calls can use the `eq' test.
-	    (setq x-last-selected-text-cut cut-text)
-      nil)
-     (t
-	    (setq x-last-selected-text-cut cut-text))))
+	    ;; (setq x-last-selected-text-cut cut-text)
+	    nil)
+	   (t
+	    (setq x-last-selected-text-cut-encoded cut-text
+		  x-last-selected-text-cut
+		  (decode-coding-string cut-text (or locale-coding-system
+						     'iso-latin-1))))))
 
     ;; As we have done one selection, clear this now.
     (setq next-selection-coding-system nil)
--- a/lisp/textmodes/bibtex.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/textmodes/bibtex.el	Wed Dec 08 22:20:27 2004 +0000
@@ -34,8 +34,8 @@
 ;;  Major mode for editing and validating BibTeX files.
 
 ;;  Usage:
-;;  See documentation for function bibtex-mode (or type "\M-x describe-mode"
-;;  when you are in BibTeX mode).
+;;  See documentation for function bibtex-mode or type "\M-x describe-mode"
+;;  when you are in BibTeX mode.
 
 ;;  Todo:
 ;;  Distribute texinfo file.
@@ -63,26 +63,26 @@
   :type 'hook)
 
 (defcustom bibtex-field-delimiters 'braces
-  "*Type of field delimiters.  Allowed values are `braces' or `double-quotes'."
+  "Type of field delimiters.  Allowed values are `braces' or `double-quotes'."
   :group 'bibtex
   :type '(choice (const braces)
                  (const double-quotes)))
 
 (defcustom bibtex-entry-delimiters 'braces
-  "*Type of entry delimiters.  Allowed values are `braces' or `parentheses'."
+  "Type of entry delimiters.  Allowed values are `braces' or `parentheses'."
   :group 'bibtex
   :type '(choice (const braces)
                  (const parentheses)))
 
 (defcustom bibtex-include-OPTcrossref '("InProceedings" "InCollection")
-  "*List of entries that get an OPTcrossref field."
+  "List of BibTeX entries that get an OPTcrossref field."
   :group 'bibtex
   :type '(repeat string))
 
 (defcustom bibtex-include-OPTkey t
-  "*If non-nil, all entries will have an OPTkey field.
-If this is a string, it will be used as the initial field text.
-If this is a function, it will be called to generate the initial field text."
+  "If non-nil, all newly created entries get an OPTkey field.
+If this is a string, use it as the initial field text.
+If this is a function, call it to generate the initial field text."
   :group 'bibtex
   :type '(choice (const :tag "None" nil)
                  (string :tag "Initial text")
@@ -91,10 +91,9 @@
 
 (defcustom bibtex-user-optional-fields
   '(("annote" "Personal annotation (ignored)"))
-  "*List of optional fields the user wants to have always present.
+  "List of optional fields the user wants to have always present.
 Entries should be of the same form as the OPTIONAL and
-CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (see documentation
-of this variable for details)."
+CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (which see)."
   :group 'bibtex
   :type '(repeat (group (string :tag "Field")
                         (string :tag "Comment")
@@ -106,7 +105,7 @@
 
 (defcustom bibtex-entry-format
   '(opts-or-alts required-fields numerical-fields)
-  "*Type of formatting performed by `bibtex-clean-entry'.
+  "Type of formatting performed by `bibtex-clean-entry'.
 It may be t, nil, or a list of symbols out of the following:
 opts-or-alts        Delete empty optional and alternative fields and
                       remove OPT and ALT prefixes from used fields.
@@ -114,11 +113,9 @@
 numerical-fields    Delete delimiters around numeral fields.
 page-dashes         Change double dashes in page field to single dash
                       (for scribe compatibility).
-inherit-booktitle   If entry contains a crossref field and booktitle
-                      field is empty, it is set to the contents of the
-                      title field of the crossreferenced entry.
-                      Caution: this will work only if buffer is
-                       correctly sorted.
+inherit-booktitle   If entry contains a crossref field and the booktitle
+                      field is empty, set the booktitle field to the content
+                      of the title field of the crossreferenced entry.
 realign             Realign entries, so that field texts and perhaps equal
                       signs (depending on the value of
                       `bibtex-align-at-equal-sign') begin in the same column.
@@ -145,14 +142,14 @@
                       (const unify-case))))
 
 (defcustom bibtex-clean-entry-hook nil
-  "*List of functions to call when entry has been cleaned.
+  "List of functions to call when entry has been cleaned.
 Functions are called with point inside the cleaned entry, and the buffer
 narrowed to just the entry."
   :group 'bibtex
   :type 'hook)
 
 (defcustom bibtex-maintain-sorted-entries nil
-  "*If non-nil, BibTeX mode maintains all BibTeX entries in sorted order.
+  "If non-nil, BibTeX mode maintains all entries in sorted order.
 Allowed non-nil values are:
 plain        All entries are sorted alphabetically.
 crossref     All entries are sorted alphabetically unless an entry has a
@@ -168,50 +165,51 @@
                  (const crossref)
                  (const entry-class)))
 
-(defvar bibtex-sort-entry-class
+(defcustom bibtex-sort-entry-class
   '(("String")
     (catch-all)
     ("Book" "Proceedings"))
-  "*List of classes of BibTeX entry names, used for sorting entries.
+  "List of classes of BibTeX entry names, used for sorting entries.
 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 explicitely mentioned."
+  :group 'BibTeX
+  :type '(repeat (choice :tag "Class"
+                         (const :tag "catch-all" (catch-all))
+                         (repeat :tag "Entry name" string))))
 
 (defcustom bibtex-sort-ignore-string-entries t
-  "*If non-nil, BibTeX @String entries are not sort-significant.
+  "If non-nil, BibTeX @String entries are not sort-significant.
 That means they are ignored when determining ordering of the buffer
 \(e.g., sorting, locating alphabetical position for new entries, etc.)."
   :group 'bibtex
   :type 'boolean)
 
 (defcustom bibtex-field-kill-ring-max 20
-  "*Max length of `bibtex-field-kill-ring' before discarding oldest elements."
+  "Max length of `bibtex-field-kill-ring' before discarding oldest elements."
   :group 'bibtex
   :type 'integer)
 
 (defcustom bibtex-entry-kill-ring-max 20
-  "*Max length of `bibtex-entry-kill-ring' before discarding oldest elements."
+  "Max length of `bibtex-entry-kill-ring' before discarding oldest elements."
   :group 'bibtex
   :type 'integer)
 
 (defcustom bibtex-parse-keys-timeout 60
-  "*Specify interval for parsing BibTeX buffers.
-All BibTeX buffers in Emacs are parsed if Emacs has been idle
-`bibtex-parse-keys-timeout' seconds.  Only buffers which were modified
-after last parsing and which are maintained in sorted order are parsed."
+  "Time interval in seconds for parsing BibTeX buffers during idle time.
+Parsing initializes `bibtex-reference-keys' and `bibtex-strings'."
   :group 'bibtex
   :type 'integer)
 
 (defcustom bibtex-parse-keys-fast t
-  "*If non-nil, use fast but simplified algorithm for parsing BibTeX keys.
+  "If non-nil, use fast but simplified algorithm for parsing BibTeX keys.
 If parsing fails, try to set this variable to nil."
   :group 'bibtex
   :type 'boolean)
 
 (defvar bibtex-entry-field-alist
-  '(
-    ("Article"
+  '(("Article"
      ((("author" "Author1 [and Author2 ...] [and others]")
        ("title" "Title of the article (BibTeX converts it to lowercase)")
        ("journal" "Name of the journal (use string, remove braces)")
@@ -231,8 +229,8 @@
        ("month" "Month of the publication as a string (remove braces)")
        ("note" "Remarks to be put at the end of the \\bibitem"))))
     ("Book"
-     ((("author" "Author1 [and Author2 ...] [and others]" "" t)
-       ("editor" "Editor1 [and Editor2 ...] [and others]" "" t)
+     ((("author" "Author1 [and Author2 ...] [and others]" nil t)
+       ("editor" "Editor1 [and Editor2 ...] [and others]" nil t)
        ("title" "Title of the book")
        ("publisher" "Publishing company")
        ("year" "Year of publication"))
@@ -243,8 +241,8 @@
        ("edition" "Edition of the book as a capitalized English word")
        ("month" "Month of the publication as a string (remove braces)")
        ("note" "Remarks to be put at the end of the \\bibitem")))
-     ((("author" "Author1 [and Author2 ...] [and others]" "" t)
-       ("editor" "Editor1 [and Editor2 ...] [and others]" "" t)
+     ((("author" "Author1 [and Author2 ...] [and others]" nil t)
+       ("editor" "Editor1 [and Editor2 ...] [and others]" nil t)
        ("title" "Title of the book"))
       (("publisher" "Publishing company")
        ("year" "Year of publication")
@@ -264,8 +262,8 @@
        ("year" "Year of publication")
        ("note" "Remarks to be put at the end of the \\bibitem"))))
     ("InBook"
-     ((("author" "Author1 [and Author2 ...] [and others]" "" t)
-       ("editor" "Editor1 [and Editor2 ...] [and others]" "" t)
+     ((("author" "Author1 [and Author2 ...] [and others]" nil t)
+       ("editor" "Editor1 [and Editor2 ...] [and others]" nil t)
        ("title" "Title of the book")
        ("chapter" "Chapter in the book")
        ("publisher" "Publishing company")
@@ -279,8 +277,8 @@
        ("month" "Month of the publication as a string (remove braces)")
        ("pages" "Pages in the book")
        ("note" "Remarks to be put at the end of the \\bibitem")))
-     ((("author" "Author1 [and Author2 ...] [and others]" "" t)
-       ("editor" "Editor1 [and Editor2 ...] [and others]" "" t)
+     ((("author" "Author1 [and Author2 ...] [and others]" nil t)
+       ("editor" "Editor1 [and Editor2 ...] [and others]" nil t)
        ("title" "Title of the book")
        ("chapter" "Chapter in the book"))
       (("pages" "Pages in the book")
@@ -419,32 +417,34 @@
        ("title" "Title of the unpublished work (BibTeX converts it to lowercase)")
        ("note" "Remarks to be put at the end of the \\bibitem"))
       (("month" "Month of the publication as a string (remove braces)")
-       ("year" "Year of publication"))))
-    )
-
-  "Defines entry types and their associated fields.
-List of
-\(ENTRY-NAME (REQUIRED OPTIONAL) (CROSSREF-REQUIRED CROSSREF-OPTIONAL))
-triples.
-If the third element is nil, the first pair is always used.
-If not, the second pair is used in the case of presence of a crossref
-field and the third in the case of absence.
+       ("year" "Year of publication")))))
+
+  "List of BibTeX entry types and their associated fields.
+List elements are triples
+\(ENTRY-NAME (REQUIRED OPTIONAL) (CROSSREF-REQUIRED CROSSREF-OPTIONAL)).
+ENTRY-NAME is the name of a BibTeX entry.  The remaining pairs contain
+the required and optional fields of the BibTeX entry.
+The second pair is used if a crossref field is present
+and the first pair is used if a crossref field is absent.
+If the second pair is nil, the first pair is always used.
 REQUIRED, OPTIONAL, CROSSREF-REQUIRED and CROSSREF-OPTIONAL are lists.
 Each element of these lists is a list of the form
 \(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG).
 COMMENT-STRING, INIT, and ALTERNATIVE-FLAG are optional.
-FIELD-NAME is the name of the field, COMMENT-STRING the comment to
-appear in the echo area, INIT is either the initial content of the
+FIELD-NAME is the name of the field, COMMENT-STRING is the comment that
+appears in the echo area, INIT is either the initial content of the
 field or a function, which is called to determine the initial content
 of the field, and ALTERNATIVE-FLAG (either nil or t) marks if the
 field is an alternative.  ALTERNATIVE-FLAG may be t only in the
 REQUIRED or CROSSREF-REQUIRED lists.")
 
-(defvar bibtex-comment-start "@Comment"
-  "String starting a BibTeX comment.")
+(defcustom bibtex-comment-start "@Comment"
+  "String starting a BibTeX comment."
+  :group 'bibtex
+  :type 'string)
 
 (defcustom bibtex-add-entry-hook nil
-  "List of functions to call when entry has been inserted."
+  "List of functions to call when BibTeX entry has been inserted."
   :group 'bibtex
   :type 'hook)
 
@@ -497,9 +497,9 @@
                        (string :tag "String expansion"))))
 
 (defcustom bibtex-string-files nil
-  "*List of BibTeX files containing string definitions.
-List elements can be absolute file names or file names relative to the
-directories specified in `bibtex-string-file-path'."
+  "List of BibTeX files containing string definitions.
+List elements can be absolute file names or file names relative
+to the directories specified in `bibtex-string-file-path'."
   :group 'bibtex
   :type '(repeat file))
 
@@ -507,7 +507,7 @@
   "*Colon separated list of paths to search for `bibtex-string-files'.")
 
 (defcustom bibtex-files nil
-  "*List of BibTeX files checked for duplicate keys.
+  "List of BibTeX files that are searched for entry keys.
 List elements can be absolute file names or file names relative to the
 directories specified in `bibtex-file-path'.  If an element is a directory,
 check all BibTeX files in this directory.  If an element is the symbol
@@ -519,18 +519,18 @@
   "*Colon separated list of paths to search for `bibtex-files'.")
 
 (defcustom bibtex-help-message t
-  "*If non-nil print help messages in the echo area on entering a new field."
+  "If non-nil print help messages in the echo area on entering a new field."
   :group 'bibtex
   :type 'boolean)
 
 (defcustom bibtex-autokey-prefix-string ""
-  "*String to use as a prefix for all generated keys.
+  "String prefix for automatically generated reference keys.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type 'string)
 
 (defcustom bibtex-autokey-names 1
-  "*Number of names to use for the automatically generated reference key.
+  "Number of names to use for the automatically generated reference key.
 Possibly more names are used according to `bibtex-autokey-names-stretch'.
 If this variable is nil, all names are used.
 See `bibtex-generate-autokey' for details."
@@ -539,14 +539,14 @@
                  integer))
 
 (defcustom bibtex-autokey-names-stretch 0
-  "*Number of names that can additionally be used.
+  "Number of names that can additionally be used for reference keys.
 These names are used only, if all names are used then.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type 'integer)
 
 (defcustom bibtex-autokey-additional-names ""
-  "*String to prepend to the generated key if not all names could be used.
+  "String to append to the generated key if not all names could be used.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type 'string)
@@ -581,7 +581,7 @@
 (defcustom bibtex-autokey-name-change-strings
   bibtex-autokey-transcriptions
   "Alist of (OLD-REGEXP . NEW-STRING) pairs.
-Any part of name matching a OLD-REGEXP is replaced by NEW-STRING.
+Any part of a name matching OLD-REGEXP is replaced by NEW-STRING.
 Case is significant in OLD-REGEXP.  All regexps are tried in the
 order in which they appear in the list.
 See `bibtex-generate-autokey' for details."
@@ -590,7 +590,7 @@
                        (string :tag "New"))))
 
 (defcustom bibtex-autokey-name-case-convert 'downcase
-  "*Function called for each name to perform case conversion.
+  "Function called for each name to perform case conversion.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type '(choice (const :tag "Preserve case" identity)
@@ -600,7 +600,7 @@
                  (function :tag "Conversion function")))
 
 (defcustom bibtex-autokey-name-length 'infty
-  "*Number of characters from name to incorporate into key.
+  "Number of characters from name to incorporate into key.
 If this is set to anything but a number, all characters are used.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
@@ -608,19 +608,19 @@
                  integer))
 
 (defcustom bibtex-autokey-name-separator ""
-  "*String that comes between any two names in the key.
+  "String that comes between any two names in the key.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type 'string)
 
 (defcustom bibtex-autokey-year-length 2
-  "*Number of rightmost digits from the year field to incorporate into key.
+  "Number of rightmost digits from the year field to incorporate into key.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type 'integer)
 
 (defcustom bibtex-autokey-use-crossref t
-  "*If non-nil use fields from crossreferenced entry if necessary.
+  "If non-nil use fields from crossreferenced entry if necessary.
 If this variable is non-nil and some field has no entry, but a
 valid crossref entry, the field from the crossreferenced entry is used.
 See `bibtex-generate-autokey' for details."
@@ -628,7 +628,7 @@
   :type 'boolean)
 
 (defcustom bibtex-autokey-titlewords 5
-  "*Number of title words to use for the automatically generated reference key.
+  "Number of title words to use for the automatically generated reference key.
 If this is set to anything but a number, all title words are used.
 Possibly more words from the title are used according to
 `bibtex-autokey-titlewords-stretch'.
@@ -637,16 +637,14 @@
   :type '(choice (const :tag "All" infty)
                  integer))
 
-(defcustom bibtex-autokey-title-terminators
-  '("\\." "!"  "\\?" ":" ";" "--")
-  "*Regexp list defining the termination of the main part of the title.
-Case of the regexps is ignored.
-See `bibtex-generate-autokey' for details."
+(defcustom bibtex-autokey-title-terminators "[.!?:;]\\|--"
+  "Regexp defining the termination of the main part of the title.
+Case of the regexps is ignored.  See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
-  :type '(repeat regexp))
+  :type 'regexp)
 
 (defcustom bibtex-autokey-titlewords-stretch 2
-  "*Number of words that can additionally be used from the title.
+  "Number of words that can additionally be used from the title.
 These words are used only, if a sentence from the title can be ended then.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
@@ -655,7 +653,7 @@
 (defcustom bibtex-autokey-titleword-ignore
   '("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.
+  "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
 regexp from that list, it is not included in the title part of the key.
 See `bibtex-generate-autokey' for details."
@@ -663,7 +661,7 @@
   :type '(repeat regexp))
 
 (defcustom bibtex-autokey-titleword-case-convert 'downcase
-  "*Function called for each titleword to perform case conversion.
+  "Function called for each titleword to perform case conversion.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type '(choice (const :tag "Preserve case" identity)
@@ -673,7 +671,7 @@
                  (function :tag "Conversion function")))
 
 (defcustom bibtex-autokey-titleword-abbrevs nil
-  "*Determines exceptions to the usual abbreviation mechanism.
+  "Determines exceptions to the usual abbreviation mechanism.
 An alist of (OLD-REGEXP . NEW-STRING) pairs.  Case is ignored
 in matching against OLD-REGEXP, and the first matching pair is used.
 See `bibtex-generate-autokey' for details."
@@ -693,7 +691,7 @@
                        (string :tag "New"))))
 
 (defcustom bibtex-autokey-titleword-length 5
-  "*Number of characters from title words to incorporate into key.
+  "Number of characters from title words to incorporate into key.
 If this is set to anything but a number, all characters are used.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
@@ -701,70 +699,69 @@
                  integer))
 
 (defcustom bibtex-autokey-titleword-separator "_"
-  "*String to be put between the title words.
+  "String to be put between the title words.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type 'string)
 
 (defcustom bibtex-autokey-name-year-separator ""
-  "*String to be put between name part and year part of key.
+  "String to be put between name part and year part of key.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type 'string)
 
 (defcustom bibtex-autokey-year-title-separator ":_"
-  "*String to be put between name part and year part of key.
+  "String to be put between name part and year part of key.
 See `bibtex-generate-autokey' for details."
   :group 'bibtex-autokey
   :type 'string)
 
 (defcustom bibtex-autokey-edit-before-use t
-  "*If non-nil, user is allowed to edit the generated key before it is used."
+  "If non-nil, user is allowed to edit the generated key before it is used."
   :group 'bibtex-autokey
   :type 'boolean)
 
 (defcustom bibtex-autokey-before-presentation-function nil
-  "*Function to call before the generated key is presented.
-If non-nil this should be a function which is called before the generated key
-is presented.  The function must take one argument (the automatically
-generated key), and must return a string (the key to use)."
+  "If non-nil, function to call before generated key is presented.
+The function must take one argument (the automatically generated key),
+and must return a string (the key to use)."
   :group 'bibtex-autokey
   :type '(choice (const nil) function))
 
 (defcustom bibtex-entry-offset 0
-  "*Offset for BibTeX entries.
+  "Offset for BibTeX entries.
 Added to the value of all other variables which determine colums."
   :group 'bibtex
   :type 'integer)
 
 (defcustom bibtex-field-indentation 2
-  "*Starting column for the name part in BibTeX fields."
+  "Starting column for the name part in BibTeX fields."
   :group 'bibtex
   :type 'integer)
 
 (defcustom bibtex-text-indentation
   (+ bibtex-field-indentation
      (length "organization = "))
-  "*Starting column for the text part in BibTeX fields.
+  "Starting column for the text part in BibTeX fields.
 Should be equal to the space needed for the longest name part."
   :group 'bibtex
   :type 'integer)
 
 (defcustom bibtex-contline-indentation
   (+ bibtex-text-indentation 1)
-  "*Starting column for continuation lines of BibTeX fields."
+  "Starting column for continuation lines of BibTeX fields."
   :group 'bibtex
   :type 'integer)
 
 (defcustom bibtex-align-at-equal-sign nil
-  "*If non-nil, align fields at equal sign instead of field text.
+  "If non-nil, align fields at equal sign instead of field text.
 If non-nil, the column for the equal sign is the value of
 `bibtex-text-indentation', minus 2."
   :group 'bibtex
   :type 'boolean)
 
 (defcustom bibtex-comma-after-last-field nil
-  "*If non-nil, a comma is put at end of last field in the entry template."
+  "If non-nil, a comma is put at end of last field in the entry template."
   :group 'bibtex
   :type 'boolean)
 
@@ -781,7 +778,7 @@
 (defcustom bibtex-summary-function 'bibtex-summary
   "Function to call for generating a one-line summary of a BibTeX entry.
 It takes one argument, the key of the entry.
-Used by `bibtex-complete-key-cleanup' and `bibtex-copy-summary-as-kill'."
+Used by `bibtex-complete-crossref-cleanup' and `bibtex-copy-summary-as-kill'."
   :group 'bibtex
   :type '(choice (const :tag "Default" bibtex-summary)
                  (function :tag "Personalized function")))
@@ -790,7 +787,7 @@
   '((("url" . ".*:.*"))
     ;; Example of a complex setup.
     (("journal" . "\\<\\(PR[ABCDEL]?\\|RMP\\)\\>")
-     "http://publish.aps.org/abstract/"
+     "http://link.aps.org/abstract/"
      ("journal" ".*" downcase)
      "/v"
      ("volume" ".*" 0)
@@ -803,8 +800,8 @@
 
 FIELD is a field name as returned by `bibtex-parse-entry'.
 REGEXP is matched against the text of FIELD.  If the match succeeds, then
-this scheme will be used.  If no STEPS are specified the matched text is used
-as the URL, otherwise the URL is built by concatenating the STEPS.
+this scheme is used.  If no STEPs are specified the matched text is used
+as the URL, otherwise the URL is built by concatenating the STEPs.
 
 A STEP can be a string or a list (FIELD REGEXP REPLACE) in which case
 the text of FIELD is matched against REGEXP, and is replaced with REPLACE.
@@ -862,6 +859,7 @@
     (define-key km "\C-c\C-c" 'bibtex-clean-entry)
     (define-key km "\C-c\C-q" 'bibtex-fill-entry)
     (define-key km "\C-c\C-s" 'bibtex-find-entry)
+    (define-key km "\C-c\C-x" 'bibtex-find-crossref)
     (define-key km "\C-c\C-t" 'bibtex-copy-summary-as-kill)
     (define-key km "\C-c?" 'bibtex-print-help-message)
     (define-key km "\C-c\C-p" 'bibtex-pop-previous)
@@ -913,12 +911,12 @@
      ["End of Field" bibtex-find-text t]
      ["Next Field" bibtex-next-field t]
      ["Beginning of Entry" bibtex-beginning-of-entry t]
-     ["End of Entry" bibtex-end-of-entry t])
-    ("Moving in BibTeX Buffer"
+     ["End of Entry" bibtex-end-of-entry t]
+    "--"
+     ["Make Entry Visible" bibtex-reposition-window t])
+    ("Moving in BibTeX Buffers"
      ["Find Entry" bibtex-find-entry t]
      ["Find Crossref Entry" bibtex-find-crossref t])
-    ("Moving between BibTeX Buffers"
-     ["Find Entry Globally" bibtex-find-entry-globally t])
     "--"
     ("Operating on Current Field"
      ["Fill Field" fill-paragraph t]
@@ -950,10 +948,13 @@
      ["Paste Previously Killed Entry" bibtex-yank-pop t]
      "--"
      ["Copy Summary to Kill Ring" bibtex-copy-summary-as-kill t]
+     ["Browse URL" bibtex-url t]
      "--"
      ["Ispell Entry" bibtex-ispell-entry t]
      ["Ispell Entry Abstract" bibtex-ispell-abstract t]
+     "--"
      ["Narrow to Entry" bibtex-narrow-to-entry t]
+     ["Mark Entry" bibtex-mark-entry t]
      "--"
      ["View Cite Locations (RefTeX)" reftex-view-crossref-from-bibtex
       (fboundp 'reftex-view-crossref-from-bibtex)])
@@ -983,6 +984,7 @@
         ["Technical Manual" bibtex-Manual t]
         ["Unpublished" bibtex-Unpublished t]
         ["Miscellaneous" bibtex-Misc t]
+        "--"
         ["String" bibtex-String t]
         ["Preamble" bibtex-Preamble t]))
 
@@ -1085,12 +1087,18 @@
 (defconst bibtex-key-in-head 2
   "Regexp subexpression number of the key part in `bibtex-entry-head'.")
 
+(defconst bibtex-string-maybe-empty-head
+  (concat "^[ \t]*\\(@String\\)[ \t]*[({]\\("
+          bibtex-reference-key
+          "\\)?")
+  "Regexp matching the header line of a BibTeX String entry.")
+
 (defconst bibtex-entry-postfix "[ \t\n]*,?[ \t\n]*[})]"
   "Regexp matching the postfix of a BibTeX entry.")
 
 (defvar bibtex-known-entry-type-re
   (regexp-opt (mapcar 'car bibtex-entry-field-alist))
-  "Regexp matching the name of a BibTeX entry type.")
+  "Regexp matching the name of a BibTeX entry.")
 
 (defvar bibtex-valid-entry-re
   (concat "@[ \t]*\\(" bibtex-known-entry-type-re "\\)")
@@ -1133,7 +1141,8 @@
 
 (defvar bibtex-font-lock-url-regexp
   ;; Assume that field names begin at the beginning of a line.
-  (concat "^[ \t]*" (regexp-opt (mapcar 'caar bibtex-generate-url-list) t)
+  (concat "^[ \t]*"
+          (regexp-opt (delete-dups (mapcar 'caar bibtex-generate-url-list)) t)
           "[ \t]*=[ \t]*")
   "Regexp for `bibtex-font-lock-url'.")
 
@@ -1226,7 +1235,7 @@
   "Syntax-table to parse matched quotes.")
 
 (defun bibtex-parse-field-string ()
-  "Parse a field string enclosed by braces or quotes.
+  "Parse a BibTeX field string enclosed by braces or quotes.
 If a syntactically correct string is found, a pair containing the start and
 end position of the field string is returned, nil otherwise."
   (let ((end-point
@@ -1273,7 +1282,7 @@
                               'bibtex-parse-field-text)))
 
 (defun bibtex-search-forward-field (name &optional bound)
-  "Search forward to find a field of name NAME.
+  "Search forward to find a BibTeX field of name NAME.
 If a syntactically correct field is found, a pair containing the boundaries of
 the name and text parts of the field is returned.  The search is limited by
 optional arg BOUND.  If BOUND is t the search is limited by the end of the
@@ -1300,7 +1309,7 @@
         boundaries))))
 
 (defun bibtex-search-backward-field (name &optional bound)
-  "Search backward to find a field of name NAME.
+  "Search backward to find a BibTeX field of name NAME.
 If a syntactically correct field is found, a pair containing the boundaries of
 the name and text parts of the field is returned.  The search is limited by
 optional arg BOUND.  If BOUND is t the search is limited by the beginning of the
@@ -1352,13 +1361,13 @@
 if present."
   (let ((content (buffer-substring-no-properties (cadr bounds)
                                                  (cddr bounds))))
-    (if (and remove-delim
-             (string-match "\\`[{\"]\\(.*\\)[}\"]\\'" content))
-        (substring content (match-beginning 1) (match-end 1))
+    (if remove-delim
+        (bibtex-remove-delimiters-string content)
       content)))
 
 (defun bibtex-text-in-field (field &optional follow-crossref)
-  "Get content of field FIELD of current BibTeX entry.  Return nil if not found.
+  "Get content of field FIELD of current BibTeX entry.
+Return nil if not found.
 If optional arg FOLLOW-CROSSREF is non-nil, follow crossref."
   (save-excursion
     (save-restriction
@@ -1458,9 +1467,8 @@
 delimiters if present."
   (let ((content (buffer-substring-no-properties (nth 0 (cdr bounds))
                                                  (nth 1 (cdr bounds)))))
-    (if (and remove-delim
-             (string-match "\\`[{\"]\\(.*\\)[}\"]\\'" content))
-        (substring content (match-beginning 1) (match-end 1))
+    (if remove-delim
+        (bibtex-remove-delimiters-string content)
       content)))
 
 (defsubst bibtex-start-of-text-in-string (bounds)
@@ -1483,6 +1491,13 @@
 
 ;; Helper Functions
 
+(defun bibtex-remove-delimiters-string (str)
+  "Remove delimiters of string STR."
+  (if (and (memq (aref str 0) '(?\{ ?\"))
+           (memq (aref str (1- (length str))) '(?\} ?\")))
+      (substring str 1 -1)
+    str))
+
 (defsubst bibtex-string= (str1 str2)
   "Return t if STR1 and STR2 are equal, ignoring case."
   (eq t (compare-strings str1 0 nil str2 0 nil t)))
@@ -1531,7 +1546,7 @@
   "Call FUN for each BibTeX entry in buffer (possibly narrowed).
 FUN is called with three arguments, the key of the entry and the buffer
 positions (marker) of beginning and end of entry.  Point is inside the entry.
-If `bibtex-sort-ignore-string-entries' is non-nil, FUN will not be called for
+If `bibtex-sort-ignore-string-entries' is non-nil, FUN is not called for
 @String entries."
   (let ((case-fold-search t))
     (save-excursion
@@ -1552,14 +1567,14 @@
   "Echo a message about progress of current buffer.
 If FLAG is a string, the message is initialized (in this case a
 value for INTERVAL may be given as well (if not this is set to 5)).
-If FLAG is done, the message is deinitialized.
+If FLAG is `done', the message is deinitialized.
 If FLAG is nil, a message is echoed if point was incremented at least
 `bibtex-progress-interval' percent since last message was echoed."
   (cond ((stringp flag)
-         (setq bibtex-progress-lastmes flag)
-         (setq bibtex-progress-interval (or interval 5)
+         (setq bibtex-progress-lastmes flag
+               bibtex-progress-interval (or interval 5)
                bibtex-progress-lastperc 0))
-        ((equal flag 'done)
+        ((eq flag 'done)
          (message  "%s (done)" bibtex-progress-lastmes)
          (setq bibtex-progress-lastmes nil))
         (t
@@ -1574,33 +1589,33 @@
 
 (defun bibtex-field-left-delimiter ()
   "Return a string dependent on `bibtex-field-delimiters'."
-  (if (equal bibtex-field-delimiters 'braces)
+  (if (eq bibtex-field-delimiters 'braces)
       "{"
     "\""))
 
 (defun bibtex-field-right-delimiter ()
   "Return a string dependent on `bibtex-field-delimiters'."
-  (if (equal bibtex-field-delimiters 'braces)
+  (if (eq bibtex-field-delimiters 'braces)
       "}"
     "\""))
 
 (defun bibtex-entry-left-delimiter ()
   "Return a string dependent on `bibtex-entry-delimiters'."
-  (if (equal bibtex-entry-delimiters 'braces)
+  (if (eq bibtex-entry-delimiters 'braces)
       "{"
     "("))
 
 (defun bibtex-entry-right-delimiter ()
   "Return a string dependent on `bibtex-entry-delimiters'."
-  (if (equal bibtex-entry-delimiters 'braces)
+  (if (eq bibtex-entry-delimiters 'braces)
       "}"
     ")"))
 
 (defun bibtex-search-entry (empty-head &optional bound noerror backward)
   "Search for a BibTeX entry (maybe without reference key if EMPTY-HEAD is t).
 BOUND and NOERROR are exactly as in `re-search-forward'.  If BACKWARD
-is non-nil, search is done in reverse direction.  Point is moved past the
-closing delimiter (at the beginning of entry if BACKWARD is non-nil).
+is non-nil, search in reverse direction.  Move point past the closing
+delimiter (at the beginning of entry if BACKWARD is non-nil).
 Return a cons pair with buffer positions of beginning and end of entry.
 After call to this function MATCH-BEGINNING and MATCH-END functions
 are defined, but only for the head part of the entry
@@ -1620,12 +1635,12 @@
             (cond ((not noerror)
                    ;; yell
                    (error "Backward search of BibTeX entry failed"))
-                  ((equal noerror t)
+                  ((eq noerror t)
                    ;; don't move
                    (goto-char pnt)))
             nil))
-      (let ((limit (or bound (point-max)))
-            found)
+      (let (found)
+        (unless bound (setq bound (point-max)))
         (while (and (not found)
                     (re-search-forward entry-head-re bound noerror))
           (save-match-data
@@ -1639,9 +1654,9 @@
                   (infix-start (point))
                   finished bounds)
               (while (not finished)
-                (skip-chars-forward " \t\n" limit)
+                (skip-chars-forward " \t\n" bound)
                 (if (and (setq bounds (bibtex-parse-field bibtex-field-name))
-                         (<= (bibtex-end-of-field bounds) limit))
+                         (<= (bibtex-end-of-field bounds) bound))
                     (setq infix-start (bibtex-end-of-field bounds))
                   (setq finished t))
                 (goto-char infix-start))
@@ -1649,7 +1664,7 @@
               ;; that BOUND is respected.
               (when (and (looking-at bibtex-entry-postfix)
                          (eq (char-before (match-end 0)) entry-closer)
-                         (<= (match-end 0) limit))
+                         (<= (match-end 0) bound))
                 (goto-char (match-end 0))
                 (setq found t)))))
         (if found
@@ -1657,7 +1672,7 @@
           (cond ((not noerror)
                  ;; yell
                  (error "Search of BibTeX entry failed"))
-                ((equal noerror t)
+                ((eq noerror t)
                  ;; don't move
                  (goto-char pnt)))
           nil)))))
@@ -1727,9 +1742,8 @@
 
 (defun bibtex-enclosing-field (&optional noerr)
   "Search for BibTeX field enclosing point.
-Use `match-beginning' and `match-end' to parse the field.  If NOERR is non-nil,
-no error is signalled.  In this case, bounds are returned on success,
-nil otherwise.  Does not move point."
+Unless NOERR is non-nil, signal an error if no enclosing field is found.
+On success return bounds, nil otherwise.  Do not move point."
   (let ((bounds (bibtex-search-backward-field bibtex-field-name t)))
     (if (and bounds
              (<= (bibtex-start-of-field bounds) (point))
@@ -1751,36 +1765,31 @@
       (goto-char old-point)
       (error "Can't find end of enclosing BibTeX entry"))))
 
-(defun bibtex-insert-current-kill (n)
+(defun bibtex-insert-kill (n)
+  "Reinsert the Nth stretch of killed BibTeX text."
   (if (not bibtex-last-kill-command)
       (error "BibTeX kill ring is empty")
-    (let* ((kr (if (equal bibtex-last-kill-command 'field)
+    (let* ((kr (if (eq bibtex-last-kill-command 'field)
                    'bibtex-field-kill-ring
                  'bibtex-entry-kill-ring))
-           (kryp (if (equal bibtex-last-kill-command 'field)
+           (kryp (if (eq bibtex-last-kill-command 'field)
                      'bibtex-field-kill-ring-yank-pointer
                    'bibtex-entry-kill-ring-yank-pointer))
-           (ARGth-kill-element (nthcdr (mod (- n (length (eval kryp)))
-                                            (length (eval kr)))
-                                       (eval kr)))
-           (current (car (set kryp ARGth-kill-element))))
-      (cond
-       ((equal bibtex-last-kill-command 'field)
-        (let (bibtex-help-message)
-          (bibtex-find-text nil t)
-          (if (looking-at "[}\"]")
-              (forward-char)))
-        (set-mark (point))
-        (message "Mark set")
-        (bibtex-make-field (list (elt current 1) nil (elt current 2)) t))
-       ((equal bibtex-last-kill-command 'entry)
+           (current (car (set kryp (nthcdr (mod (- n (length (eval kryp)))
+                                                (length (eval kr)))
+                                           (eval kr))))))
+      (if (eq bibtex-last-kill-command 'field)
+          (let (bibtex-help-message)
+            (bibtex-find-text)
+            (if (looking-at "[}\"]")
+                (forward-char))
+            (set-mark (point))
+            (message "Mark set")
+            (bibtex-make-field current t))
         (unless (eobp) (bibtex-beginning-of-entry))
         (set-mark (point))
         (message "Mark set")
-        (insert (elt current 1)))
-       (t
-        (error "Unknown tag field: %s.  Please submit a bug report"
-               bibtex-last-kill-command))))))
+        (insert current)))))
 
 (defun bibtex-format-entry ()
   "Helper function for `bibtex-clean-entry'.
@@ -1789,7 +1798,7 @@
     (save-restriction
       (bibtex-narrow-to-entry)
       (let ((case-fold-search t)
-            (format (if (equal bibtex-entry-format t)
+            (format (if (eq bibtex-entry-format t)
                         '(realign opts-or-alts required-fields
                                   numerical-fields
                                   last-comma page-dashes delimiters
@@ -1828,7 +1837,7 @@
           (setq crossref-key (and field
                                   (not (string-match bibtex-empty-field-re
                                                      (cdr field)))
-                                  (cdr field))
+                                  (bibtex-remove-delimiters-string (cdr field)))
                 req-field-list (if crossref-key
                                    (nth 0 (nth 2 entry-list)) ; crossref part
                                  (nth 0 (nth 1 entry-list)))) ; required part
@@ -1843,7 +1852,7 @@
                   (cond ((not non-empty-alternative)
                          (setq non-empty-alternative t))
                         ((memq 'required-fields format)
-                         (error "More than one non-empty alternative.")))))))
+                         (error "More than one non-empty alternative")))))))
 
         (if (and alternatives-there
                  (not non-empty-alternative)
@@ -1854,17 +1863,19 @@
         (goto-char (point-min))
         (while (setq bounds (bibtex-search-forward-field bibtex-field-name))
           (let* ((beg-field (copy-marker (bibtex-start-of-field bounds)))
-                 (end-field (copy-marker (bibtex-end-of-field bounds)))
+                 (end-field (copy-marker (bibtex-end-of-field bounds) t))
                  (beg-name  (copy-marker (bibtex-start-of-name-in-field bounds)))
                  (end-name  (copy-marker (bibtex-end-of-name-in-field bounds)))
                  (beg-text  (copy-marker (bibtex-start-of-text-in-field bounds)))
-                 (end-text  (copy-marker (bibtex-end-of-text-in-field bounds)))
+                 (end-text  (copy-marker (bibtex-end-of-text-in-field bounds) t))
                  (opt-alt   (string-match "OPT\\|ALT"
-                                          (buffer-substring-no-properties beg-name (+ beg-name 3))))
+                                          (buffer-substring-no-properties
+                                           beg-name (+ beg-name 3))))
                  (field-name (buffer-substring-no-properties
                               (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)))
+                                            (buffer-substring-no-properties
+                                             beg-field end-field)))
                  deleted)
 
             ;; We have more elegant high-level functions for several
@@ -1926,10 +1937,11 @@
                        empty-field
                        (bibtex-string= field-name "booktitle")
                        crossref-key)
-                  (let ((title (save-restriction
-                                 (widen)
-                                 (if (bibtex-find-entry crossref-key)
-                                     (bibtex-text-in-field "title")))))
+                  (let ((title (save-excursion
+                                 (save-restriction
+                                   (widen)
+                                   (if (bibtex-find-entry crossref-key t)
+                                       (bibtex-text-in-field "title"))))))
                     (when title
                       (setq empty-field nil)
                       (goto-char (1+ beg-text))
@@ -2055,7 +2067,8 @@
   (let ((names (bibtex-autokey-get-field "author\\|editor"
                                          bibtex-autokey-name-change-strings)))
     ;; Some entries do not have a name field.
-    (unless (string= "" names)
+    (if (string= "" names)
+        names
       (let* ((case-fold-search t)
              (name-list (mapcar 'bibtex-autokey-demangle-name
                                 (split-string names "[ \t\n]+and[ \t\n]+")))
@@ -2096,9 +2109,8 @@
                       ;; --> take the last token
                       (match-string 1 fullname))
                      (t (error "Name `%s' is incorrectly formed" fullname)))))
-    (bibtex-autokey-abbrev
-     (funcall bibtex-autokey-name-case-convert name)
-     bibtex-autokey-name-length)))
+    (funcall bibtex-autokey-name-case-convert
+             (bibtex-autokey-abbrev name bibtex-autokey-name-length))))
 
 (defun bibtex-autokey-get-year ()
   "Return year field contents as a string obeying `bibtex-autokey-year-length'."
@@ -2114,9 +2126,8 @@
          (bibtex-autokey-get-field "title"
                                    bibtex-autokey-titleword-change-strings)))
     ;; ignore everything past a terminator
-    (dolist (terminator bibtex-autokey-title-terminators)
-      (if (string-match terminator titlestring)
-          (setq titlestring (substring titlestring 0 (match-beginning 0)))))
+    (if (string-match bibtex-autokey-title-terminators titlestring)
+        (setq titlestring (substring titlestring 0 (match-beginning 0))))
     ;; gather words from titlestring into a list.  Ignore
     ;; specific words and use only a specific amount of words.
     (let ((counter 0)
@@ -2135,10 +2146,9 @@
                                                          "\\)\\'") word)))
                     (setq lst (cdr lst)))
                   lst)
-          (setq word (funcall bibtex-autokey-titleword-case-convert word)
-                counter (1+ counter))
+          (setq counter (1+ counter))
           (if (or (not (numberp bibtex-autokey-titlewords))
-                  (< counter bibtex-autokey-titlewords))
+                  (<= counter bibtex-autokey-titlewords))
               (push word titlewords)
             (push word titlewords-extra))))
       ;; Obey bibtex-autokey-titlewords-stretch:
@@ -2161,83 +2171,73 @@
       (setq alist (cdr alist)))
     (if alist
         (cdar alist)
-      (bibtex-autokey-abbrev titleword
-                             bibtex-autokey-titleword-length))))
+      (funcall bibtex-autokey-titleword-case-convert
+               (bibtex-autokey-abbrev titleword bibtex-autokey-titleword-length)))))
 
 (defun bibtex-generate-autokey ()
-  "Generate automatically a key from the author/editor and the title field.
-This will only work for entries where each field begins on a separate line.
-The generation algorithm works as follows:
- 1. Use the value of `bibtex-autokey-prefix-string' as a prefix.
- 2. If there is a non-empty author (preferred) or editor field,
-    use it as the name part of the key.
- 3. Change any substring found in
-    `bibtex-autokey-name-change-strings' to the corresponding new
-    one (see documentation of this variable for further detail).
- 4. For every of at least first `bibtex-autokey-names' names in
-    the name field, determine the last name.  If there are maximal
-    `bibtex-autokey-names' + `bibtex-autokey-names-stretch'
-    names, all names are used.
- 5. From every last name, take at least `bibtex-autokey-name-length'
-    characters (abort only after a consonant or at a word end).
- 6. Convert all last names according to the conversion function
+  "Generate automatically a key for a BibTeX entry.
+Use the author/editor, the year and the title field.
+The algorithm works as follows.
+
+The name part:
+ 1. Use the author or editor field to generate the name part of the key.
+ 2. Change the content of the name field according to
+    `bibtex-autokey-name-change-strings' (see there for further detail).
+ 3. Use the first `bibtex-autokey-names' names in the name field.  If there
+    are up to `bibtex-autokey-names' + `bibtex-autokey-names-stretch' names,
+    use all names.
+ 4. Use only the last names to form the name part.  From these last names,
+    take at least `bibtex-autokey-name-length' characters (truncate only
+    after a consonant or at a word end).
+ 5. Convert all last names using the function
     `bibtex-autokey-name-case-convert'.
- 7. Build the name part of the key by concatenating all
-    abbreviated last names with the string
-    `bibtex-autokey-name-separator' between any two.  If there are
-    more names than are used in the name part, prepend the string
-    contained in `bibtex-autokey-additional-names'.
- 8. Build the year part of the key by truncating the contents of
-    the year field to the rightmost `bibtex-autokey-year-length'
-    digits (useful values are 2 and 4).  If the year field (or any
-    other field required to generate the key) is absent, but the entry
-    has a valid crossref field and the variable
+ 6. Build the name part of the key by concatenating all abbreviated last
+    names with the string `bibtex-autokey-name-separator' between any two.
+    If there are more names in the name field than names used in the name
+    part, append the string `bibtex-autokey-additional-names'.
+
+The year part:
+ 1. Build the year part of the key by truncating the content of the year
+    field to the rightmost `bibtex-autokey-year-length' digits (useful
+    values are 2 and 4).
+ 2. If the year field (or any other field required to generate the key)
+    is absent, but the entry has a valid crossref field and
     `bibtex-autokey-use-crossref' is non-nil, use the field of the
     crossreferenced entry instead.
- 9. For the title part of the key change the contents of the
-    title field of the entry according to
-    `bibtex-autokey-titleword-change-strings' to the
-    corresponding new one (see documentation of this variable for
-    further detail).
-10. Abbreviate the result to the string up to (but not including)
-    the first occurrence of a regexp matched by the items of
-    `bibtex-autokey-title-terminators' and delete those words which
-    appear in `bibtex-autokey-titleword-ignore'.
-    Build the title part of the key by using at least the first
-    `bibtex-autokey-titlewords' words from this
-    abbreviated title.  If the abbreviated title ends after
-    maximal `bibtex-autokey-titlewords' +
-    `bibtex-autokey-titlewords-stretch' words, all
-    words from the abbreviated title are used.
-11. Convert all used titlewords according to the conversion function
+
+The title part
+ 1. Change the content of the title field according to
+    `bibtex-autokey-titleword-change-strings' (see there for further detail).
+ 2. Truncate the title before the first match of
+    `bibtex-autokey-title-terminators' and delete those words which appear
+    in `bibtex-autokey-titleword-ignore'.  Build the title part using the
+    first `bibtex-autokey-titlewords' words from this truncated title.
+    If the truncated title ends after up to `bibtex-autokey-titlewords' +
+    `bibtex-autokey-titlewords-stretch' words, use all words from the
+    truncated title.
+ 3. For every title word that appears in `bibtex-autokey-titleword-abbrevs'
+    use the corresponding abbreviation (see documentation of this variable
+    for further detail).
+ 4. From every title word not generated by an abbreviation, take at least
+    `bibtex-autokey-titleword-length' characters (truncate only after
+    a consonant or at a word end).
+ 5. Convert all title words using the function
     `bibtex-autokey-titleword-case-convert'.
-12. For every used title word that appears in
-    `bibtex-autokey-titleword-abbrevs' use the corresponding
-    abbreviation (see documentation of this variable for further
-    detail).
-13. From every title word not generated by an abbreviation, take
-    at least `bibtex-autokey-titleword-length' characters (abort
-    only after a consonant or at a word end).
-14. Build the title part of the key by concatenating all
-    abbreviated title words with the string
-    `bibtex-autokey-titleword-separator' between any two.
-15. At least, to get the key, concatenate
-    `bibtex-autokey-prefix-string', the name part, the year part
-    and the title part with `bibtex-autokey-name-year-separator'
-    between the name part and the year part if both are non-empty
-    and `bibtex-autokey-year-title-separator' between the year
-    part and the title part if both are non-empty.  If the year
-    part is empty, but not the other two parts,
-    `bibtex-autokey-year-title-separator' is used as well.
-16. If the value of `bibtex-autokey-before-presentation-function'
-    is non-nil, it must be a function taking one argument.  This
-    function is then called with the generated key as the
-    argument.  The return value of this function (a string) is
-    used as the key.
-17. If the value of `bibtex-autokey-edit-before-use' is non-nil,
-    the key is then presented in the minibuffer to the user,
-    where it can be edited.  The key given by the user is then
-    used."
+ 6. Build the title part by concatenating all abbreviated title words with
+    the string `bibtex-autokey-titleword-separator' between any two.
+
+Concatenate the key:
+ 1. Concatenate `bibtex-autokey-prefix-string', the name part, the year
+    part and the title part.  If the name part and the year part are both
+    non-empty insert `bibtex-autokey-name-year-separator' between the two.
+    If the title part and the year (or name) part are non-empty, insert
+    `bibtex-autokey-year-title-separator' between the two.
+ 2. If `bibtex-autokey-before-presentation-function' is non-nil, it must be
+    a function taking one argument.  Call this function with the generated
+    key as the argument.  Use the return value of this function (a string)
+    as the key.
+ 3. If `bibtex-autokey-edit-before-use' is non-nil, present the key in the
+    minibuffer to the user for editing.  Insert the key given by the user."
   (let* ((names (bibtex-autokey-get-names))
          (year (bibtex-autokey-get-year))
          (title (bibtex-autokey-get-title))
@@ -2257,16 +2257,35 @@
       autokey)))
 
 
-(defun bibtex-read-key (prompt &optional key)
-  "Read BibTeX key from minibuffer using PROMPT and default KEY."
-  (completing-read prompt bibtex-reference-keys
-                   nil nil key 'bibtex-key-history))
+(defun bibtex-global-key-alist ()
+  "Return global key alist based on `bibtex-files'."
+  (if bibtex-files
+      (apply 'append
+             (mapcar (lambda (buf)
+                       (with-current-buffer buf bibtex-reference-keys))
+                     (bibtex-files-expand t)))
+    bibtex-reference-keys))
+
+(defun bibtex-read-key (prompt &optional key global)
+  "Read BibTeX key from minibuffer using PROMPT and default KEY.
+If optional arg GLOBAL is non-nil, completion is based on the keys in
+`bibtex-reference-keys' of `bibtex-files',"
+  (let (completion-ignore-case)
+    (completing-read prompt (if global (bibtex-global-key-alist)
+                              bibtex-reference-keys)
+                     nil nil key 'bibtex-key-history)))
+
+(defun bibtex-read-string-key (&optional key)
+  "Read BibTeX string key from minibuffer using default KEY."
+  (let ((completion-ignore-case t))
+    (completing-read "String key: " bibtex-strings
+                     nil nil key 'bibtex-key-history)))
 
 (defun bibtex-parse-keys (&optional abortable verbose)
   "Set `bibtex-reference-keys' to the keys used in the whole buffer.
-Find both entry keys and crossref entries.  If ABORTABLE is non-nil abort on
-user input.  If VERBOSE is non-nil gives messages about progress.  Return alist
-of keys if parsing was completed, `aborted' otherwise."
+Find both entry keys and crossref entries.  If ABORTABLE is non-nil abort
+on user input.  If VERBOSE is non-nil give messages about progress.
+Return alist of keys if parsing was completed, `aborted' otherwise."
   (let (ref-keys crossref-keys)
     (save-excursion
       (save-match-data
@@ -2325,7 +2344,6 @@
 
 (defun bibtex-parse-strings (&optional add abortable)
   "Set `bibtex-strings' to the string definitions in the whole buffer.
-The buffer might possibly be restricted.
 If ADD is non-nil add the new strings to `bibtex-strings' instead of
 simply resetting it.  If ADD is an alist of strings, also add ADD to
 `bibtex-strings'.  If ABORTABLE is non-nil abort on user input.
@@ -2395,8 +2413,9 @@
 (defun bibtex-parse-buffers-stealthily ()
   "Parse buffer in the background during idle time.
 Called by `run-with-idle-timer'.  Whenever Emacs has been idle
-for `bibtex-parse-keys-timeout' seconds, all BibTeX buffers (starting
-with the current) are parsed."
+for `bibtex-parse-keys-timeout' seconds, parse all BibTeX buffers
+which have been modified after last parsing.
+Parsing initializes `bibtex-reference-keys' and `bibtex-strings'."
   (save-excursion
     (let ((buffers (buffer-list))
           (strings-init (bibtex-string-files-init)))
@@ -2417,10 +2436,12 @@
                   (setq bibtex-buffer-last-parsed-tick (buffer-modified-tick)))))
         (setq buffers (cdr buffers))))))
 
-(defun bibtex-files-expand (&optional current)
+(defun bibtex-files-expand (&optional current force)
   "Return an expanded list of BibTeX buffers based on `bibtex-files'.
 Initialize in these buffers `bibtex-reference-keys' if not yet set.
-List includes current buffer if CURRENT is non-nil."
+List of BibTeX buffers includes current buffer if CURRENT is non-nil.
+If FORCE is non-nil, (re)initialize `bibtex-reference-keys' even if
+already set."
   (let ((file-path (split-string (or bibtex-file-path default-directory) ":+"))
         file-list dir-list buffer-list)
     (dolist (file bibtex-files)
@@ -2454,17 +2475,18 @@
       (when (file-readable-p file)
         (push (find-file-noselect file) buffer-list)
         (with-current-buffer (car buffer-list)
-          (unless (listp bibtex-reference-keys)
+          (if (or force (not (listp bibtex-reference-keys)))
             (bibtex-parse-keys)))))
     (cond ((and current (not (memq (current-buffer) buffer-list)))
-           (push (current-buffer) buffer-list))
+           (push (current-buffer) buffer-list)
+           (if force (bibtex-parse-keys)))
           ((and (not current) (memq (current-buffer) buffer-list))
            (setq buffer-list (delq (current-buffer) buffer-list))))
     buffer-list))
 
 (defun bibtex-complete-internal (completions)
   "Complete word fragment before point to longest prefix of COMPLETIONS.
-COMPLETIONS should be a list of strings.  If point is not after the part
+COMPLETIONS is an alist of strings.  If point is not after the part
 of a word, all strings are listed.  Return completion."
   (let* ((case-fold-search t)
          (beg (save-excursion
@@ -2491,53 +2513,48 @@
            ;; return value is handled by choose-completion-string-functions
            nil))))
 
-(defun bibtex-complete-string-cleanup (str strings-alist)
+(defun bibtex-complete-string-cleanup (str compl)
   "Cleanup after inserting string STR.
-Remove enclosing field delimiters for string STR.  Display message with
-expansion of STR using expansion list STRINGS-ALIST."
-  (let ((pair (if (stringp str)
-                  (assoc-string str strings-alist t))))
-    (when pair
-      (if (cdr pair)
-          (message "Abbreviation for `%s'" (cdr pair)))
-      (save-excursion
-        (bibtex-inside-field)
-        (let ((bounds (bibtex-enclosing-field)))
-          (goto-char (bibtex-start-of-text-in-field bounds))
-          (let ((boundaries (bibtex-parse-field-string)))
-            (if (and boundaries
-                     (equal (cdr boundaries)
-                            (bibtex-end-of-text-in-field bounds)))
-                (bibtex-remove-delimiters))))))))
-
-(defun bibtex-complete-key-cleanup (key)
+Remove enclosing field delimiters for STR.  Display message with
+expansion of STR using expansion list COMPL."
+  (save-excursion
+    (bibtex-inside-field)
+    (let ((bounds (bibtex-enclosing-field))
+          (abbr (cdr (if (stringp str)
+                         (assoc-string str compl t)))))
+      (if abbr (message "Abbreviation for `%s'" abbr))
+      (goto-char (bibtex-start-of-text-in-field bounds))
+      (let ((boundaries (bibtex-parse-field-string)))
+        (if (and boundaries
+                 (equal (cdr boundaries)
+                        (bibtex-end-of-text-in-field bounds)))
+            (bibtex-remove-delimiters))))))
+
+(defun bibtex-complete-crossref-cleanup (key)
   "Display summary message on entry KEY after completion of a crossref key.
 Use `bibtex-summary-function' to generate summary."
   (save-excursion
-    ;; Don't do anything if we completed the key of an entry.
-    (let ((pnt (bibtex-beginning-of-entry)))
-      (if (and (stringp key)
-               (bibtex-find-entry key)
-               (/= pnt (point)))
-          (message "Ref: %s" (funcall bibtex-summary-function key))))))
-
-(defun bibtex-copy-summary-as-kill (key)
-  "Push summery of BibTeX entry KEY to kill ring.
+    (if (and (stringp key)
+             (bibtex-find-entry key t))
+        (message "Ref: %s" (funcall bibtex-summary-function key)))))
+
+(defun bibtex-copy-summary-as-kill ()
+  "Push summery of current BibTeX entry to kill ring.
 Use `bibtex-summary-function' to generate summary."
-  (interactive
-   (list (bibtex-read-key
-          "Key: " (save-excursion
-                    (bibtex-beginning-of-entry)
-                    (when (re-search-forward bibtex-entry-head nil t)
-                      (bibtex-key-in-head))))))
-  (kill-new (message "%s" (funcall bibtex-summary-function key))))
+  (interactive)
+  (let ((key (save-excursion
+               (bibtex-beginning-of-entry)
+               (if (looking-at bibtex-entry-maybe-empty-head)
+                   (bibtex-key-in-head)
+                 (error "No key found")))))
+    (kill-new (message "%s" (funcall bibtex-summary-function key)))))
 
 (defun bibtex-summary (key)
   "Return summary of BibTeX entry KEY.
 Used as default value of `bibtex-summary-function'."
   ;; It would be neat to customize this function.  How?
   (save-excursion
-    (if (bibtex-find-entry key)
+    (if (bibtex-find-entry key t)
         (let* ((bibtex-autokey-name-case-convert 'identity)
                (bibtex-autokey-name-length 'infty)
                (bibtex-autokey-names 1)
@@ -2563,13 +2580,13 @@
                      `((" " . ,names) (" " . ,year) (": " . ,title)
                        (", " . ,journal) (" " . ,volume) (":" . ,pages))
                      ""))
-      (error "Key `%s' not found." key))))
+      (error "Key `%s' not found" key))))
 
 (defun bibtex-pop (arg direction)
-  "Fill current field from the ARG'th same field's text in DIRECTION.
+  "Fill current field from the ARGth same field's text in DIRECTION.
 Generic function used by `bibtex-pop-previous' and `bibtex-pop-next'."
   (let (bibtex-help-message)
-    (bibtex-find-text nil))
+    (bibtex-find-text))
   (save-excursion
     ;; parse current field
     (bibtex-inside-field)
@@ -2613,7 +2630,7 @@
           (delete-region start-old-text stop-old-text)
           (insert new-text)))))
   (let (bibtex-help-message)
-    (bibtex-find-text nil))
+    (bibtex-find-text))
   (setq this-command 'bibtex-pop))
 
 (defun bibtex-beginning-of-field ()
@@ -2626,7 +2643,7 @@
       (re-search-backward field-reg nil t))))
 
 (defun bibtex-font-lock-url (bound)
-  "Font-lock for URLs."
+  "Font-lock for URLs.  BOUND limits the search."
   (let ((case-fold-search t)
         (pnt (point))
         field bounds start end found)
@@ -2657,7 +2674,7 @@
     found))
 
 (defun bibtex-font-lock-crossref (bound)
-  "Font-lock for crossref fields."
+  "Font-lock for crossref fields.  BOUND limits the search."
   (let ((case-fold-search t)
         (pnt (point))
         (crossref-reg (concat "^[ \t]*crossref[ \t]*=[ \t\n]*"
@@ -2690,6 +2707,7 @@
   'help-echo (purecopy "mouse-2, RET: follow crossref"))
 
 (defun bibtex-button (beg end type &rest args)
+  "Make a BibTeX button from BEG to END of type TYPE in the current buffer."
   (make-text-button beg end 'type type 'bibtex-args args))
 
 
@@ -2701,18 +2719,16 @@
 
 General information on working with BibTeX mode:
 
-You should use commands such as \\[bibtex-Book] to get a template for a
-specific entry.  You should then fill in all desired fields using
-\\[bibtex-next-field] to jump from field to field.  After having filled
-in all desired fields in the entry, you should clean the new entry
-with the command \\[bibtex-clean-entry].
+Use commands such as \\[bibtex-Book] to get a template for a specific entry.
+Then fill in all desired fields using \\[bibtex-next-field] to jump from field
+to field.  After having filled in all desired fields in the entry, clean the
+new entry with the command \\[bibtex-clean-entry].
 
 Some features of BibTeX mode are available only by setting the variable
-`bibtex-maintain-sorted-entries' to non-nil.  However, then BibTeX mode will
-work only with buffers containing valid (syntactical correct) entries
-and with entries being sorted.  This is usually the case, if you have
-created a buffer completely with BibTeX mode and finished every new
-entry with \\[bibtex-clean-entry].
+`bibtex-maintain-sorted-entries' to non-nil.  However, then BibTeX mode
+works only with buffers containing valid (syntactical correct) and sorted
+entries.  This is usually the case, if you have created a buffer completely
+with BibTeX mode and finished every new entry with \\[bibtex-clean-entry].
 
 For third party BibTeX files, call the function `bibtex-convert-alien'
 to fully take advantage of all features of BibTeX mode.
@@ -2720,68 +2736,34 @@
 
 Special information:
 
-A command such as \\[bibtex-Book] will outline the fields for a BibTeX book entry.
-
-The optional fields start with the string OPT, and are thus ignored by BibTeX.
-Alternatives from which only one is required start with the string ALT.
-The OPT or ALT string may be removed from a field with \\[bibtex-remove-OPT-or-ALT].
+A command such as \\[bibtex-Book] outlines the fields for a BibTeX book entry.
+
+The names of optional fields start with the string OPT, and are thus ignored
+by BibTeX.  The names of alternative fields from which only one is required
+start with the string ALT.  The OPT or ALT string may be removed from
+the name of a field with \\[bibtex-remove-OPT-or-ALT].
 \\[bibtex-make-field] inserts a new field after the current one.
 \\[bibtex-kill-field] kills the current field entirely.
 \\[bibtex-yank] yanks the last recently killed field after the current field.
 \\[bibtex-remove-delimiters] removes the double-quotes or braces around the text of the current field.
- \\[bibtex-empty-field] replaces the text of the current field with the default \"\" or {}.
+\\[bibtex-empty-field] replaces the text of the current field with the default \"\" or {}.
+\\[bibtex-find-text] moves point to the end of the current field.
+\\[bibtex-complete] completes word fragment before point according to context.
 
 The command \\[bibtex-clean-entry] cleans the current entry, i.e. it removes OPT/ALT
-from all non-empty optional or alternative fields, checks that no required
-fields are empty, and does some formatting dependent on the value of
-`bibtex-entry-format'.
+from the names of all non-empty optional or alternative fields, checks that
+no required fields are empty, and does some formatting dependent on the value
+of `bibtex-entry-format'.  Furthermore, it can automatically generate a key
+for the BibTeX entry, see `bibtex-generate-autokey'.
 Note: some functions in BibTeX mode depend on entries being in a special
 format (all fields beginning on separate lines), so it is usually a bad
 idea to remove `realign' from `bibtex-entry-format'.
 
-Use \\[bibtex-find-text] to position the cursor at the end of the current field.
-Use \\[bibtex-next-field] to move to end of the next field.
-
-The following may be of interest as well:
-
-  Functions:
-    `bibtex-entry'
-    `bibtex-kill-entry'
-    `bibtex-yank-pop'
-    `bibtex-pop-previous'
-    `bibtex-pop-next'
-    `bibtex-complete'
-    `bibtex-print-help-message'
-    `bibtex-generate-autokey'
-    `bibtex-beginning-of-entry'
-    `bibtex-end-of-entry'
-    `bibtex-reposition-window'
-    `bibtex-mark-entry'
-    `bibtex-ispell-abstract'
-    `bibtex-ispell-entry'
-    `bibtex-narrow-to-entry'
-    `bibtex-sort-buffer'
-    `bibtex-validate'
-    `bibtex-count'
-    `bibtex-fill-entry'
-    `bibtex-reformat'
-    `bibtex-convert-alien'
-
-  Variables:
-    `bibtex-field-delimiters'
-    `bibtex-include-OPTcrossref'
-    `bibtex-include-OPTkey'
-    `bibtex-user-optional-fields'
-    `bibtex-entry-format'
-    `bibtex-sort-ignore-string-entries'
-    `bibtex-maintain-sorted-entries'
-    `bibtex-entry-field-alist'
-    `bibtex-predefined-strings'
-    `bibtex-string-files'
-
----------------------------------------------------------
-Entry to BibTeX mode calls the value of `bibtex-mode-hook' if that value is
-non-nil.
+BibTeX mode supports Imenu and hideshow minor mode (`hs-minor-mode').
+
+----------------------------------------------------------
+Entry to BibTeX mode calls the value of `bibtex-mode-hook'
+if that value is non-nil.
 
 \\{bibtex-mode-map}"
   (interactive)
@@ -2824,9 +2806,9 @@
               (set-mark (bibtex-end-of-entry))
 	      (bibtex-beginning-of-entry)))))
   (setq imenu-generic-expression
-        (list (list nil bibtex-entry-head bibtex-key-in-head)))
+        (list (list nil bibtex-entry-head bibtex-key-in-head))
+        imenu-case-fold-search t)
   (make-local-variable 'choose-completion-string-functions)
-  (setq imenu-case-fold-search t)
   ;; XEmacs needs easy-menu-add, Emacs does not care
   (easy-menu-add bibtex-edit-menu)
   (easy-menu-add bibtex-entry-menu)
@@ -2836,7 +2818,9 @@
   "Return list of allowed fields for entry ENTRY-TYPE.
 More specifically, the return value is a cons pair (REQUIRED . OPTIONAL),
 where REQUIRED and OPTIONAL are lists of the required and optional field
-names for ENTRY-TYPE according to `bibtex-entry-field-alist'."
+names for ENTRY-TYPE according to `bibtex-entry-field-alist',
+`bibtex-include-OPTkey', `bibtex-include-OPTcrossref',
+and `bibtex-user-optional-fields'."
   (let ((e (assoc-string entry-type bibtex-entry-field-alist t))
         required optional)
     (unless e
@@ -2862,13 +2846,12 @@
 
 (defun bibtex-entry (entry-type)
   "Insert a new BibTeX entry of type ENTRY-TYPE.
-After insertion it calls the functions in `bibtex-add-entry-hook'."
-  (interactive (let* ((completion-ignore-case t)
-                      (e-t (completing-read
-                            "Entry Type: "
-                            bibtex-entry-field-alist
-                            nil t nil 'bibtex-entry-type-history)))
-                 (list e-t)))
+After insertion call the value of `bibtex-add-entry-hook' if that value
+is non-nil."
+  (interactive
+   (let ((completion-ignore-case t))
+     (list (completing-read "Entry Type: " bibtex-entry-field-alist
+                            nil t nil 'bibtex-entry-type-history))))
   (let ((key (if bibtex-maintain-sorted-entries
                  (bibtex-read-key (format "%s key: " entry-type))))
         (field-list (bibtex-field-list entry-type)))
@@ -2893,7 +2876,7 @@
 (defun bibtex-entry-update ()
   "Update an existing BibTeX entry.
 In the BibTeX entry at point, make new fields for those items that may occur
-according to `bibtex-entry-field-alist', but are not yet present."
+according to `bibtex-field-list', but are not yet present."
   (interactive)
   (save-excursion
     (bibtex-beginning-of-entry)
@@ -2928,7 +2911,13 @@
     alist))
 
 (defun bibtex-autofill-entry ()
-  "Try to fill fields based on surrounding entries."
+  "Try to fill fields of current BibTeX entry based on neighboring entries.
+The current entry must have a key.  Determine the neighboring entry
+\(previouse or next\) whose key is more similar to the key of the current
+entry.  For all empty fields of the current entry insert the corresponding
+field contents of the neighboring entry.  Finally try to update the text
+based on the difference between the keys of the neighboring and the current
+entry (for example, the year parts of the keys)."
   (interactive)
   (undo-boundary)	;So you can easily undo it, if it didn't work right.
   (bibtex-beginning-of-entry)
@@ -2945,27 +2934,25 @@
       (save-excursion
 	(goto-char (1- (match-beginning 0)))
 	(bibtex-beginning-of-entry)
-	(when (and
-	       (looking-at bibtex-entry-head)
-	       (bibtex-string= type (bibtex-type-in-head))
-	       ;; In case we found ourselves :-(
-	       (not (equal key (setq tmp (bibtex-key-in-head)))))
-	  (setq other-key tmp)
-	  (setq other (point))))
+	(if (and (looking-at bibtex-entry-head)
+                 (bibtex-string= type (bibtex-type-in-head))
+                 ;; In case we found ourselves :-(
+                 (not (equal key (setq tmp (bibtex-key-in-head)))))
+	  (setq other-key tmp
+                other (point))))
       (save-excursion
 	(bibtex-end-of-entry)
 	(bibtex-skip-to-valid-entry)
-	(when (and
-	       (looking-at bibtex-entry-head)
-	       (bibtex-string= type (bibtex-type-in-head))
-	       ;; In case we found ourselves :-(
-	       (not (equal key (setq tmp (bibtex-key-in-head))))
-	       (or (not other-key)
-		   ;; Check which is the best match.
-		   (< (length (try-completion "" (list key other-key)))
-		      (length (try-completion "" (list key tmp))))))
-	  (setq other-key tmp)
-	  (setq other (point))))
+	(if (and (looking-at bibtex-entry-head)
+                 (bibtex-string= type (bibtex-type-in-head))
+                 ;; In case we found ourselves :-(
+                 (not (equal key (setq tmp (bibtex-key-in-head))))
+                 (or (not other-key)
+                     ;; Check which is the best match.
+                     (< (length (try-completion "" (list key other-key)))
+                        (length (try-completion "" (list key tmp))))))
+            (setq other-key tmp
+                  other (point))))
       ;; Then fill the new entry's fields with the chosen other entry.
       (when other
 	(setq other (save-excursion (goto-char other) (bibtex-parse-entry)))
@@ -3007,13 +2994,15 @@
           (message (nth 1 comment))
         (message "No comment available")))))
 
-(defun bibtex-make-field (field &optional called-by-yank interactive)
+(defun bibtex-make-field (field &optional move interactive)
   "Make a field named FIELD in current BibTeX entry.
 FIELD is either a string or a list of the form
 \(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in
 `bibtex-entry-field-alist'.
-If CALLED-BY-YANK is non-nil, don't insert delimiters.
-In that case, or when called interactively, also don't do (WHAT?)."
+If MOVE is non-nil, move point past the present field before making
+the new field.  If INTERACTIVE is non-nil, move point to the end of
+the new field.  Otherwise move point past the new field.
+MOVE and INTERACTIVE are t when called interactively."
   (interactive
    (list (let ((completion-ignore-case t)
                (field-list (bibtex-field-list
@@ -3023,12 +3012,12 @@
            (completing-read "BibTeX field name: "
                             (append (car field-list) (cdr field-list))
                             nil nil nil bibtex-field-history))
-	 t))
+         t t))
   (unless (consp field)
     (setq field (list field)))
-  (if (or interactive called-by-yank)
+  (if move
       (let (bibtex-help-message)
-        (bibtex-find-text nil t t)
+        (bibtex-find-text)
         (if (looking-at "[}\"]")
             (forward-char))))
   (insert ",\n")
@@ -3042,13 +3031,11 @@
   (unless bibtex-align-at-equal-sign
     (indent-to-column (+ bibtex-entry-offset
                          bibtex-text-indentation)))
-  (unless called-by-yank (insert (bibtex-field-left-delimiter)))
   (let ((init (nth 2 field)))
-    (cond ((stringp init)
-           (insert init))
-          ((fboundp init)
-           (insert (funcall init)))))
-  (unless called-by-yank (insert (bibtex-field-right-delimiter)))
+    (insert (cond ((stringp init) init)
+                  ((fboundp init) (funcall init))
+                  (t (concat (bibtex-field-left-delimiter)
+                             (bibtex-field-right-delimiter))))))
   (when interactive
     (forward-char -1)
     (bibtex-print-help-message)))
@@ -3083,17 +3070,9 @@
            (goto-char (bibtex-end-of-string bounds)))
           ((looking-at "[ \t]*@[ \t]*preamble[ \t\n]*")
            (goto-char (match-end 0))
-           (cond ((looking-at "(")
-                  (unless (re-search-forward ")[ \t]*\n\n" nil 'move)
-                    (setq err t)))
-                 ((looking-at "{")
-                  (unless (re-search-forward "}[ \t]*\n\n" nil 'move)
-                    (setq err t)))
-                 (t
-                  (setq err t)))
-           (unless err
-             (goto-char (match-beginning 0))
-             (forward-char)))
+           (if (looking-at "[({]")
+               (forward-sexp 1)
+             (setq err t)))
           (t
            (if (interactive-p)
                (message "Not on a known BibTeX entry."))
@@ -3103,14 +3082,35 @@
       (error "Syntactically incorrect BibTeX entry starts here")))
   (point))
 
-(defun bibtex-reposition-window (&optional arg)
+(defun bibtex-goto-line (arg)
+  "Goto line ARG, counting from beginning of (narrowed) buffer."
+  ;; code adapted from `goto-line'
+  (goto-char (point-min))
+  (if (eq selective-display t)
+      (re-search-forward "[\n\C-m]" nil 'end (1- arg))
+    (forward-line (1- arg))))
+
+(defun bibtex-reposition-window ()
   "Make the current BibTeX entry visible.
-Optional argument ARG is exactly as in `recenter'."
-  (interactive "P")
-  (save-excursion
-    (goto-char
-     (/ (+ (bibtex-beginning-of-entry) (bibtex-end-of-entry)) 2))
-    (recenter arg)))
+If entry is smaller than `window-body-height', entry is centered in window.
+Otherwise display the beginning of entry."
+  (interactive)
+  (let ((pnt (point))
+        (beg (line-number-at-pos (bibtex-beginning-of-entry)))
+        (end (line-number-at-pos (bibtex-end-of-entry))))
+    (if (> (window-body-height) (- end beg))
+        ;; entry fits in current window
+        (progn
+          (bibtex-goto-line (/ (+ 1 beg end) 2))
+          (recenter)
+          (goto-char pnt))
+      ;; entry too large for current window
+      (bibtex-goto-line beg)
+      (recenter 0)
+      (if (> (1+ (- (line-number-at-pos pnt) beg))
+             (window-body-height))
+          (bibtex-goto-line beg)
+        (goto-char pnt)))))
 
 (defun bibtex-mark-entry ()
   "Put mark at beginning, point at end of current BibTeX entry."
@@ -3120,9 +3120,9 @@
 
 (defun bibtex-count-entries (&optional count-string-entries)
   "Count number of entries in current buffer or region.
-With prefix argument COUNT-STRING-ENTRIES it counts all entries,
-otherwise it counts all except Strings.
-If mark is active it counts entries in region, if not in whole buffer."
+With prefix argument COUNT-STRING-ENTRIES count all entries,
+otherwise count all entries except @String entries.
+If mark is active count entries in region, if not in whole buffer."
   (interactive "P")
   (let ((number 0)
         (bibtex-sort-ignore-string-entries
@@ -3139,13 +3139,13 @@
              number)))
 
 (defun bibtex-ispell-entry ()
-  "Spell whole BibTeX entry."
+  "Check BibTeX entry for spelling errors."
   (interactive)
   (ispell-region (save-excursion (bibtex-beginning-of-entry))
                  (save-excursion (bibtex-end-of-entry))))
 
 (defun bibtex-ispell-abstract ()
-  "Spell abstract of BibTeX entry."
+  "Check abstract of BibTeX entry for spelling errors."
   (interactive)
   (let ((bounds (save-excursion
                   (bibtex-beginning-of-entry)
@@ -3164,23 +3164,23 @@
                       (bibtex-end-of-entry))))
 
 (defun bibtex-entry-index ()
-  "Return the index of the BibTeX entry at point.  Move point.
+  "Return index of BibTeX entry head at or past position of point.
 The index is a list (KEY CROSSREF-KEY ENTRY-NAME) that is used for sorting
-the entries of the BibTeX buffer.  Return nil if no entry found."
+the entries of the BibTeX buffer.  CROSSREF-KEY is nil unless the value
+of `bibtex-maintain-sorted-entries' is `crossref'.  Move point to the end
+of the head of the entry found.  Return nil if no entry found."
   (let ((case-fold-search t))
     (if (re-search-forward bibtex-entry-maybe-empty-head nil t)
         (let ((key (bibtex-key-in-head))
               ;; all entry names should be downcase (for ease of comparison)
               (entry-name (downcase (bibtex-type-in-head))))
           ;; Don't search CROSSREF-KEY if we don't need it.
-          (if (equal bibtex-maintain-sorted-entries 'crossref)
-              (save-excursion
-                (bibtex-beginning-of-entry)
-                (let ((bounds (bibtex-search-forward-field
-                               "\\(OPT\\)?crossref" t)))
-                  (list key
-                        (if bounds (bibtex-text-in-field-bounds bounds t))
-                        entry-name)))
+          (if (eq bibtex-maintain-sorted-entries 'crossref)
+              (let ((bounds (bibtex-search-forward-field
+                             "\\(OPT\\)?crossref" t)))
+                (list key
+                      (if bounds (bibtex-text-in-field-bounds bounds t))
+                      entry-name))
             (list key nil entry-name))))))
 
 (defun bibtex-lessp (index1 index2)
@@ -3190,7 +3190,7 @@
 If its value is nil use plain sorting."
   (cond ((not index1) (not index2)) ; indices can be nil
         ((not index2) nil)
-        ((equal bibtex-maintain-sorted-entries 'crossref)
+        ((eq bibtex-maintain-sorted-entries 'crossref)
          (if (nth 1 index1)
              (if (nth 1 index2)
                  (or (string-lessp (nth 1 index1) (nth 1 index2))
@@ -3200,7 +3200,7 @@
            (if (nth 1 index2)
                (string-lessp (nth 0 index1) (nth 1 index2))
              (string-lessp (nth 0 index1) (nth 0 index2)))))
-        ((equal bibtex-maintain-sorted-entries 'entry-class)
+        ((eq bibtex-maintain-sorted-entries 'entry-class)
          (let ((n1 (cdr (or (assoc (nth 2 index1) bibtex-sort-entry-class-alist)
                             (assoc 'catch-all bibtex-sort-entry-class-alist)
                             '(nil . 1000))))  ; if there is nothing else
@@ -3210,7 +3210,7 @@
            (or (< n1 n2)
                (and (= n1 n2)
                     (string-lessp (car index1) (car index2))))))
-        (t ; (equal bibtex-maintain-sorted-entries 'plain)
+        (t ; (eq bibtex-maintain-sorted-entries 'plain)
          (string-lessp (car index1) (car index2)))))
 
 (defun bibtex-sort-buffer ()
@@ -3218,7 +3218,7 @@
 The predicate for sorting is defined via `bibtex-maintain-sorted-entries'.
 If its value is nil use plain sorting.  Text outside of BibTeX entries is not
 affected.  If `bibtex-sort-ignore-string-entries' is non-nil, @String entries
-will be ignored."
+are ignored."
   (interactive)
   (save-restriction
     (narrow-to-region (bibtex-beginning-of-first-entry)
@@ -3232,37 +3232,16 @@
                nil                         ; ENDKEY function
                'bibtex-lessp)))            ; PREDICATE
 
-(defun bibtex-find-entry-globally (key)
-  "Move point to the beginning of BibTeX entry named KEY in `bibtex-files'."
-  (interactive
-   (list (let (key-alist)
-           (dolist (buffer (bibtex-files-expand t))
-             (with-current-buffer buffer
-               (setq key-alist (append bibtex-reference-keys key-alist))))
-           (completing-read "Find key: " key-alist
-                            nil nil nil 'bibtex-key-history))))
-  (let ((buffer-list (bibtex-files-expand t))
-        buffer found)
-    (while (and (not found)
-                (setq buffer (pop buffer-list)))
-      (with-current-buffer buffer
-        (if (cdr (assoc-string key bibtex-reference-keys))
-            (setq found t))))
-    (if found
-        (progn
-	  (let ((same-window-buffer-names
-		 (cons (buffer-name buffer) same-window-buffer-names)))
-	    (pop-to-buffer buffer))
-	  (bibtex-find-entry key))
-      (message "Key `%s' not found" key))))
-
 (defun bibtex-find-crossref (crossref-key &optional pnt split)
   "Move point to the beginning of BibTeX entry CROSSREF-KEY.
-Return position of entry if CROSSREF-KEY is found and nil otherwise.
-If position of current entry is after CROSSREF-KEY an error is signaled.
-Optional arg PNT is the position of the referencing entry.
-If optional arg SPLIT is non-nil, split window so that both the referencing
-and the crossrefed entry are displayed.
+If `bibtex-files' is non-nil, search all these files.
+Otherwise the search is limited to the current buffer.
+Return position of entry if CROSSREF-KEY is found or nil otherwise.
+If CROSSREF-KEY is in the same buffer like current entry but before it
+an error is signaled.  Optional arg PNT is the position of the referencing
+entry. It defaults to position of point.  If optional arg SPLIT is non-nil,
+split window so that both the referencing and the crossrefed entry are
+displayed.
 If called interactively, CROSSREF-KEY defaults to crossref key of current
 entry and SPLIT is t."
   (interactive
@@ -3272,54 +3251,85 @@
             (let ((bounds (bibtex-search-forward-field "crossref" t)))
               (if bounds
                   (bibtex-text-in-field-bounds bounds t))))))
-     (list (bibtex-read-key "Find crossref key: " crossref-key) (point) t)))
-  (let ((pos (save-excursion (bibtex-find-entry crossref-key))))
-    (unless pnt (setq pnt (point)))
+     (list (bibtex-read-key "Find crossref key: " crossref-key t)
+           (point) t)))
+  (let (buffer pos eqb)
+    (save-excursion
+      (setq pos (bibtex-find-entry crossref-key t)
+            buffer (current-buffer)))
+    (setq eqb (eq buffer (current-buffer)))
     (cond ((not pos)
-           (message "Crossref key `%s' not found" crossref-key))
-          (split
+           (if split (message "Crossref key `%s' not found" crossref-key)))
+          (split ; called (quasi) interactively
+           (unless pnt (setq pnt (point)))
            (goto-char pnt)
-           (select-window (split-window))
+           (if eqb (select-window (split-window))
+             (pop-to-buffer buffer))
            (goto-char pos)
+           (bibtex-reposition-window)
            (beginning-of-line)
-           (set-window-start (selected-window) (point))
-           (if (> pnt pos)
+           (if (and eqb (> pnt pos))
                (error "The referencing entry must preceed the crossrefed entry!")))
-          ((> pnt pos)
-               (error "The referencing entry must preceed the crossrefed entry!"))
-          (t (goto-char pos)))
+          ;; `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
+          ;; the correct sorting order.
+          (eqb (goto-char pos))
+          (t (set-buffer buffer) (goto-char pos)))
     pos))
 
-(defun bibtex-find-entry (key &optional start)
+(defun bibtex-find-entry (key &optional global start display)
   "Move point to the beginning of BibTeX entry named KEY.
 Return position of entry if KEY is found or nil if not found.
+With prefix arg GLOBAL non-nil, search KEY in `bibtex-files'.
+Otherwise the search is limited to the current buffer.
 Optional arg START is buffer position where the search starts.
 If it is nil, start search at beginning of buffer.
-With prefix arg, the value of START is position of point."
-  (interactive (list (bibtex-read-key "Find key: ")
-                     (if current-prefix-arg (point))))
-  (let* (case-fold-search
-         (pnt (save-excursion
-                (goto-char (or start (point-min)))
-                (if (re-search-forward (concat "^[ \t]*\\("
-                                               bibtex-entry-type
-                                               "\\)[ \t]*[({][ \t\n]*\\("
-                                               (regexp-quote key)
-                                               "\\)[ \t\n]*[,=]")
-                                       nil t)
-                    (match-beginning 0)))))
-    (cond (pnt
-           (goto-char pnt))
-          ((interactive-p)
-           (message "Key `%s' not found" key)))))
+If DISPLAY is non-nil, display the buffer containing KEY.
+Otherwise, use `set-buffer'.  DISPLAY is t when called interactively."
+  (interactive (list (bibtex-read-key "Find key: " nil current-prefix-arg)
+                     current-prefix-arg nil t))
+  (if (and global bibtex-files)
+      (let ((buffer-list (bibtex-files-expand t))
+            buffer found)
+        (while (and (not found)
+                    (setq buffer (pop buffer-list)))
+          (with-current-buffer buffer
+            (if (cdr (assoc-string key bibtex-reference-keys))
+                ;; `bibtex-find-entry' moves point if key found
+                (setq found (bibtex-find-entry key)))))
+        (cond ((and found display)
+               (let ((same-window-buffer-names
+                      (cons (buffer-name buffer) same-window-buffer-names)))
+                 (pop-to-buffer buffer)
+                 (bibtex-reposition-window)))
+              (found (set-buffer buffer))
+              (display (message "Key `%s' not found" key)))
+        found)
+
+    (let* (case-fold-search
+           (pnt (save-excursion
+                  (goto-char (or start (point-min)))
+                  (if (re-search-forward (concat "^[ \t]*\\("
+                                                 bibtex-entry-type
+                                                 "\\)[ \t]*[({][ \t\n]*\\("
+                                                 (regexp-quote key)
+                                                 "\\)[ \t\n]*[,=]")
+                                         nil t)
+                      (match-beginning 0)))))
+      (cond (pnt
+             (goto-char pnt)
+             (if display (bibtex-reposition-window)))
+            (display (message "Key `%s' not found" key)))
+      pnt)))
 
 (defun bibtex-prepare-new-entry (index)
   "Prepare a new BibTeX entry with index INDEX.
 INDEX is a list (KEY CROSSREF-KEY ENTRY-NAME).
 Move point where the entry KEY should be placed.
 If `bibtex-maintain-sorted-entries' is non-nil, perform a binary
-search to look for place for KEY.  This will fail if buffer is not in
-sorted order, see \\[bibtex-validate].)
+search to look for place for KEY.  This requires that buffer is sorted,
+see \\[bibtex-validate].)
 Return t if preparation was successful or nil if entry KEY already exists."
   (let ((key (nth 0 index))
         key-exist)
@@ -3437,11 +3447,9 @@
 
           ;; Check for duplicate keys in `bibtex-files'.
           (bibtex-parse-keys)
-          (dolist (buffer (bibtex-files-expand))
-            (dolist (key (with-current-buffer buffer
-                           ;; We don't want to be fooled by outdated
-                           ;; bibtex-reference-keys.
-                           (bibtex-parse-keys) bibtex-reference-keys))
+          ;; We don't want to be fooled by outdated `bibtex-reference-keys'.
+          (dolist (buffer (bibtex-files-expand nil t))
+            (dolist (key (with-current-buffer buffer bibtex-reference-keys))
               (when (and (cdr key)
                          (cdr (assoc-string (car key) bibtex-reference-keys)))
                 (bibtex-find-entry (car key))
@@ -3540,7 +3548,7 @@
 
 (defun bibtex-validate-globally (&optional strings)
   "Check for duplicate keys in `bibtex-files'.
-With prefix arg STRINGS, check for duplicate strings, too.
+With optional prefix arg STRINGS, check for duplicate strings, too.
 Return t if test was successful, nil otherwise."
   (interactive "P")
   (let ((buffer-list (bibtex-files-expand t))
@@ -3595,8 +3603,9 @@
       (message "No duplicate keys.")
       t)))
 
-(defun bibtex-next-field (arg)
-  "Find end of text of next BibTeX field; with ARG, to its beginning."
+(defun bibtex-next-field (begin)
+  "Move point to end of text of next BibTeX field.
+With prefix BEGIN non-nil, move point to its beginning."
   (interactive "P")
   (bibtex-inside-field)
   (let ((start (point)))
@@ -3608,36 +3617,40 @@
        (goto-char start)
        (end-of-line)
        (forward-char))))
-  (bibtex-find-text arg t))
-
-(defun bibtex-find-text (arg &optional as-if-interactive no-error)
-  "Go to end of text of current field; with ARG, go to beginning."
-  (interactive "P\np")
-  (bibtex-inside-field)
-  (let ((bounds (bibtex-enclosing-field as-if-interactive)))
-    (if bounds
-        (progn (if arg
-                   (progn (goto-char (bibtex-start-of-text-in-field bounds))
-                          (if (looking-at "[{\"]")
-                              (forward-char)))
-                 (goto-char (bibtex-end-of-text-in-field bounds))
-                 (if (or (= (preceding-char) ?})
-                         (= (preceding-char) ?\"))
-                     (forward-char -1)))
-               (if bibtex-help-message
-                   (bibtex-print-help-message)))
-      (beginning-of-line)
-      (cond ((setq bounds (bibtex-parse-string))
-             (goto-char (if arg
-                            (bibtex-start-of-text-in-string bounds)
-                          (bibtex-end-of-text-in-string bounds))))
-            ((looking-at bibtex-entry-maybe-empty-head)
-             (goto-char (if arg
-                            (match-beginning bibtex-key-in-head)
-                          (match-end 0))))
-            (t
-             (unless no-error
-               (error "Not on BibTeX field")))))))
+  (bibtex-find-text begin))
+
+(defun bibtex-find-text (&optional begin noerror)
+  "Move point to end of text of current BibTeX field.
+With optional prefix BEGIN non-nil, move point to its beginning.
+Unless NOERROR is non-nil, an error is signaled if point is not
+on a BibTeX field."
+  (interactive "P")
+  (let* ((pnt (point))
+         (_ (bibtex-inside-field))
+         (bounds (bibtex-enclosing-field t)))
+    (beginning-of-line)
+    (cond (bounds
+           (if begin
+               (progn (goto-char (bibtex-start-of-text-in-field bounds))
+                      (if (looking-at "[{\"]")
+                          (forward-char)))
+             (goto-char (bibtex-end-of-text-in-field bounds))
+             (if (or (= (preceding-char) ?})
+                     (= (preceding-char) ?\"))
+                 (forward-char -1)))
+           (if bibtex-help-message
+               (bibtex-print-help-message)))
+          ((setq bounds (bibtex-parse-string))
+           (goto-char (if begin
+                          (1+ (bibtex-start-of-text-in-string bounds))
+                        (1- (bibtex-end-of-text-in-string bounds)))))
+          ((looking-at bibtex-entry-maybe-empty-head)
+           (goto-char (if begin
+                          (match-beginning bibtex-key-in-head)
+                        (match-end 0))))
+          (t
+           (goto-char pnt)
+           (unless noerror (error "Not on BibTeX field"))))))
 
 (defun bibtex-remove-OPT-or-ALT ()
   "Remove the string starting optional/alternative fields.
@@ -3690,7 +3703,7 @@
            (beg (bibtex-start-of-field bounds)))
       (goto-char end)
       (skip-chars-forward " \t\n,")
-      (push (list 'field (bibtex-name-in-field bounds)
+      (push (list (bibtex-name-in-field bounds) nil
                   (bibtex-text-in-field-bounds bounds))
             bibtex-field-kill-ring)
       (if (> (length bibtex-field-kill-ring) bibtex-field-kill-ring-max)
@@ -3703,14 +3716,14 @@
   (setq bibtex-last-kill-command 'field))
 
 (defun bibtex-copy-field-as-kill ()
-  "Copy the field at point to the kill ring."
+  "Copy the BibTeX field at point to the kill ring."
   (interactive)
   (bibtex-kill-field t))
 
 (defun bibtex-kill-entry (&optional copy-only)
   "Kill the entire enclosing BibTeX entry.
-With prefix arg COPY-ONLY the current entry to
-`bibtex-entry-kill-ring', but do not actually kill it."
+With prefix arg COPY-ONLY, copy the current entry to `bibtex-entry-kill-ring',
+but do not actually kill it."
   (interactive "P")
   (save-excursion
     (let* ((case-fold-search t)
@@ -3720,7 +3733,7 @@
                             bibtex-entry-maybe-empty-head nil 'move)
                            (goto-char (match-beginning 0)))
                        (point))))
-      (push (list 'entry (buffer-substring-no-properties beg end))
+      (push (buffer-substring-no-properties beg end)
             bibtex-entry-kill-ring)
       (if (> (length bibtex-entry-kill-ring) bibtex-entry-kill-ring-max)
           (setcdr (nthcdr (1- bibtex-entry-kill-ring-max)
@@ -3742,16 +3755,15 @@
 With argument N, reinsert the Nth most recently killed BibTeX item.
 See also the command \\[bibtex-yank-pop]]."
   (interactive "*p")
-  (bibtex-insert-current-kill (1- n))
+  (bibtex-insert-kill (1- n))
   (setq this-command 'bibtex-yank))
 
 (defun bibtex-yank-pop (n)
-  "Replace just-yanked killed BibTeX item with a different.
+  "Replace just-yanked killed BibTeX item with a different item.
 This command is allowed only immediately after a `bibtex-yank' or a
-`bibtex-yank-pop'.
-At such a time, the region contains a reinserted previously killed
-BibTeX item.  `bibtex-yank-pop' deletes that item and inserts in its
-place a different killed BibTeX item.
+`bibtex-yank-pop'.  At such a time, the region contains a reinserted
+previously killed BibTeX item.  `bibtex-yank-pop' deletes that item
+and inserts in its place a different killed BibTeX item.
 
 With no argument, the previous kill is inserted.
 With argument N, insert the Nth previous kill.
@@ -3765,7 +3777,7 @@
   (setq this-command 'bibtex-yank)
   (let ((inhibit-read-only t))
     (delete-region (point) (mark t))
-    (bibtex-insert-current-kill n)))
+    (bibtex-insert-kill n)))
 
 (defun bibtex-empty-field ()
   "Delete the text part of the current field, replace with empty text."
@@ -3797,7 +3809,7 @@
 Check that no required fields are empty and formats entry dependent
 on the value of `bibtex-entry-format'.
 If the reference key of the entry is empty or a prefix argument is given,
-calculate a new reference key.  (Note: this will only work if fields in entry
+calculate a new reference key.  (Note: this works only if fields in entry
 begin on separate lines prior to calling `bibtex-clean-entry' or if
 'realign is contained in `bibtex-entry-format'.)
 Don't call `bibtex-clean-entry' on @Preamble entries.
@@ -3807,17 +3819,16 @@
   ;; is called by bibtex-reformat
   (interactive "P")
   (let ((case-fold-search t)
-        entry-type key)
-    (bibtex-beginning-of-entry)
-    (save-excursion
-      (when (re-search-forward bibtex-entry-maybe-empty-head nil t)
-        (setq entry-type (bibtex-type-in-head))
-        (setq key (bibtex-key-in-head))))
+        (start (bibtex-beginning-of-entry))
+        (_ (looking-at bibtex-entry-maybe-empty-head))
+        (entry-type (bibtex-type-in-head))
+        (key (bibtex-key-in-head)))
     ;; formatting
     (cond ((bibtex-string= entry-type "preamble")
            ;; (bibtex-format-preamble)
            (error "No clean up of @Preamble entries"))
-          ((bibtex-string= entry-type "string"))
+          ((bibtex-string= entry-type "string")
+           (setq entry-type 'string))
           ;; (bibtex-format-string)
           (t (bibtex-format-entry)))
     ;; set key
@@ -3825,40 +3836,42 @@
       (setq key (bibtex-generate-autokey))
       ;; Sometimes bibtex-generate-autokey returns an empty string
       (if (or bibtex-autokey-edit-before-use (string= "" key))
-          (setq key (bibtex-read-key "Key to use: " key)))
-      (re-search-forward bibtex-entry-maybe-empty-head)
-      (if (match-beginning bibtex-key-in-head)
-          (delete-region (match-beginning bibtex-key-in-head)
-                         (match-end bibtex-key-in-head)))
-      (insert key))
+          (setq key (if (eq entry-type 'string)
+                        (bibtex-read-string-key key)
+                      (bibtex-read-key "Key to use: " key))))
+      (save-excursion
+        (re-search-forward (if (eq entry-type 'string)
+                               bibtex-string-maybe-empty-head
+                             bibtex-entry-maybe-empty-head))
+        (if (match-beginning bibtex-key-in-head)
+            (delete-region (match-beginning bibtex-key-in-head)
+                           (match-end bibtex-key-in-head)))
+        (insert key)))
 
     (unless called-by-reformat
-      (let* ((start (bibtex-beginning-of-entry))
-             (end (progn (bibtex-end-of-entry)
-                         (if (re-search-forward
-                              bibtex-entry-maybe-empty-head nil 'move)
-                             (goto-char (match-beginning 0)))
-                         (point)))
+      (let* ((end (save-excursion
+                    (bibtex-end-of-entry)
+                    (if (re-search-forward
+                         bibtex-entry-maybe-empty-head nil 'move)
+                        (goto-char (match-beginning 0)))
+                    (point)))
              (entry (buffer-substring start end))
              ;; include the crossref key in index
              (index (let ((bibtex-maintain-sorted-entries 'crossref))
-                      (goto-char start)
-                      (bibtex-entry-index)))
+                      (bibtex-entry-index))) ; moves point to end of head
              error)
         ;; sorting
         (if (and bibtex-maintain-sorted-entries
                  (not (and bibtex-sort-ignore-string-entries
-                           (bibtex-string= entry-type "string"))))
+                           (eq entry-type 'string))))
             (progn
               (delete-region start end)
-              (setq error (not (bibtex-prepare-new-entry index)))
-              (insert entry)
-              (forward-char -1)
-              (bibtex-beginning-of-entry) ; moves backward
-              (re-search-forward bibtex-entry-head))
+              (setq error (not (bibtex-prepare-new-entry index))
+                    start (point)) ; update start
+              (save-excursion (insert entry)))
           (bibtex-find-entry key)
           (setq error (or (/= (point) start)
-                          (bibtex-find-entry key end))))
+                          (bibtex-find-entry key nil end))))
         (if error
             (error "New inserted entry yields duplicate key"))
         (dolist (buffer (bibtex-files-expand))
@@ -3867,10 +3880,12 @@
                 (error "Duplicate key in %s" (buffer-file-name)))))
 
         ;; Only update the list of keys if it has been built already.
-        (cond ((bibtex-string= entry-type "string")
+        (cond ((eq entry-type 'string)
                (if (and (listp bibtex-strings)
                         (not (assoc key bibtex-strings)))
-                   (push (list key) bibtex-strings)))
+                   (push (cons key (bibtex-text-in-string
+                                    (save-excursion (bibtex-parse-string)) t))
+                           bibtex-strings)))
               ;; We have a normal entry.
               ((listp bibtex-reference-keys)
                (cond ((not (assoc key bibtex-reference-keys))
@@ -4041,9 +4056,9 @@
     (goto-char pnt)))
 
 (defun bibtex-convert-alien (&optional read-options)
-  "Convert an alien BibTeX buffer to be fully usable by BibTeX mode.
+  "Make an alien BibTeX buffer fully usable by BibTeX mode.
 If a file does not conform with all standards used by BibTeX mode,
-some of the high-level features of BibTeX mode will not be available.
+some of the high-level features of BibTeX mode are not available.
 This function tries to convert current buffer to conform with these standards.
 With prefix argument READ-OPTIONS non-nil, read options for reformatting
 entries from minibuffer."
@@ -4080,9 +4095,12 @@
                (<= pnt (bibtex-end-of-text-in-field bounds)))
           (setq name (bibtex-name-in-field bounds t)
                 compl (cond ((bibtex-string= name "crossref")
-                             'key)
+                             ;; point is in crossref field
+                             'crossref-key)
                             ((bibtex-string= name "month")
+                             ;; point is in month field
                              bibtex-predefined-month-strings)
+                            ;; point is in other field
                             (t (if (listp bibtex-strings)
                                    bibtex-strings
                                  ;; so that bibtex-complete-string-cleanup
@@ -4090,39 +4108,60 @@
                                  (bibtex-parse-strings
                                   (bibtex-string-files-init))))))
         (bibtex-beginning-of-entry)
-        (if (and (re-search-forward bibtex-entry-maybe-empty-head nil t)
-                 ;; point is inside a key
-                 (or (and (match-beginning bibtex-key-in-head)
-                          (>= pnt (match-beginning bibtex-key-in-head))
-                          (<= pnt (match-end bibtex-key-in-head)))
-                     ;; or point is on empty key
-                     (and (not (match-beginning bibtex-key-in-head))
-                          (= pnt (match-end 0)))))
-            (setq compl 'key))))
-
-    (cond ((equal compl 'key)
-           ;; key completion
-           (setq choose-completion-string-functions
-                 (lambda (choice buffer mini-p base-size)
-                   (let ((choose-completion-string-functions nil))
-                     (choose-completion-string choice buffer base-size))
-                   (bibtex-complete-key-cleanup choice)
-                   ;; return t (required by choose-completion-string-functions)
-                   t))
-           (bibtex-complete-key-cleanup (bibtex-complete-internal
-                                         bibtex-reference-keys)))
+        (cond ((and (looking-at bibtex-string-maybe-empty-head)
+                    ;; point is inside a string key
+                    (or (and (match-beginning bibtex-key-in-head)
+                             (>= pnt (match-beginning bibtex-key-in-head))
+                             (<= pnt (match-end bibtex-key-in-head)))
+                        ;; or point is on empty string key
+                        (and (not (match-beginning bibtex-key-in-head))
+                             (= pnt (match-end 0)))))
+               (setq compl 'string))
+              ((and (looking-at bibtex-entry-maybe-empty-head)
+                    ;; point is inside a key
+                    (or (and (match-beginning bibtex-key-in-head)
+                             (>= pnt (match-beginning bibtex-key-in-head))
+                             (<= pnt (match-end bibtex-key-in-head)))
+                        ;; or point is on empty key
+                        (and (not (match-beginning bibtex-key-in-head))
+                             (= pnt (match-end 0)))))
+               (setq compl 'key)))))
+
+    (cond ((eq compl 'key)
+           ;; key completion: no cleanup needed
+           (let (completion-ignore-case)
+             (bibtex-complete-internal (bibtex-global-key-alist))))
+
+          ((eq compl 'crossref-key)
+           ;; crossref key completion
+           (let (completion-ignore-case)
+             (setq choose-completion-string-functions
+                   (lambda (choice buffer mini-p base-size)
+                     (let ((choose-completion-string-functions nil))
+                       (choose-completion-string choice buffer base-size))
+                     (bibtex-complete-crossref-cleanup choice)
+                     ;; return t (needed by choose-completion-string-functions)
+                     t))
+             (bibtex-complete-crossref-cleanup (bibtex-complete-internal
+                                                (bibtex-global-key-alist)))))
+
+          ((eq compl 'string)
+           ;; string key completion: no cleanup needed
+           (let ((completion-ignore-case t))
+             (bibtex-complete-internal bibtex-strings)))
 
           (compl
            ;; string completion
-           (setq choose-completion-string-functions
-                 `(lambda (choice buffer mini-p base-size)
-                    (let ((choose-completion-string-functions nil))
-                      (choose-completion-string choice buffer base-size))
-                    (bibtex-complete-string-cleanup choice ',compl)
-                    ;; return t (required by choose-completion-string-functions)
-                    t))
-           (bibtex-complete-string-cleanup (bibtex-complete-internal compl)
-                                           compl))
+           (let ((completion-ignore-case t))
+             (setq choose-completion-string-functions
+                   `(lambda (choice buffer mini-p base-size)
+                      (let ((choose-completion-string-functions nil))
+                        (choose-completion-string choice buffer base-size))
+                      (bibtex-complete-string-cleanup choice ',compl)
+                      ;; return t (needed by choose-completion-string-functions)
+                      t))
+             (bibtex-complete-string-cleanup (bibtex-complete-internal compl)
+                                             compl)))
 
           (t (error "Point outside key or BibTeX field")))))
 
@@ -4193,8 +4232,7 @@
 
 (defun bibtex-String (&optional key)
   "Insert a new BibTeX @String entry with key KEY."
-  (interactive (list (completing-read "String key: " bibtex-strings
-                                      nil nil nil 'bibtex-key-history)))
+  (interactive (list (bibtex-read-string-key)))
   (let ((bibtex-maintain-sorted-entries
          (unless bibtex-sort-ignore-string-entries
            bibtex-maintain-sorted-entries))
@@ -4242,14 +4280,12 @@
           ;; Always ignore case,
           (case-fold-search t)
           (lst bibtex-generate-url-list)
-          (delim-regexp "\\`[{\"]\\(.*\\)[}\"]\\'")
           field url scheme)
       (while (setq scheme (pop lst))
         (when (and (setq field (cdr (assoc-string (caar scheme)
 						  fields-alist t)))
                    ;; Always remove field delimiters
-                   (progn (if (string-match delim-regexp field)
-                              (setq field (match-string 1 field)))
+                   (progn (setq field (bibtex-remove-delimiters-string field))
                           (string-match (cdar scheme) field)))
           (setq lst nil)
 	  (if (null (cdr scheme))
@@ -4259,8 +4295,7 @@
                    (setq url (concat url step)))
                   ((setq field (cdr (assoc-string (car step) fields-alist t)))
                    ;; Always remove field delimiters
-                   (if (string-match delim-regexp field)
-                       (setq field (match-string 1 field)))
+                   (setq field (bibtex-remove-delimiters-string field))
                    (if (string-match (nth 1 step) field)
                        (setq field (cond
                                     ((functionp (nth 2 step))
@@ -4268,7 +4303,7 @@
                                     ((numberp (nth 2 step))
                                      (match-string (nth 2 step) field))
                                     (t
-                                     (replace-match (nth 2 step) nil nil field))))
+                                     (replace-match (nth 2 step) t nil field))))
                      ;; If the scheme is set up correctly,
                      ;; we should never reach this point
                      (error "Match failed: %s" field))
--- a/lisp/textmodes/conf-mode.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/textmodes/conf-mode.el	Wed Dec 08 22:20:27 2004 +0000
@@ -76,6 +76,7 @@
     (define-key map "\C-c\C-c" 'conf-colon-mode)
     (define-key map "\C-c:" 'conf-colon-mode)
     (define-key map "\C-c\C-x" 'conf-xdefaults-mode)
+    (define-key map "\C-c\C-p" 'conf-ppd-mode)
     (define-key map "\C-c\C-q" 'conf-quote-normal)
     (define-key map "\C-c\"" 'conf-quote-normal)
     (define-key map "\C-c'" 'conf-quote-normal)
@@ -90,7 +91,6 @@
     (modify-syntax-entry ?-  "_" table)
     (modify-syntax-entry ?.  "_" table)
     (modify-syntax-entry ?\' "\"" table)
-;    (modify-syntax-entry ?:  "_" table)
     (modify-syntax-entry ?\; "<" table)
     (modify-syntax-entry ?\n ">" table)
     (modify-syntax-entry ?\r ">" table)
@@ -112,6 +112,16 @@
     table)
   "Syntax table in use in Java prperties buffers.")
 
+(defvar conf-ppd-mode-syntax-table
+  (let ((table (make-syntax-table conf-mode-syntax-table)))
+    (modify-syntax-entry ?*  ". 1" table)
+    (modify-syntax-entry ?%  ". 2" table)
+    ;; override
+    (modify-syntax-entry ?\' "." table)
+    (modify-syntax-entry ?\; "." table)
+    table)
+  "Syntax table in use in PPD conf-mode buffers.")
+
 (defvar conf-xdefaults-mode-syntax-table
   (let ((table (make-syntax-table conf-mode-syntax-table)))
     (modify-syntax-entry ?!  "<" table)
@@ -230,18 +240,19 @@
       (forward-line))))
 
 
-(defun conf-quote-normal ()
-  "Set the syntax of \" and ' to punctuation.
+(defun conf-quote-normal (arg)
+  "Set the syntax of ' and \" to punctuation.
+With prefix arg, only do it for ' if 1, or only for \" if 2.
 This only affects the current buffer.  Some conf files use quotes
 to delimit strings, while others allow quotes as simple parts of
 the assigned value.  In those files font locking will be wrong,
 and you can correct it with this command.  (Some files even do
 both, i.e. quotes delimit strings, except when they are
 unbalanced, but hey...)"
-  (interactive)
+  (interactive "P")
   (let ((table (copy-syntax-table (syntax-table))))
-    (modify-syntax-entry ?\" "." table)
-    (modify-syntax-entry ?\' "." table)
+    (if (or (not arg) (= (prefix-numeric-value arg) 1)) (modify-syntax-entry ?\' "." table))
+    (if (or (not arg) (= (prefix-numeric-value arg) 2)) (modify-syntax-entry ?\" "." table))
     (set-syntax-table table)
     (and (boundp 'font-lock-mode)
 	 font-lock-mode
@@ -284,9 +295,9 @@
 command, it will parse the buffer.  It will generally well
 identify the first four cases listed below.  If the buffer
 doesn't have enough contents to decide, this is identical to
-`conf-windows-mode' on Windows, elsewhere to `conf-unix-mode'.  See
-also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode' and
-`conf-xdefaults-mode'.
+`conf-windows-mode' on Windows, elsewhere to `conf-unix-mode'.
+See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
+`conf-ppd-mode' and `conf-xdefaults-mode'.
 
 \\{conf-mode-map}"
 
@@ -328,7 +339,7 @@
 	  mode-name name)
     (set (make-local-variable 'comment-start) comment)
     (set (make-local-variable 'comment-start-skip)
-	 (concat comment-start "+\\s *"))
+	 (concat (regexp-quote comment-start) "+\\s *"))
     (set (make-local-variable 'comment-use-syntax) t)
     (set (make-local-variable 'parse-sexp-ignore-comments) t)
     (set (make-local-variable 'outline-regexp)
@@ -343,7 +354,7 @@
 	    ;; [section]
 	    (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1)
 	    ;; section { ... }
-	    (nil "^[ \t]*\\([^=:\n]+\\)[ \t\n]*{" 1)))
+	    (nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1)))
 
     (run-mode-hooks 'conf-mode-hook)))
 
@@ -504,6 +515,21 @@
 	  ,@(cdr imenu-generic-expression))))
 
 ;;;###autoload
+(defun conf-ppd-mode ()
+  "Conf Mode starter for Adobe/CUPS PPD files.
+Comments start with `*%' and \"assignments\" are with `:'.
+For details see `conf-mode'.  Example:
+
+*% Conf mode font-locks this right with C-c C-p (PPD)
+
+*DefaultTransfer: Null
+*Transfer Null.Inverse: \"{ 1 exch sub }\""
+  (interactive)
+  (conf-colon-mode "*%" conf-ppd-mode-syntax-table "Conf[PPD]")
+  ;; no sections, they match within PostScript code
+  (setq imenu-generic-expression (list (car imenu-generic-expression))))
+
+;;;###autoload
 (defun conf-xdefaults-mode ()
   "Conf Mode starter for Xdefaults files.
 Comments start with `!' and \"assignments\" are with `:'.
--- a/lisp/textmodes/ispell.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/textmodes/ispell.el	Wed Dec 08 22:20:27 2004 +0000
@@ -769,6 +769,8 @@
 	(if buf (kill-buffer buf)))
       (set-buffer (get-buffer-create " *ispell-tmp*"))
       (erase-buffer)
+      (unless (file-exists-p default-directory)
+	(setq default-directory (expand-file-name "~/")))
       (setq status (call-process
 		    ispell-program-name nil t nil
 		    ;; aspell doesn't accept the -vv switch.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/textmodes/org.el	Wed Dec 08 22:20:27 2004 +0000
@@ -0,0 +1,7591 @@
+;; org.el --- Outline-based notes management and organizer 
+
+;; 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  (internal CVS version is $Revision: 1.2 $)
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Carsten's outline-mode for keeping track of everything.
+;;
+;;; Commentary:
+;;
+;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
+;; project planning with a fast and effective plain-text system.
+;;
+;; Org-mode develops organizational tasks around a NOTES file that contains
+;; information about projects as plain text.  Org-mode is implemented on
+;; top of outline-mode - ideal to keep the content of large files well
+;; structured.  It supports ToDo items, deadlines and time stamps, which
+;; magically appear in the diary listing of the Emacs calendar.  Tables are
+;; easily created with a built-in table editor.  Plain text URL-like links
+;; connect to websites, emails (VM,RMAIL,WANDERLUST), Usenet messages (Gnus),
+;; BBDB entries, and any files related to the projects.  For printing and
+;; sharing of notes, an Org-mode file (or a part of it) can be exported as
+;; a structured ASCII file, or as HTML.
+;;
+;; Installation
+;; ------------
+;; The instruction below assume that you have downloaded Org-mode from the
+;; web.  If Org-mode is part of the Emacs distribution or an XEmacs package,
+;; you only need to add to .emacs the last three lines of Lisp code listed
+;; below, i.e. the `auto-mode-alist' modification and the global key bindings.
+;;
+;; Byte-compile org.el and put it on your load path.  Then copy the
+;; following lines into .emacs.  The last two lines define *global*
+;; keys for the commands `org-store-link' and `org-agenda' - please
+;; choose suitable keys yourself.
+;;
+;;    (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)
+;;    (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)
+;;
+;; This will put all files with extension ".org" into Org-mode.  As an
+;; alternative, make the first line of a file look like this:
+;;
+;;     MY PROJECTS    -*- mode: org; -*-
+;;
+;; which will select Org-mode for this buffer no matter what the file's
+;; name is.
+;;
+;; Documentation
+;; -------------
+;; The documentation of Org-mode can be found in the TeXInfo file.
+;; This distribution also contains a PDF version of it.  At the homepage
+;; of Org-mode, you can find and read online the same text as HTML.
+;;
+;; Changes:
+;; -------
+;; Version 3.03
+;;    - Copyright transfer to the FSF.
+;;    - Effect of C-u and C-u C-u in org-timeline interchanged.
+;;    - Timeline now always contains today, and `.' jumps to it.
+;;    - Table editor:
+;;      - cut and paste of regtangular regions in tables
+;;      - command to convert org-mode table to table.el table and back
+;;      - command to treat several cells like a paragraph and fill it
+;;      - command to convert a buffer region to a table
+;;      - import/export tables as tab-separated files (exchange with Excel)
+;;    - Agenda:
+;;      - Sorting mechanism for agenda items rewritten from scratch.
+;;      - Sorting fully configurable.
+;;      - Entries specifying a time are sorted together.
+;;    - Completion also covers option keywords after `#-'.
+;;    - Bug fixes.
+;;
+;; Version 3.01
+;;    - New reference card, thanks to Philip Rooke for creating it.
+;;    - Single file agenda renamed to "Timeline".  It no longer shows
+;;      warnings about upcoming deadlines/overdue scheduled items.
+;;      That functionality is now limited to the (multifile) agenda.
+;;    - When reading a date, the calendar can be manipulated with keys.
+;;    - Link support for RMAIL and Wanderlust (from planner.el, untested)
+;;    - Minor bug fixes and documentation improvements.
+;;
+;; Version 3.00
+;;    - Multifile Agenda shows current entries from many different files.
+;;    - TeXInfo documentation (thanks to Christian Egli for the conversion).
+;;    - Additional applications for TODO keywords, see documentation.
+;;      Different files may have different TODO keywords etc.
+;;    - Priorities for TODO items.
+;;    - The browser mode used by `org-remember-handler' is improved.
+;;    - Images get inlined in HTML export (thanks to Carsten Wimmer).
+;;    - File links can contain line numbers, like file:/usr/etc/config:255
+;;    - Minor bug fixes.
+;;
+;; Version 2.10
+;;    - TODO entries can have additional states besides TODO and DONE.
+;;      See new variable `org-todo-keywords'.
+;;    - TODO keywords can be interpreted as categories.  See variable
+;;      `org-todo-interpretation'.
+;;    - M-TAB completion on TODO keywords, TeX symbols, and normal words.
+;;    - All keywords (like TODO, DEADLINE etc) are configurable.
+;;    - Cursor positioning optimized after pro/demotion and TODO cycling.
+;;    - Emphasizing in HTML works now for *bold*, /italic/ and _underline_.
+;;    - New commands to kill, copy and yank entire subtrees.  Yanking
+;;      modifies the level of the tree before insertion.
+;;    - New command `org-goto' (C-c C-j) to quickly move to other locations
+;;      in the buffer without affecting outline visibility.
+;;    - Hooks for John Wiegley's remember.el.
+;;    - `org-read-date' pops up calendar for date selection with the mouse.
+;;      See variable `org-popup-calendar-for-date-prompt'.  
+;;
+;; Version 2.6
+;;    - TODO items can be SCHEDULED to a certain date.
+;;    - Expired DEADLINEs are ignored if in an entry marked DONE.
+;;    - From the diary or time-sorted view (C-c C-r), C-c C-t can be used to
+;;      change the TODO state of an item remotely.
+;;    - Horizontal computations in table editor. See `org-table-eval-formula'.
+;;    - Fixed bug with summing tables (command `org-table-sum', `C-c +').
+;;    - Calendar window follows the timestamp when a timestamp is changed.
+;;      New variable `org-calendar-follow-timestamp-change'.
+;;    - Time-sorted view (`org-diary-view', C-c C-r) now uses the prefix
+;;      argument to force inclusion of unscheduled TODO items.
+;;    - New variable `org-confirm-shell-links' to turn of safety query.
+;;    - New variable `org-open-non-existing-files'.
+;;
+;; Version 2.4
+;;    - A time-sorted view on all time stamps can be created with C-c C-r.
+;;    - Timestamps and Deadlines can be shown in the Emacs diary.
+;;    - Date ranges introduced.
+;;    - Time-string formats are no longer configurable.
+;;    - Vertical lines in tables can be made invisible with `C-c |'.
+;;    - New "link" type to execute shell commands, like "shell:ls *.org"
+;;    - Upon export, "myfile.org" becomes "myfile.html" or "myfile.txt",
+;;      instead of "myfile.org.html" or "myfile.org.txt".
+;;    - When the cursor is in the white space at the beginning of a line,
+;;      TAB removes the whitespace before indenting again.
+;;
+;; Version 2.0
+;;    - Windows (NT/2000) support.
+;;    - Works with both Emacs and XEmacs.
+;;    - Fully automatic table editor.
+;;    - New link types into Gnus, VM and BBDB.
+;;    - Other link system changes
+;;      - Time stamps are treated as links to the calendar.
+;;      - Easy creation of links with global command `org-store-link'.
+;;      - Insertion of links with `C-c C-l' works differently now.
+;;      - Space characters allowed as part of a link.
+;;      - Options in `org-file-apps' extended.  The command may now be
+;;        symbol 'emacs', or a lisp form.
+;;    Please re-read the manual section about links.
+;;    - Timestamp changes
+;;      - `org-deadline' now prompts for a date.
+;;      - A line can now contain several timestamps.  Updating of a
+;;        timestamp only happens if the cursor is at the timestamp.
+;;      - Changed the time-stamp-format to ISO, to make sure it will
+;;        always work (non-English month names had caused problems
+;;        with `parse-time-string'.).  Changing the time stamp format
+;;        is not recommended.
+;;    - Picture mode enhancements have been removed from org.el
+;;
+;; Version 1.4
+;;    - Some option name changes, not backward compatible.
+;;    - ASCII exporter upgrade: Table of contents.
+;;    - HTML exporter upgrade: fixed-width regions, better
+;;      sub/superscripts, many TeX symbols supported.
+;;    - Calendar support.
+;;
+;; Version 1.3
+;;    - HTML exporter upgrade, in particular table of contents
+;;
+;; Version 1.0
+;;    - Initial release
+
+;;; Code:
+
+(eval-when-compile (require 'cl))
+(require 'outline)
+(require 'time-date)
+(require 'easymenu)
+
+;;; Customization variables
+
+(defvar org-version "3.03"
+  "The version number of the file org.el.")
+(defun org-version (arg)
+  (interactive "P")
+  (message "Org-mode version %s" org-version))
+
+;; The following two constants are for compatibility with different 
+;; Emacs versions (Emacs versus XEmacs) and with different versions of
+;; outline.el.  All the compatibility code in org.el is based on these two
+;; constants.
+(defconst org-xemacs-p (featurep 'xemacs)
+  "Are we running xemacs?")
+(defconst org-noutline-p (featurep 'noutline)
+  "Are we using the new outline mode?")
+
+(defgroup org nil
+  "Outline-based notes management and organizer "
+  :tag "Org"
+  :group 'outlines
+  :group 'hypermedia
+  :group 'calendar)
+
+(defgroup org-startup nil
+  "Options concerning startup of Org-mode."
+  :tag "Org Startup"
+  :group 'org)
+
+(defcustom org-startup-folded t
+  "Non-nil means, entering Org-mode will switch to OVERVIEW."
+  :group 'org-startup
+  :type 'boolean)
+
+(defcustom org-startup-truncated t
+  "Non-nil means, entering Org-mode will set `truncate-lines'.
+This is useful since some lines containing links can be very long and
+uninteresting.  Also tables look terrible when wrapped."
+  :group 'org-startup
+  :type 'boolean)
+
+(defcustom org-startup-with-deadline-check nil
+  "Non-nil means, entering Org-mode will run the deadline check.
+This means, if you start editing an org file, you will get an
+immediate reminder of any due deadlines."
+  :group 'org-startup
+  :type 'boolean)
+
+(defcustom org-insert-mode-line-in-empty-file t
+  "Non-nil means insert the first line setting Org-mode in empty files.
+When the function `org-mode' is called interactively in an empty, this
+normally means that the file name does not automatically trigger Org-mode.
+To ensure that the file will always be in Org-mode in the future, a
+line enforcing Org-mode can be inserted into the buffer."
+  :group 'org-startup
+  :type 'boolean)
+
+(defgroup org-keywords nil
+  "Options concerning TODO items in Org-mode."
+  :tag "Org Keywords"
+  :group 'org)
+
+(defcustom org-todo-keywords '("TODO" "DONE")
+  "List of TODO entry keywords.\\<org-mode-map>
+By default, this is '(\"TODO\" \"DONE\").  The last entry in the list is
+considered to mean that the entry is \"done\".  All the other mean that
+action is required, and will make the entry show up in todo lists, diaries
+etc.
+The command \\[org-todo] cycles an entry through these states, and an
+additional state where no keyword is present.  For details about this
+cycling, see also the variable `org-todo-interpretation'
+Changes become only effective after restarting Emacs."
+  :group 'org-keywords
+  :type '(repeat (string :tag "Keyword")))
+
+(defcustom org-todo-interpretation 'sequence
+  "Controls how TODO keywords are interpreted.\\<org-mode-map>
+Possible values are `sequence' and `type'.
+This variable is only relevant if `org-todo-keywords' contains more than two
+states.  There are two ways how these keywords can be used:
+
+- As a sequence in the process of working on a TODO item, for example
+  (setq org-todo-keywords '(\"TODO\" \"STARTED\" \"VERIFY\" \"DONE\")
+        org-todo-interpretation 'sequence)
+
+- As different types of TODO items, for example
+  (setq org-todo-keywords '(\"URGENT\" \"RELAXED\" \"REMIND\" \"FOR_TOM\" \"DONE\")
+        org-todo-interpretation 'type)
+
+When the states are interpreted as a sequence, \\[org-todo] always cycles
+to the next state, in order to walk through all different states.  So with
+\\[org-todo], you turn an empty entry into the state TODO.  When you started
+working on the item, you use \\[org-todo] again to switch it to \"STARTED\",
+later to VERIFY and finally to DONE.
+
+When the states are interpreted as types, \\[org-todo] still cycles through
+when it is called several times in direct succession, in order to initially
+select the type.  However, if not called immediately after a previous
+\\[org-todo], it switches from each type directly to DONE.  So with the
+above example, you could use `\\[org-todo] \\[org-todo]' to label an entry
+RELAXED.  If you later return to this entry and press \\[org-todo] again,
+RELAXED will not be changed REMIND, but directly to DONE.
+
+You can create a large number of types.  To initially select a
+type, it is then best to use C-u \\[org-todo] in order to specify the
+type with completion.  Of course, you can also type the keyword
+directly into the buffer.  M-TAB completes TODO keywords at the
+beginning of a headline."
+  :group 'org-keywords
+  :type '(choice (const sequence)
+                 (const type)))
+
+(defcustom org-default-priority ?B
+  "The default priority of TODO items.
+This is the priority an item get if no explicit priority is given."
+  :group 'org-keywords
+  :type 'character)
+
+(defcustom org-lowest-priority ?C
+  "The lowest priority of TODO items.  A character like ?A, ?B etc."
+  :group 'org-keywords
+  :type 'character)
+
+(defcustom org-deadline-string "DEADLINE:"
+  "String to mark deadline entries.
+A deadline is this string, followed by a time stamp.  Should be a word,
+terminated by a colon.  You can insert a schedule keyword and
+a timestamp with \\[org-deadline].
+Changes become only effective after restarting Emacs."
+  :group 'org-keywords
+  :type 'string)
+
+(defcustom org-scheduled-string "SCHEDULED:"
+  "String to mark scheduled TODO entries.
+A schedule is this string, followed by a time stamp.  Should be a word,
+terminated by a colon.  You can insert a schedule keyword and
+a timestamp with \\[org-schedule].
+Changes become only effective after restarting Emacs."
+  :group 'org-keywords
+  :type 'string)
+
+(defcustom org-comment-string "COMMENT"
+  "Entries starting with this keyword will never be exported.
+An entry can be toggled between COMMENT and normal with
+\\[org-toggle-comment].
+Changes become only effective after restarting Emacs."
+  :group 'org-keywords
+  :type 'string)
+
+(defcustom org-after-todo-state-change-hook nil
+  "Hook which is run after the state of a TODO item was changed.
+The new state (a string with a todo keyword, or nil) is available in the
+lisp variable `state'."
+  :group 'org-keywords
+  :type 'hook)
+
+;; Variables for pre-computed regular expressions, all buffer local
+(defvar org-todo-kwd-priority-p nil
+  "Do TODO items have priorities?")
+(make-variable-buffer-local 'org-todo-kwd-priority-p)
+(defvar org-todo-kwd-max-priority nil
+  "Maximum priority of TODO items")
+(make-variable-buffer-local 'org-todo-kwd-max-priority)
+(defvar org-ds-keyword-length 12
+  "Maximum length of the Deadline and SCHEDULED keywords.")
+(make-variable-buffer-local 'org-ds-keyword-length)
+(defvar org-done-string nil
+  "The last string in `org-todo-keywords', indicating an item is DONE.")
+(make-variable-buffer-local 'org-done-string)
+(defvar org-todo-regexp nil
+  "Matches any of the TODO state keywords.")
+(make-variable-buffer-local 'org-todo-regexp)
+(defvar org-not-done-regexp nil
+  "Matches any of the TODO state keywords except the last one.")
+(make-variable-buffer-local 'org-not-done-regexp)
+(defvar org-todo-line-regexp nil
+  "Matches a headline and puts TODO state into group 2 if present.")
+(make-variable-buffer-local 'org-todo-line-regexp)
+(defvar orb-nl-done-regexp nil
+  "Matches newline followed by a headline with the DONE keyword.")
+(make-variable-buffer-local 'orb-nl-done-regexp)
+(defvar org-looking-at-done-regexp nil
+  "Matches the DONE keyword a point.")
+(make-variable-buffer-local 'org-looking-at-done-regexp)
+(defvar org-deadline-regexp nil
+  "Matches the DEADLINE keyword.")
+(make-variable-buffer-local 'org-deadline-regexp)
+(defvar org-deadline-time-regexp nil
+  "Matches the DEADLINE keyword together with a time stamp.")
+(make-variable-buffer-local 'org-deadline-time-regexp)
+(defvar org-deadline-line-regexp nil
+  "Matches the DEADLINE keyword and the rest of the line.")
+(make-variable-buffer-local 'org-deadline-line-regexp)
+(defvar org-scheduled-regexp nil
+  "Matches the SCHEDULED keyword.")
+(make-variable-buffer-local 'org-scheduled-regexp)
+(defvar org-scheduled-time-regexp nil
+  "Matches the SCHEDULED keyword together with a time stamp.")
+(make-variable-buffer-local 'org-scheduled-time-regexp)
+
+(defun org-set-regexps ()
+  "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")))
+          (splitre "[ \t]+")
+          kwds int key value cat)
+      (save-restriction
+        (save-excursion
+          (widen)
+          (goto-char (point-min))
+          (while (re-search-forward re nil t)
+            (setq key (match-string 1) value (match-string 2))
+            (cond 
+             ((equal key "CATEGORY")
+              (setq cat (intern (car (org-split-string value splitre)))))
+             ((equal key "SEQ_TODO")
+              (setq int 'sequence
+                    kwds (append kwds (org-split-string value splitre))))
+             ((equal key "PRI_TODO")
+              (setq int 'priority
+                    kwds (append kwds (org-split-string value splitre))))
+             ((equal key "TYP_TODO")
+              (setq int 'type
+                    kwds (append kwds (org-split-string value splitre)))))
+            )))
+      (and cat (set (make-local-variable 'org-category) cat))
+      (and kwds (set (make-local-variable 'org-todo-keywords) kwds))
+      (and int (set (make-local-variable 'org-todo-interpretation) int)))
+    ;; Compute the regular expressions and other local variables
+    (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority)
+          org-todo-kwd-max-priority (1- (length org-todo-keywords))
+          org-ds-keyword-length (+ 2 (max (length org-deadline-string)
+                                          (length org-scheduled-string)))
+          org-done-string 
+          (nth (1- (length org-todo-keywords)) org-todo-keywords)
+          org-todo-regexp
+          (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords
+                                      "\\|") "\\)\\>")
+          org-not-done-regexp
+          (concat "\\<\\("
+                  (mapconcat 'regexp-quote
+                             (nreverse (cdr (reverse org-todo-keywords)))
+                             "\\|")
+                  "\\)\\>")
+          org-todo-line-regexp
+          (concat "^\\(\\*+\\)[ \t]*\\("
+                  (mapconcat 'regexp-quote org-todo-keywords "\\|")
+                  "\\)? *\\(.*\\)")
+          orb-nl-done-regexp
+          (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>")
+          org-looking-at-done-regexp (concat "^" org-done-string "\\>")
+          org-deadline-regexp (concat "\\<" org-deadline-string)
+          org-deadline-time-regexp
+          (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
+          org-deadline-line-regexp
+          (concat "\\<\\(" org-deadline-string "\\).*")
+          org-scheduled-regexp
+          (concat "\\<" org-scheduled-string)
+          org-scheduled-time-regexp
+          (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"
+  :group 'org)
+
+(defcustom org-deadline-warning-days 30
+  "No. of days before expiration during which a deadline becomes active.
+This variable governs the display in the org file."
+  :group 'org-time
+  :type 'number)
+
+(defcustom org-popup-calendar-for-date-prompt t
+  "Non-nil means, pop up a calendar when prompting for a date.
+In the calendar, the date can be selected with mouse-1.  However, the
+minibuffer will also be active, and you can simply enter the date as well.
+When nil, only the minibuffer will be available."
+  :group 'org-time
+  :type 'number)
+
+(defcustom org-calendar-follow-timestamp-change t
+  "Non-nil means, make the calendar window follow timestamp changes.
+When a timestamp is modified and the calendar window is visible, it will be
+moved to the new date."
+  :group 'org-time
+  :type 'boolean)
+
+(defgroup org-agenda nil
+  "Options concerning agenda display Org-mode."
+  :tag "Org Agenda"
+  :group 'org)
+
+(defcustom org-agenda-files nil
+  "A list of org files for agenda/diary display.
+Entries are added to this list with \\[org-add-file] and removed with
+\\[org-remove-file].  You can also use customize to edit the list."
+  :group 'org-agenda
+  :type '(repeat file))
+
+(defcustom org-select-timeline-window t
+  "Non-nil means, after creating a timeline, move cursor into Timeline window.
+When nil, cursor will remain in the current window."
+  :group 'org-agenda
+  :type 'boolean)
+
+(defcustom org-select-agenda-window t
+  "Non-nil means, after creating an agenda, move cursor into Agenda window.
+When nil, cursor will remain in the current window." 
+  :group 'org-agenda
+  :type 'boolean)
+
+(defcustom org-agenda-show-all-dates t
+  "Non-nil means, `org-agenda' shows every day in the selected range.
+When nil, only the days which actually have entries are shown."
+  :group 'org-agenda
+  :type 'boolean)
+
+;; FIXME: First day of month works only for current month because it would
+;; require a variable ndays treatment.
+(defcustom org-agenda-start-on-weekday 1
+  "Non-nil means, start the overview always on the specified weekday.
+0 Denotes Sunday, 1 denotes Monday etc.
+When nil, always start on the current day."
+  :group 'org-agenda
+  :type '(choice (const :tag "Today" nil)
+                 (const :tag "First day of month" t)
+                 (number :tag "Weekday No.")))
+
+(defcustom org-agenda-ndays 7
+  "Number of days to include in overview display."
+  :group 'org-agenda
+  :type 'number)
+
+(defcustom org-agenda-include-all-todo t
+  "Non-nil means, the multifile agenda will always contain alm TODO entries.
+When nil, date-less entries will only be shown if `org-agenda' is called
+with a prefix argument.
+When non-nil, the TODO entries will be listed at the top of the agenda, before
+the entries for specific days." 
+  :group 'org-agenda
+  :type 'boolean)
+
+(defcustom org-agenda-include-diary nil
+  "Non-nil means, when preparing the agenda, also get the
+entries from the emacs calendars diary."
+  :group 'org-agenda
+  :type 'boolean)
+
+
+(defcustom org-agenda-sorting-strategy '(time-up category-keep priority-down)
+  "Sorting structure for the agenda items of a single day.
+This is a list of symbols which will be used in sequence to determine
+if an entry should be listed before another entry.  The following
+symbols are recognized.
+
+time-up         Put entries with time-of-day indications first, early first
+time-down       Put entries with time-of-day indications first, late first
+category-keep   Keep the default order of categories, corresponding to the
+                sequence in `org-agenda-files'.
+category-up     Sort alphabetically by category, A-Z.
+category-down   Sort alphabetically by category, Z-A.
+priority-up     Sort numerically by priority, high priority last.
+priority-down   Sort numerically by priority, high priority first.
+
+The different possibilities will be tried in sequence, and testing stops
+if one comparison returns a \"not-equal\".  For example, the default
+    '(time-up category-keep priority-down)
+means: Pull out all entries having a specified time of day and sort them,
+in order to make a time schedule for the current day the first thing in the
+agenda listing for the day.  Of the entries without a time indication, keep
+the grouped in categories, don't sort the categories, but keep them in
+the sequence given in `org-agenda-files'.  Within each category sort by
+priority.
+
+Leaving out the `category-keep' would mean that items will be sorted across
+categories by priority."
+  :group 'org-agenda
+  :type '(repeat 
+          (choice
+           (const time-up)
+           (const time-down)
+           (const category-keep)
+           (const category-up)
+           (const category-down)
+           (const priority-up)
+           (const priority-down))))
+
+(defcustom org-sort-agenda-notime-is-late t
+  "Non-nil means, items without time are considered late.
+This is only relevant for sorting.  When t, items which have no explicit
+time like 15:30 will be considered as 24:01, i.e. later than any items which
+do have a time.  When nil, the default time is before 0:00."
+  :group 'org-agenda
+  :type 'boolean)
+
+(defvar org-category nil
+  "Variable used by org files to set a category for agenda display.
+Such files should use a file variable to set it, for example
+
+   -*- mode: org; org-category: \"ELisp\"
+
+If the file does not specify a category, the file's base name
+is used instead.")
+
+(defgroup org-structure nil
+  "Options concerning structure editing in Org-mode."
+  :tag "Org Structure"
+  :group 'org)
+
+(defcustom org-adapt-indentation t
+  "Non-nil means, adapt indentation when promoting and demoting.
+When this is set and the *entire* text in an entry is indented, the
+indentation is increased by one space in a demotion command, and
+decreased by one in a promotion command.  If any line in the entry
+body starts at column 0, indentation is not changed at all."
+  :group 'org-structure
+  :type 'boolean)
+
+(defcustom org-cycle-emulate-tab t
+  "Where should `org-cycle' emulate TAB.
+nil    Never
+white  Only in completely white lines
+t      Everywhere except in headlines"
+  :group 'org-structure
+  :type '(choice (const :tag "Never" nil)
+		 (const :tag "Only in completely white lines" white)
+		 (const :tag "Everywhere except in headlines" t)
+		 ))
+
+(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
+  "Formats for `format-time-string' which are used for time stamps.
+It is not recommended to change this constant.")
+
+(defgroup org-link nil
+  "Options concerning links in Org-mode."
+  :tag "Org Link"
+  :group 'org)
+
+(defcustom org-allow-space-in-links t
+  "Non-nil means, file names in links may contain space characters.
+When nil, it becomes possible to put several links into a line."
+  :group 'org-link
+  :type 'boolean)
+
+(defcustom org-line-numbers-in-file-links t
+  "Non-nil means, file links from `org-store-link' contain line numbers.
+The line number will be added to the file name with :NNN and interpreted
+by the command `org-open-at-point'.
+Using a prefix arg to the command \\[org-store-link] (`org-store-link')
+negates this setting for the duration of the command."
+  :group 'org-link
+  :type 'boolean)
+
+(defcustom org-keep-stored-link-after-insertion nil
+  "Non-nil means, keep link in list for entire session.
+
+The command `org-store-link' adds a link pointing to the current
+location to an internal list. These links accumulate during a session.
+The command `org-insert-link' can be used to insert links into any
+Org-mode file (offering completion for all stored links).  When this
+option is nil, every link which has been inserted once using `C-c C-l'
+will be removed from the list, to make completing the unused links
+more efficient."
+  :group 'org-link
+  :type 'boolean)
+
+(defcustom org-link-frame-setup
+  '((vm . vm-visit-folder-other-frame)
+    (gnus . gnus-other-frame)
+    (file . find-file-other-window))
+  "Setup the frame configuration for following links.
+When following a link with Emacs, it may often be useful to display
+this link in another window or frame.  This variable can be used to
+set this up for the different types of links.
+For VM, use any of
+    vm-visit-folder
+    vm-visit-folder-other-frame
+For Gnus, use any of
+    gnus
+    gnus-other-frame
+For FILE, use any of
+    find-file
+    find-file-other-window
+    find-file-other-frame
+For the calendar, use the variable `calendar-setup'.
+For BBDB, it is currently only possible to display the matches in
+another window."
+  :group 'org-link
+  :type '(list
+          (cons (const vm)
+                (choice
+                 (const vm-visit-folder)
+                 (const vm-visit-folder-other-window)
+                 (const vm-visit-folder-other-frame)))
+          (cons (const gnus)
+                (choice
+                 (const gnus)
+                 (const gnus-other-frame)))
+          (cons (const file)
+                (choice
+                 (const find-file)
+                 (const find-file-other-window)
+                 (const find-file-other-frame)))))
+
+(defcustom org-usenet-links-prefer-google nil
+  "Non-nil means, `org-store-link' will create web links to google groups.
+When nil, Gnus will be used for such links.
+Using a prefix arg to the command \\[org-store-link] (`org-store-link')
+negates this setting for the duration of the command."
+  :group 'org-link
+  :type 'boolean)
+
+(defcustom org-open-non-existing-files nil
+  "Non-nil means, `org-open-file' will open non-existing file.
+When nil, an error will be generated."
+  :group 'org-link
+  :type 'boolean)
+
+(defcustom org-confirm-shell-links t
+  "Non-nil means, ask for confirmation before executing shell links.
+The default is true, to keep new users from shooting into their own foot."
+  :group 'org-link
+  :type 'boolean)
+
+(defconst org-file-apps-defaults-linux
+  '((t        . emacs)
+    ("jpg"    . "xv %s")
+    ("gif"    . "xv %s")
+    ("ppm"    . "xv %s")
+    ("pgm"    . "xv %s")
+    ("pbm"    . "xv %s")
+    ("tif"    . "xv %s")
+    ("png"    . "xv %s")
+    ("ps"     . "gv %s")
+    ("ps.gz"  . "gv %s")
+    ("eps"    . "gv %s")
+    ("eps.gz" . "gv %s")
+    ("dvi"    . "xdvi %s")
+    ("mpeg"   . "plaympeg %s")
+    ("mp3"    . "plaympeg %s")
+    ("fig"    . "xfig %s")
+    ("pdf"    . "acroread %s")
+    ("doc"    . "soffice %s")
+    ("ppt"    . "soffice %s")
+    ("pps"    . "soffice %s")
+    ("html"   . "netscape -remote openURL(%s,new-window)")
+    ("htm"    . "netscape -remote openURL(%s,new-window)")
+    ("xs"     . "soffice %s"))
+  "Default file applications on a UNIX/LINUX system.
+See `org-file-apps'.")
+
+(defconst org-file-apps-defaults-macosx
+  '((t        . "open %s")
+    ("ps"     . "gv %s")
+    ("ps.gz"  . "gv %s")
+    ("eps"    . "gv %s")
+    ("eps.gz" . "gv %s")
+    ("dvi"    . "xdvi %s")
+    ("fig"    . "xfig %s"))
+  "Default file applications on a MacOS X system.
+The system \"open\" is known as a default, but we use X11 applications
+for some files for which the OS does not have a good default.
+See `org-file-apps'.")
+
+(defconst org-file-apps-defaults-windowsnt
+  '((t        . (w32-shell-execute "open" file)))
+  "Default file applications on a Windows NT system.
+The system \"open\" is used for most files.
+See `org-file-apps'.")
+
+(defcustom org-file-apps
+  '(
+    ("txt" . emacs)
+    ("tex" . emacs)
+    ("ltx" . emacs)
+    ("org" . emacs)
+    ("el"  . emacs)
+    )
+  "External applications for opening `file:path' items in a document.
+Org-mode uses system defaults for different file types, but
+you can use this variable to set the application for a given file
+extension.  The entries in this list are cons cells with a file extension
+and the corresponding command.  Possible values for the command are:
+ `emacs'     The file will be visited by the current Emacs process.
+ `default'   Use the default application for this file type.
+ string      A command to be executed by a shell. %s will be replaced
+             by the path to the file.
+ sexp        A lisp form which will be evaluated.  The file path will
+             be available in the lisp variable `file'.
+For more examples, see the system specific constants
+`org-file-apps-defaults-macosx'
+`org-file-apps-defaults-windowsnt'
+`org-file-apps-defaults-linux'."
+  :group 'org-link
+  :type '(repeat
+          (cons (string :tag "Extension")
+                (choice :value ""
+                 (const :tag "Visit with Emacs" 'emacs)
+                 (const :tag "Use system default" 'default)
+                 (string :tag "Command")
+                 (sexp :tag "Lisp form")))))
+
+
+(defgroup org-remember nil
+  "Options concerning interaction with remember.el."
+  :tag "Org Remember"
+  :group 'org)
+
+(defcustom org-directory "~/org"
+  "Directory with org files.
+This directory will be used as default to prompt for org files.
+Used by the hooks for remember.el."
+  :group 'org-remember
+  :type 'directory)
+
+(defcustom org-default-notes-file "~/.notes"
+  "Default target for storing notes.
+Used by the hooks for remember.el.  This can be a string, or nil to mean
+the value of `remember-data-file'."
+  :group 'org-remember
+  :type '(choice
+          (const :tag "Default from remember-data-file" nil)
+          file))
+
+(defcustom org-reverse-note-order nil
+  "Non-nil means, store new notes at the beginning of a file or entry.
+When nil, new notes will be filed to the end of a file or entry."
+  :group 'org-remember
+  :type '(choice
+          (const :tag "Reverse always" t)
+          (const :tag "Reverse never" nil)
+          (repeat :tag "By file name regexp"
+                  (cons regexp boolean))))
+
+(defgroup org-table nil
+  "Options concerning tables in Org-mode."
+  :tag "Org Table"
+  :group 'org)
+
+(defcustom org-enable-table-editor t
+  "Non-nil means, lines starting with \"|\" are handled by the table editor.
+When nil, such lines will be treated like ordinary lines."
+  :group 'org-table
+  :type 'boolean)
+
+(defcustom org-table-default-size "5x2"
+  "The default size for newly created tables, Columns x Rows."
+  :group 'org-table
+  :type 'string)
+
+(defcustom org-table-automatic-realign t
+  "Non-nil means, automatically re-align table when pressing TAB or RETURN.
+When nil, aligning is only done with \\[org-table-align], or after column
+removal/insertion."
+  :group 'org-table
+  :type 'boolean)
+
+(defcustom org-table-spaces-around-separators '(1 . 1)
+  "The number of spaces to be placed before and after separators."
+  :group 'org-table
+  :type '(cons (number :tag "Before \"|\"") (number :tag " After \"|\"")))
+
+(defcustom org-table-spaces-around-invisible-separators '(1 . 2)
+  "The number of spaces to be placed before and after separators.
+This option applies when the column separators have been made invisible."
+  :group 'org-table
+  :type '(cons (number :tag "Before \"|\"") (number :tag " After \"|\"")))
+
+(defcustom org-table-number-regexp "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$"
+  "Regular expression for recognizing numbers in table columns.
+If a table column contains mostly numbers, it will be aligned to the
+right.  If not, it will be aligned to the left.
+
+The default value of this option is a regular expression which allows
+anything which looks remotely like a number as used in scientific
+context.  For example, all of the following will be considered a
+number:
+    12    12.2    2.4e-08    2x10^12    4.034+-0.02    2.7(10)  >3.5
+
+Other options offered by the customize interface are more restrictive."
+  :group 'org-table
+  :type '(choice
+          (const :tag "Positive Integers"
+                 "^[0-9]+$")
+          (const :tag "Integers"
+                 "^[-+]?[0-9]+$")
+          (const :tag "Floating Point Numbers"
+                 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.[0-9]*\\)$")
+          (const :tag "Floating Point Number or Integer"
+                 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$")
+          (const :tag "Exponential, Floating point, Integer"
+                 "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$")
+          (const :tag "Very General Number-Like"
+                 "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$")
+          (string :tag "Regexp:")))
+
+(defcustom org-table-number-fraction 0.5
+  "Fraction of numbers in a column required to make the column align right.
+In a column all non-white fields are considered.  If at least this
+fraction of fields is matched by `org-table-number-fraction',
+alignment to the right border applies."
+  :group 'org-table
+  :type 'number)
+
+(defcustom org-export-highlight-first-table-line t
+  "Non-nil means, highlight the first table line.
+In HTML export, this means use <th> instead of <td>.
+In tables created with table.el, this applies to the first table line.
+In Org-mode tables, all lines before the first horizontal separator
+line will be formatted with <th> tags."
+  :group 'org-table
+  :type 'boolean)
+
+(defcustom org-table-tab-recognizes-table.el t
+  "Non-nil means, TAB will automatically notice a table.el table.
+When it sees such a table, it moves point into it and - if necessary -
+calls `table-recognize-table'."
+  :group 'org-table
+  :type 'boolean)
+
+(defcustom org-export-prefer-native-exporter-for-tables nil
+  "Non-nil means, always export tables created with table.el natively.
+Natively means, use the HTML code generator in table.el.
+When nil, Org-mode's own HTML generator is used when possible (i.e. if
+the table does not use row- or column-spanning).  This has the
+advantage, that the automatic HTML conversions for math symbols and
+sub/superscripts can be applied.  Org-mode's HTML generator is also
+much faster."
+  :group 'org-table
+  :type 'boolean)
+
+(defcustom org-enable-fixed-width-editor t
+  "Non-nil means, lines starting with \":\" are treated as fixed-width.
+This currently only means, they are never auto-wrapped.
+When nil, such lines will be treated like ordinary lines."
+  :group 'org-table
+  :type 'boolean)
+
+(defgroup org-export nil
+  "Options for exporting org-listings."
+  :tag "Org Export"
+  :group 'org)
+
+(defcustom org-export-language-setup
+  '(("en"  "Author"          "Date"  "Table of Contents")
+    ("da"  "Ophavsmand"      "Dato"  "Indhold")
+    ("de"  "Autor"           "Datum" "Inhaltsverzeichnis")
+    ("es"  "Autor"           "Fecha" "\xccndice")
+    ("fr"  "Auteur"          "Date"  "Table des Mati\xe8res")
+    ("it"  "Autore"          "Data"  "Indice")
+    ("nl"  "Auteur"          "Datum" "Inhoudsopgave")
+    ("nn"  "Forfattar"       "Dato"  "Innhold")  ;; nn = Norsk (nynorsk)
+    ("sv"  "F\xf6rfattarens" "Datum" "Inneh\xe5ll"))
+  "Terms used in export text, translated to different languages.
+Use the variable `org-export-default-language' to set the language,
+or use the +OPTION lines for a per-file setting."
+  :group 'org-export
+  :type '(repeat
+          (list
+           (string :tag "HTML language tag")
+           (string :tag "Author")
+           (string :tag "Date")
+           (string :tag "Table of Contents"))))
+
+(defcustom org-export-default-language "en"
+  "The default language of HTML export, as a string.
+This should have an association in `org-export-language-setup'"
+  :group 'org-export
+  :type 'string)
+
+(defcustom org-export-headline-levels 3
+  "The last level which is still exported as a headline.
+Inferior levels will produce itemize lists when exported.
+Note that a numeric prefix argument to an exporter function overrides
+this setting.
+
+This option can also be set with the +OPTIONS line, e.g. \"H:2\"."
+  :group 'org-export
+  :type 'number)
+
+(defcustom org-export-with-section-numbers t
+  "Non-nil means, add section numbers to headlines when exporting.
+
+This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-with-toc t
+  "Non-nil means, create a table of contents in exported files.
+The TOC contains headlines with levels up to`org-export-headline-levels'.
+
+Headlines which contain any TODO items will be marked with \"(*)\" in
+ASCII export, and with red color in HTML output.
+
+In HTML output, the TOC will be clickable.
+
+This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-preserve-breaks nil
+  "Non-nil means, preserve all line breaks when exporting.
+Normally, in HTML output paragraphs will be reformatted.  In ASCII
+export, line breaks will always be preserved, regardless of this variable.
+
+This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-html-inline-images t
+  "Non-nil means, inline images into exported HTML pages.
+The link will still be to the original location of the image file.
+So if you are moving the page, lets say to your public HTML site,
+you will have to move the image and maybe change the link."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-html-expand t
+  "Non-nil means, for HTML export, treat @<...> as HTML tag.
+When nil, these tags will be exported as plain text and therefore
+not be interpreted by a browser.
+
+This option can also be set with the +OPTIONS line, e.g. \"@:nil\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-with-fixed-width t
+  "Non-nil means, lines starting with \":\" will be in fixed width font.
+This can be used to have preformatted text, fragments of code etc.  For
+example
+  : ;; Some Lisp examples
+  : (while (defc cnt)
+  :   (ding))
+will be looking just like this in also HTML.  In ASCII export, this option
+has no effect.
+
+This option can also be set with the +OPTIONS line, e.g. \"::nil\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-with-tables t
+  "Non-nil means, lines starting with \"|\" define a table
+For example:
+
+  | Name        | Address  | Birthday  |
+  |-------------+----------+-----------|
+  | Arthur Dent | England  | 29.2.2100 |
+
+In ASCII export, this option has no effect.
+
+This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-html-table-tag
+  "<table border=1 cellspacing=0 cellpadding=6>"
+  "The HTML tag used to start a table.
+This must be a <table> tag, but you may change the options like
+borders and spacing."
+  :group 'org-export
+  :type 'string)
+
+(defcustom org-export-with-emphasize t
+  "Non-nil means, interprete *word*, /word/, and _word_ as emphasized text.
+If the export target supports emphasizing text, the word will be
+typeset in bold, italic, or underlined, respectively.  Works only for
+single words, but you can say: I *really* *mean* *this*.
+In ASCII export, this option has no effect.
+
+This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-match-sexp-depth 3
+  "Number of stacked braces for sub/superscript matching.
+This has to be set before loading org.el to be effective."
+  :group 'org-export
+  :type 'integer)
+
+;; FIXME: Should () parens be removed as well in sub/superscripts?
+(defcustom org-export-with-sub-superscripts t
+  "Non-nil means, interprete \"_\" and \"^\" for export.
+When this option is turned on, you can use TeX-like syntax for sub- and
+superscripts.  Several characters after \"_\" or \"^\" will be
+considered as a single item - so grouping with {} is normally not
+needed.  For example, the following things will be parsed as single
+sub- or superscripts.
+
+ 10^24   or   10^tau     several digits will be considered 1 item
+ 10^-12  or   10^-tau    a leading sign with digits or a word
+ x^2-y^3                 will be read as x^2 - y^3, because items are
+                         terminated by almost any nonword/nondigit char.
+ x_{i^2} or   x^(2-i)    braces or parenthesis do grouping.
+
+Still, ambiguity is possible - so when in doubt use {} to enclose the
+sub/superscript.
+In ASCII export, this option has no effect.
+
+This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-with-TeX-macros t
+  "Non-nil means, interprete simple TeX-like macros when exporting.
+For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
+No only real TeX macros will work here, but the standard HTML entities
+for math can be used as macro names as well.  For a list of supported
+names in HTML export, see the constant `org-html-entities'.
+In ASCII export, this option has no effect.
+
+This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-html-with-timestamp nil
+  "Non-nil means,  write `org-export-html-html-helper-timestamp'
+into the exported html text.  Otherwise, the buffer will just be saved
+to a file."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-html-html-helper-timestamp
+  "<br><br><hr><p><!-- hhmts start --> <!-- hhmts end -->\n"
+  "The HTML tag used as timestamp delimiter for HTML-helper-mode."
+  :group 'org-export
+  :type 'string)
+
+(defcustom org-export-ascii-show-new-buffer t
+  "Non-nil means, popup buffer containing the exported ASCII text.
+Otherwise the buffer will just be saved to a file and stay hidden."
+  :group 'org-export
+  :type 'boolean)
+
+(defcustom org-export-html-show-new-buffer nil
+  "Non-nil means,  popup buffer containing the exported html text.
+Otherwise, the buffer will just be saved to a file and stay hidden."
+  :group 'org-export
+  :type 'boolean)
+
+
+(defgroup org-faces nil
+  "Faces for highlighting in Org-mode."
+  :tag "Org Faces"
+  :group 'org)
+
+(defface org-level-1-face ;; font-lock-function-name-face
+  '((((type tty) (class color)) (:foreground "blue" :weight bold))
+    (((class color) (background light)) (:foreground "Blue"))
+    (((class color) (background dark)) (:foreground "LightSkyBlue"))
+    (t (:inverse-video t :bold t)))
+  "Face used for level 1 headlines."
+  :group 'org-faces)
+
+(defface org-level-2-face ;; font-lock-variable-name-face
+  '((((type tty) (class color)) (:foreground "yellow" :weight light))
+    (((class color) (background light)) (:foreground "DarkGoldenrod"))
+    (((class color) (background dark)) (:foreground "LightGoldenrod"))
+    (t (:bold t :italic t)))
+  "Face used for level 2 headlines."
+  :group 'org-faces)
+
+(defface org-level-3-face ;; font-lock-keyword-face
+  '((((type tty) (class color)) (:foreground "cyan" :weight bold))
+    (((class color) (background light)) (:foreground "Purple"))
+    (((class color) (background dark)) (:foreground "Cyan"))
+    (t (:bold t)))
+  "Face used for level 3 headlines."
+  :group 'org-faces)
+
+(defface org-level-4-face   ;; font-lock-comment-face
+  '((((type tty pc) (class color) (background light)) (:foreground "red"))
+    (((type tty pc) (class color) (background dark)) (:foreground "red1"))
+    (((class color) (background light)) (:foreground "Firebrick"))
+    (((class color) (background dark)) (:foreground "chocolate1"))
+    (t (:bold t :italic t)))
+  "Face used for level 4 headlines."
+  :group 'org-faces)
+
+(defface org-level-5-face ;; font-lock-type-face
+  '((((type tty) (class color)) (:foreground "green"))
+    (((class color) (background light)) (:foreground "ForestGreen"))
+    (((class color) (background dark)) (:foreground "PaleGreen"))
+    (t (:bold t :underline t)))
+  "Face used for level 5 headlines."
+  :group 'org-faces)
+
+(defface org-level-6-face ;; font-lock-constant-face
+  '((((type tty) (class color)) (:foreground "magenta"))
+    (((class color) (background light)) (:foreground "CadetBlue"))
+    (((class color) (background dark)) (:foreground "Aquamarine"))
+    (t (:bold t :underline t)))
+  "Face used for level 6 headlines."
+  :group 'org-faces)
+
+(defface org-level-7-face ;; font-lock-builtin-face
+  '((((type tty) (class color)) (:foreground "blue" :weight light))
+    (((class color) (background light)) (:foreground "Orchid"))
+    (((class color) (background dark)) (:foreground "LightSteelBlue"))
+    (t (:bold t)))
+  "Face used for level 7 headlines."
+  :group 'org-faces)
+
+(defface org-level-8-face ;;font-lock-string-face
+  '((((type tty) (class color)) (:foreground "green"))
+    (((class color) (background light)) (:foreground "RosyBrown"))
+    (((class color) (background dark)) (:foreground "LightSalmon"))
+    (t (:italic t)))
+  "Face used for level 8 headlines."
+  :group 'org-faces)
+
+(defface org-warning-face ;; font-lock-warning-face
+  '((((type tty) (class color)) (:foreground "red"))
+    (((class color) (background light)) (:foreground "Red" :bold t))
+    (((class color) (background dark)) (:foreground "Pink" :bold t))
+    (t (:inverse-video t :bold t)))
+  "Face for deadlines and TODO keyords."
+  :group 'org-faces)
+
+;; Inheritance does not work for xemacs, unfortunately.
+;; We just copy the definitions and waste some space....
+
+(defface org-deadline-announce-face
+  '((((type tty) (class color)) (:foreground "blue" :weight bold))
+    (((class color) (background light)) (:foreground "Blue"))
+    (((class color) (background dark)) (:foreground "LightSkyBlue"))
+    (t (:inverse-video t :bold t)))
+  "Face for upcoming deadlines."
+  :group 'org-faces)
+
+(defface org-scheduled-today-face
+  '((((type tty) (class color)) (:foreground "green"))
+    (((class color) (background light)) (:foreground "DarkGreen"))
+    (((class color) (background dark)) (:foreground "PaleGreen"))
+    (t (:bold t :underline t)))
+  "Face for items scheduled for a certain day."
+  :group 'org-faces)
+
+(defface org-scheduled-previously-face
+  '((((type tty pc) (class color) (background light)) (:foreground "red"))
+    (((type tty pc) (class color) (background dark)) (:foreground "red1"))
+    (((class color) (background light)) (:foreground "Firebrick"))
+    (((class color) (background dark)) (:foreground "chocolate1"))
+    (t (:bold t :italic t)))
+  "Face for items scheduled previously, and not yet done."
+  :group 'org-faces)
+
+(defface org-link-face 
+  '((((type tty) (class color)) (:foreground "cyan" :weight bold))
+    (((class color) (background light)) (:foreground "Purple"))
+    (((class color) (background dark)) (:foreground "Cyan"))
+    (t (:bold t)))
+  "Face for links."
+  :group 'org-faces)
+
+(defface org-done-face ;; font-lock-type-face
+  '((((type tty) (class color)) (:foreground "green"))
+    (((class color) (background light)) (:foreground "ForestGreen" :bold t))
+    (((class color) (background dark)) (:foreground "PaleGreen" :bold t))
+    (t (:bold t :underline t)))
+  "Face used for DONE."
+  :group 'org-faces)
+
+(defface org-table-face ;; font-lock-function-name-face
+  '((((type tty) (class color)) (:foreground "blue" :weight bold))
+    (((class color) (background light)) (:foreground "Blue"))
+    (((class color) (background dark)) (:foreground "LightSkyBlue"))
+    (t (:inverse-video t :bold t)))
+  "Face used for tables."
+  :group 'org-faces)
+
+(defvar org-level-faces
+  '(
+    org-level-1-face
+    org-level-2-face
+    org-level-3-face
+    org-level-4-face
+    org-level-5-face
+    org-level-6-face
+    org-level-7-face
+    org-level-8-face
+    ))
+(defvar org-n-levels (length org-level-faces))
+
+
+;; Tell the compiler about dynamically scoped variables,
+;; and variables from other packages
+(eval-when-compile
+  (defvar zmacs-regions)
+  (defvar org-transient-mark-mode)
+  (defvar org-html-entities)
+  (defvar org-goto-start-pos)
+  (defvar org-cursor-color)
+  (defvar org-time-was-given)
+  (defvar org-ts-what)
+  (defvar timecnt)
+  (defvar levels-open)
+  (defvar title)
+  (defvar author)
+  (defvar email)
+  (defvar text)
+  (defvar entry)
+  (defvar date)
+  (defvar language)
+  (defvar options)
+  (defvar ans1)
+  (defvar ans2)
+  (defvar starting-day)
+  (defvar include-all-loc)
+  (defvar vm-message-pointer)
+  (defvar vm-folder-directory)
+  (defvar wl-summary-buffer-elmo-folder)
+  (defvar wl-summary-buffer-folder-name)
+  (defvar gnus-group-name)
+  (defvar gnus-article-current)
+  (defvar w3m-current-url)
+  (defvar org-selected-point)
+  (defvar calendar-mode-map)
+  (defvar remember-save-after-remembering)
+  (defvar remember-data-file))
+
+
+;;; Define the mode
+
+(defvar org-mode-map (copy-keymap outline-mode-map)
+  "Keymap for Org-mode.")
+
+(defvar org-struct-menu)
+(defvar org-org-menu)
+
+;;;###autoload
+(defun org-mode (&optional arg)
+  "Outline-based notes management and organizer, alias 
+\"Carstens outline-mode for keeping track of everything.\"
+
+Org-mode develops organizational tasks around a NOTES file which
+contains information about projects as plain text.  Org-mode is
+implemented on top of outline-mode, which is ideal to keep the content
+of large files well structured.  It supports ToDo items, deadlines and
+time stamps, which magically appear in the diary listing of the Emacs
+calendar.  Tables are easily created with a built-in table editor.
+Plain text URL-like links connect to websites, emails (VM), Usenet
+messages (Gnus), BBDB entries, and any files related to the project.
+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:
+
+\\{org-mode-map}"
+  (interactive "P")
+  (outline-mode)
+  (setq major-mode 'org-mode)
+  (setq mode-name "Org")
+  (use-local-map org-mode-map)
+  (easy-menu-add org-org-menu)
+  (org-install-agenda-files-menu)
+  (setq outline-regexp "\\*+")
+  (if org-startup-truncated (setq truncate-lines t))
+  (org-set-regexps)
+  (set (make-local-variable 'font-lock-unfontify-region-function)
+       'org-unfontify-region)
+  ;; Activate before-change-function
+  (add-hook 'before-change-functions 'org-before-change-function nil
+            'local)
+  ;; Inhibit auto-fill for headers, tables and fixed-width lines.
+  (set (make-local-variable 'auto-fill-inhibit-regexp)
+       (concat "\\*"
+               (if (or org-enable-table-editor org-enable-fixed-width-editor)
+                   (concat
+                    "\\|[ \t]*["
+                    (if org-enable-table-editor "|" "")
+                   (if org-enable-fixed-width-editor ":"  "")
+                   "]"))))
+  ;; Hook, and startup actions
+  (if (or arg
+          (and org-insert-mode-line-in-empty-file
+               (= (point-min) (point-max))))
+      (save-excursion
+        (goto-char (point-min))
+        (insert "    -*- mode: org -*-\n\n")))
+  (run-hooks 'org-mode-hook)
+  (if org-startup-with-deadline-check
+      (call-interactively 'org-check-deadlines)
+    (if org-startup-folded (org-cycle t))))
+
+;;; Font-Lock stuff
+
+(defvar org-mouse-map (make-sparse-keymap))
+(define-key org-mouse-map 
+  (if org-xemacs-p [button2] [mouse-2]) 'org-open-at-mouse)
+(define-key org-mouse-map
+  (if org-xemacs-p [button3] [mouse-3]) 'org-find-file-at-mouse)
+
+(require 'font-lock)
+
+(defconst org-link-regexp
+  (if org-allow-space-in-links
+      "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^\t\n\r]+[^ \t\n\r]\\)"
+    "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ \t\n\r]+\\)"
+    )
+  "Regular expression for matching links.")
+(defconst org-ts-lengths
+  (cons (length (format-time-string (car org-time-stamp-formats)))
+        (length (format-time-string (cdr org-time-stamp-formats))))
+  "This holds the lengths of the two different time formats.")
+(defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*\\)>"
+  "Regular expression for fast time stamp matching.")
+(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\([^0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
+  "Regular expression matching time strings for analysis.")
+(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 ">")
+  "Regular expression matching time stamps, with groups.")
+(defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
+  "Regular expression matching a time stamp range.")
+(defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?"
+                                 org-ts-regexp "\\)?")
+  "Regular expression matching a time stamp or time stamp range.")
+
+(defun org-activate-links (limit)
+  "Run through the buffer and add overlays to links."
+  (if (re-search-forward org-link-regexp limit t)
+      (progn
+        (add-text-properties (match-beginning 0) (match-end 0)
+                             (list 'mouse-face 'highlight
+                                   'keymap org-mouse-map))
+        t)))
+
+(defun org-activate-dates (limit)
+  "Run through the buffer and add overlays to links."
+  (if (re-search-forward org-tsr-regexp limit t)
+      (progn
+        (add-text-properties (match-beginning 0) (match-end 0)
+                             (list 'mouse-face 'highlight
+                                   'keymap org-mouse-map))
+        t)))
+
+
+(defun org-font-lock-level ()
+  (save-excursion
+    (org-back-to-heading t)
+    (- (match-end 0) (match-beginning 0))))
+
+(defun org-set-font-lock-defaults ()
+  (let ((org-font-lock-extra-keywords
+         (list
+          '(org-activate-links (0 'org-link-face))
+          '(org-activate-dates (0 'org-link-face))
+          (list (concat "^\\*+[ \t]*" org-not-done-regexp) '(1 'org-warning-face t))
+          (list (concat "\\[#[A-Z]\\]") '(0 'org-warning-face t))
+          (list (concat "\\<" org-deadline-string) '(0 'org-warning-face t))
+          (list (concat "\\<" org-scheduled-string) '(0 'org-warning-face t))
+          ;; '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)"
+          ;; (3 'bold))
+          ;; '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)" 
+          ;; (3 'italic))
+          ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" 
+          ;; (3 'underline))
+          '("\\<FIXME\\>" (0 'org-warning-face t))
+          (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>")
+                '(1 'org-warning-face t))
+          '("^#.*" (0 'font-lock-comment-face t))
+          (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>")
+                '(1 'org-done-face t))
+          '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
+            (1 'org-table-face t))
+          '("^[ \t]*\\(:.*\\)" (1 'org-table-face t)))))
+    (set (make-local-variable 'org-font-lock-keywords)
+         (append
+          (if org-noutline-p     ; FIXME:  I am not sure if eval will work
+                                 ; on XEmacs if noutline is ever ported
+              '((eval . (list "^\\(\\*+\\).*"
+                              0 '(nth 
+                                  (% (- (match-end 1) (match-beginning 1) 1)
+                                     org-n-levels)
+                                  org-level-faces)
+                              nil t)))
+            '(("^\\(\\(\\*+\\)[^\r\n]*\\)[\n\r]"
+               (1 (nth (% (- (match-end 2) (match-beginning 2) 1)
+                          org-n-levels)
+                       org-level-faces)
+                  nil t))))
+          org-font-lock-extra-keywords))
+    (set (make-local-variable 'font-lock-defaults)
+         '(org-font-lock-keywords t nil nil backward-paragraph))
+    (kill-local-variable 'font-lock-keywords) nil))
+    
+(defvar org-font-lock-keywords nil)
+
+(defun org-unfontify-region (beg end &optional maybe_loudly)
+  "Remove fontification and activation overlays from links."
+  (font-lock-default-unfontify-region beg end)
+  (let* ((modified (buffer-modified-p)) ;; FIXME: Why did I add this???
+         (buffer-undo-list t)
+         (inhibit-read-only t) (inhibit-point-motion-hooks t)
+         (inhibit-modification-hooks t)
+         deactivate-mark buffer-file-name buffer-file-truename)
+    (remove-text-properties beg end '(mouse-face nil keymap nil))))
+
+;;; Visibility cycling
+
+(defvar org-cycle-global-status nil)
+(defvar org-cycle-subtree-status nil)
+(defun org-cycle (&optional arg)
+  "Visibility cycling for outline(-minor)-mode.
+
+- When this function is called with a prefix argument, rotate the entire
+  buffer through 3 states (global cycling)
+  1. OVERVIEW: Show only top-level headlines.
+  2. CONTENTS: Show all headlines of all levels, but no body text.
+  3. SHOW ALL: Show everything.
+
+- When point is at the beginning of a headline, rotate the subtree started
+  by this line through 3 different states (local cycling)
+  1. FOLDED:   Only the main headline is shown.
+  2. CHILDREN: The main headline and the direct children are shown.  From
+               this state, you can move to one of the children and
+               zoom in further.
+  3. SUBTREE:  Show the entire subtree, including body text.
+
+- When point is not at the beginning of a headline, execute
+  `indent-relative', like TAB normally does.  See the option
+  `org-cycle-emulate-tab' for details.
+
+- Special case: if point is the the beginning of the buffer and there is
+  no headline in line 1, this function will act as if called with prefix arg."
+  (interactive "P")
+
+  (if (and (bobp) (not (looking-at outline-regexp)))
+      ; special case:  use global cycling
+      (setq arg t))
+
+  (cond
+
+   ((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)))
+
+   (arg ;; Global cycling
+
+    (cond
+     ((and (eq last-command this-command)
+	   (eq org-cycle-global-status 'overview))
+      ;; We just created the overview - now do table of contents
+      ;; This can be slow in very large buffers, so indicate action
+      (message "CONTENTS...")
+      (save-excursion
+	;; Visit all headings and show their offspring
+	(goto-char (point-max))
+	(catch 'exit
+	  (while (and (progn (condition-case nil
+				 (outline-previous-visible-heading 1)
+			       (error (goto-char (point-min))))
+			     t)
+		      (looking-at outline-regexp))
+	    (show-branches)
+	    (if (bobp) (throw 'exit nil))))
+	(message "CONTENTS...done"))
+      (setq org-cycle-global-status 'contents))
+     ((and (eq last-command this-command)
+	   (eq org-cycle-global-status 'contents))
+      ;; We just showed the table of contents - now show everything
+      (show-all)
+      (message "SHOW ALL")
+      (setq org-cycle-global-status 'all))
+     (t
+      ;; Default action: go to overview
+      (hide-sublevels 1)
+      (message "OVERVIEW")
+      (setq org-cycle-global-status 'overview))))
+
+   ((save-excursion (beginning-of-line 1) (looking-at outline-regexp))
+    ;; At a heading: rotate between three different views
+    (org-back-to-heading)
+    (let ((goal-column 0) beg eoh eol eos nxh)
+      ;; First, some boundaries
+      (save-excursion
+	(org-back-to-heading)  (setq beg (point))
+	(save-excursion
+	  (beginning-of-line 2)
+	  (while (and (not (eobp))   ;; this is like `next-line'
+		      (get-char-property (1- (point)) 'invisible))
+	    (beginning-of-line 2)) (setq eol (point)))
+	(outline-end-of-heading)   (setq eoh (point))
+	(outline-end-of-subtree)   (setq eos (point))
+        (outline-next-heading)     (setq nxh (point)))
+      ;; Find out what to do next and set `this-command'
+      (cond
+       ((= eos eoh)
+	;; Nothing is hidden behind this heading
+        (message "EMPTY ENTRY")
+        (setq org-cycle-subtree-status nil))
+       ((>= eol eos)
+	;; Entire subtree is hidden in one line: open it
+	(show-entry)
+	(show-children)
+	(message "CHILDREN")
+	(setq org-cycle-subtree-status 'children))
+       ((and (eq last-command this-command)
+	     (eq org-cycle-subtree-status 'children))
+	;; We just showed the children, now show everything.
+	(show-subtree)
+	(message "SUBTREE")
+	(setq org-cycle-subtree-status 'subtree))
+       (t
+	;; Default action: hide the subtree.
+	(hide-subtree)
+	(message "FOLDED")
+	(setq org-cycle-subtree-status 'folded)))))
+
+   ;; TAB emulation
+   (buffer-read-only (org-back-to-heading))
+   ((if (and (eq org-cycle-emulate-tab 'white)
+	     (save-excursion (beginning-of-line 1) (looking-at "[ \t]+$")))
+	t
+      (eq org-cycle-emulate-tab t))
+    (if (and (looking-at "[ \n\r\t]")
+             (string-match "^[ \t]*$" (buffer-substring
+                                       (point-at-bol) (point))))
+        (progn
+          (beginning-of-line 1)
+          (and (looking-at "[ \t]+") (replace-match ""))))
+    (indent-relative))
+
+   (t (save-excursion
+        (org-back-to-heading)
+        (org-cycle)))))
+
+(defvar org-goto-window-configuration nil)
+(defvar org-goto-marker nil)
+(defvar org-goto-map (make-sparse-keymap))
+(let ((cmds '(isearch-forward isearch-backward)) cmd)
+  (while (setq cmd (pop cmds))
+    (substitute-key-definition cmd cmd org-goto-map global-map)))
+(define-key org-goto-map [(return)] 'org-goto-ret)
+(define-key org-goto-map [(left)]   'org-goto-left)
+(define-key org-goto-map [(right)]  'org-goto-right)
+(define-key org-goto-map [(?q)]     'org-goto-quit)
+(define-key org-goto-map [(control ?g)] 'org-goto-quit)
+(define-key org-goto-map [(tab)] 'org-cycle)
+(define-key org-goto-map [(down)] 'outline-next-visible-heading)
+(define-key org-goto-map [(up)] 'outline-previous-visible-heading)
+(define-key org-goto-map "n" 'outline-next-visible-heading)
+(define-key org-goto-map "p" 'outline-previous-visible-heading)
+(define-key org-goto-map "f" 'outline-forward-same-level)
+(define-key org-goto-map "b" 'outline-backward-same-level)
+(define-key org-goto-map "u" 'outline-up-heading)
+(define-key org-goto-map "\C-c\C-n" 'outline-next-visible-heading)
+(define-key org-goto-map "\C-c\C-p" 'outline-previous-visible-heading)
+(define-key org-goto-map "\C-c\C-f" 'outline-forward-same-level)
+(define-key org-goto-map "\C-c\C-b" 'outline-backward-same-level)
+(define-key org-goto-map "\C-c\C-u" 'outline-up-heading)
+(let ((l '(1 2 3 4 5 6 7 8 9 0)))
+  (while l (define-key org-goto-map (int-to-string (pop l)) 'digit-argument)))
+
+(defconst org-goto-help
+"Select a location to jump to, press RET
+\[Up]/[Down]=next/prev headline   TAB=cycle visibility   RET=select   [Q]uit")
+
+(defun org-goto ()
+  "Go to a different location of the document, keeping current visibility.
+
+When you want to go to a different location in a document, the fastest way
+is often to fold the entire buffer and then dive into the tree.  This
+method has the disadvantage, than the previous location will be folded, and
+that can be unwanted.
+
+This command works around this by showing a copy of the current buffer in
+overview mode.  You can dive into the tree in that copy, to find the
+location you want to reach.  When pressing RET, the command returns to the
+original buffer in which the visibility is still unchanged.  It then jumps
+to the new location, making it and the headline hierarchy above it visible."
+  (interactive)
+  (let* ((org-goto-start-pos (point))
+         (selected-point
+          (org-get-location (current-buffer) org-goto-help)))
+    (if selected-point
+        (progn
+          (goto-char selected-point)
+          (if (org-invisible-p) (org-show-hierarchy-above)))
+      (error "Quit"))))
+
+(defun org-get-location (buf help)
+  "Let the user select a location in the Org-mode buffer BUF.
+This function uses a recursive edit.  It returns the selected position
+or nil."
+  (let (org-selected-point)
+    (save-excursion
+      (save-window-excursion
+        (delete-other-windows)
+        (switch-to-buffer (get-buffer-create "*org-goto*"))
+        (with-output-to-temp-buffer "*Help*"
+          (princ help))
+        (shrink-window-if-larger-than-buffer (get-buffer-window "*Help*"))
+        (setq buffer-read-only nil)
+        (erase-buffer)
+        (insert-buffer buf)
+        (let ((org-startup-truncated t)
+              (org-startup-folded t)
+              (org-startup-with-deadline-check nil))
+          (org-mode))
+        (setq buffer-read-only t)
+        (if (boundp 'org-goto-start-pos)
+            (goto-char org-goto-start-pos)
+          (goto-char (point-min)))
+        (org-beginning-of-line)
+        (message "Select location and press RET")
+        ;; now we make sure that during selection, ony very few keys work
+        ;; and that it is impossible to switch to another window.
+        (let ((gm (current-global-map))
+              (overriding-local-map org-goto-map))
+          (unwind-protect
+              (progn
+                (use-global-map org-goto-map)
+                (recursive-edit))
+            (use-global-map gm)))))
+    (kill-buffer "*org-goto*")
+    org-selected-point))
+
+;;  FIXME:  It may not be a good idea to temper with the prefix argument...
+(defun org-goto-ret (&optional arg)
+  "Finish org-goto by going to the new location."
+  (interactive "P")
+  (setq org-selected-point (point)
+        current-prefix-arg arg)
+  (throw 'exit nil))
+
+(defun org-goto-left (&optional arg)
+  "Finish org-goto by going to the new location."
+  (interactive "P")
+  (if (org-on-heading-p)
+      (progn
+        (beginning-of-line 1)
+        (setq org-selected-point (point)
+              current-prefix-arg (- (match-end 0) (match-beginning 0)))
+        (throw 'exit nil))
+    (error "Not on a heading")))
+
+(defun org-goto-right (&optional arg)
+  "Finish org-goto by going to the new location."
+  (interactive "P")
+  (if (org-on-heading-p)
+      (progn
+        (outline-end-of-subtree)
+        (or (eobp) (forward-char 1))
+        (setq org-selected-point (point)
+              current-prefix-arg (- (match-end 0) (match-beginning 0)))
+        (throw 'exit nil))
+    (error "Not on a heading")))
+
+(defun org-goto-quit ()
+  "Finish org-goto without cursor motion."
+  (interactive)
+  (setq org-selected-point nil)
+  (throw 'exit nil))
+
+;;; Promotion, Demotion, Inserting new headlines
+
+(defvar org-ignore-region nil
+  "To temporary disable the active region.")
+
+(defun org-insert-heading ()
+  "Insert a new heading with same depth at point."
+  (interactive)
+  (let* ((head (save-excursion
+		 (condition-case nil
+		     (org-back-to-heading)
+		   (error (outline-next-heading)))
+		 (prog1 (match-string 0)
+		   (funcall outline-level)))))
+    (unless (bolp) (newline))
+    (insert head)
+    (unless (eolp)
+      (save-excursion (newline-and-indent)))
+    (unless (equal (char-before) ?\ )
+      (insert " "))
+    (run-hooks 'org-insert-heading-hook)))
+
+(defun org-promote-subtree (&optional arg)
+  "Promote the entire subtree.
+See also `org-promote'."
+  (interactive "P")
+  (org-map-tree 'org-promote))
+
+(defun org-demote-subtree (&optional arg)
+  "Demote the entire subtree.  See `org-demote'.
+See also `org-promote'."
+  (interactive "P")
+  (org-map-tree 'org-demote))
+
+(defun org-do-promote (&optional arg)
+  "Promote the current heading higher up the tree.
+If the region is active in transient-mark-mode, promote all headings
+in the region."
+  (interactive "P")
+  (save-excursion
+    (if (org-region-active-p)
+        (org-map-region 'org-promote (region-beginning) (region-end))
+      (org-promote)))
+  (org-fix-position-after-promote))
+
+(defun org-do-demote (&optional arg)
+  "Demote the current heading lower down the tree.
+If the region is active in transient-mark-mode, demote all headings
+in the region."
+  (interactive "P")
+  (save-excursion
+    (if (org-region-active-p)
+        (org-map-region 'org-demote (region-beginning) (region-end))
+      (org-demote)))
+  (org-fix-position-after-promote))
+
+(defun org-fix-position-after-promote ()
+  "Make sure that after pro/demotion cursor position is right."
+  (and (equal (char-after) ?\ )
+       (equal (char-before) ?*)
+       (forward-char 1)))
+
+(defun org-promote ()
+  "Promote the current heading higher up the tree.
+If the region is active in transient-mark-mode, promote all headings
+in the region."
+  (org-back-to-heading t)
+  (let* ((level (save-match-data (funcall outline-level)))
+         (up-head (make-string (1- level) ?*)))
+    (if (= level 1) (error "Cannot promote to level 0. UNDO to recover."))
+    (replace-match up-head nil t)
+    (if org-adapt-indentation
+        (org-fixup-indentation "^ " "" "^ ?\\S-"))))
+
+(defun org-demote ()
+  "Demote the current heading lower down the tree.
+If the region is active in transient-mark-mode, demote all headings
+in the region."
+  (org-back-to-heading t)
+  (let* ((level (save-match-data (funcall outline-level)))
+         (down-head (make-string (1+ level) ?*)))
+    (replace-match down-head nil t)
+    (if org-adapt-indentation
+        (org-fixup-indentation "^ " "  " "^\\S-"))))
+
+(defun org-map-tree (fun)
+  "Call FUN for every heading underneath the current one."
+  (org-back-to-heading)
+  (let ((level (outline-level)))
+    (save-excursion
+      (funcall fun)
+      (while (and (progn
+                    (outline-next-heading)
+                    (> (funcall outline-level) level))
+                  (not (eobp)))
+        (funcall fun)))))
+
+(defun org-map-region (fun beg end)
+  "Call FUN for every heading between BEG and END."
+  (let ((org-ignore-region t))
+    (save-excursion
+      (setq end (copy-marker end))
+      (goto-char beg)
+      ;;      (if (fboundp 'deactivate-mark) (deactivate-mark))
+      ;;    (if (fboundp 'zmacs-deactivate-region) (zmacs-deactivate-region))
+      (if (and (re-search-forward (concat "^" outline-regexp) nil t)
+               (< (point) end))
+          (funcall fun))
+      (while (and (progn
+                    (outline-next-heading)
+                    (< (point) end))
+                  (not (eobp)))
+        (funcall fun)))))
+
+(defun org-fixup-indentation (from to prohibit)
+  "Change the indentation in the current entry by re-replacing FROM with TO.
+However, if the regexp PROHIBIT matches at all, don't do anything.
+This is being used to change indentation along with the length of the
+heading marker.  But if there are any lines which are not indented, nothing
+is changed at all."
+  (save-excursion
+    (let ((end (save-excursion (outline-next-heading)
+                               (point-marker))))
+      (unless (save-excursion (re-search-forward prohibit end t))
+        (while (re-search-forward from end t)
+          (replace-match to)
+          (beginning-of-line 2)))
+      (move-marker end nil))))
+
+;;; Vertical tree motion, cutting and pasting of subtrees
+
+(defun org-move-subtree-up (&optional arg)
+  "Move the current subtree up past ARG headlines of the same level."
+  (interactive "p")
+  (org-move-subtree-down (- (prefix-numeric-value arg))))
+
+(defun org-move-subtree-down (&optional arg)
+  "Move the current subtree down past ARG headlines of the same level."
+  (interactive "p")
+  (setq arg (prefix-numeric-value arg))
+  (let ((movfunc (if (> arg 0) 'outline-get-next-sibling
+		   'outline-get-last-sibling))
+	(ins-point (make-marker))
+	(cnt (abs arg))
+	beg end txt folded)
+    ;; Select the tree
+    (org-back-to-heading)
+    (setq beg (point))
+    (save-match-data
+      (save-excursion (outline-end-of-heading)
+		      (setq folded (org-invisible-p)))
+      (outline-end-of-subtree))
+    (if (equal (char-after) ?\n) (forward-char 1))
+    (setq end (point))
+    ;; Find insertion point, with error handling
+    (goto-char beg)
+    (while (> cnt 0)
+      (or (and (funcall movfunc) (looking-at outline-regexp))
+	  (progn (goto-char beg)
+		 (error "Cannot move past superior level or buffer limit")))
+      (setq cnt (1- cnt)))
+    (if (> arg 0)
+	;; Moving forward - still need to move over subtree
+	(progn (outline-end-of-subtree)
+	       (if (equal (char-after) ?\n) (forward-char 1))))
+    (move-marker ins-point (point))
+    (setq txt (buffer-substring beg end))
+    (delete-region beg end)
+    (insert txt)
+    (goto-char ins-point)
+    (if folded (hide-subtree))
+    (move-marker ins-point nil)))
+
+(defvar org-subtree-clip ""
+  "Clipboard for cut and paste of subtrees.
+This is actually only a cpoy of the kill, because we use the normal kill
+ring.  We need it to check if the kill was created by `org-copy-subtree'.")
+
+(defvar org-subtree-clip-folded nil
+  "Was the last copied suptree folded?
+This is used to fold the tree back after pasting.")
+
+(defun org-cut-subtree (&optional arg)
+  "Cut the current subtree into the clipboard.
+This is a short-hand for marking the subtree and then cutting it."
+  (interactive "p")
+  (org-copy-subtree arg 'cut))
+
+(defun org-copy-subtree (&optional arg cut)
+  "Cut the current subtree into the clipboard.
+This is a short-hand for marking the subtree and then copying it.
+If CUT is non nil, actually cur the subtree."
+  (interactive "p")
+  (let (beg end folded)
+    (org-back-to-heading)
+    (setq beg (point))
+    (save-match-data
+      (save-excursion (outline-end-of-heading)
+                      (setq folded (org-invisible-p)))
+      (outline-end-of-subtree))
+    (if (equal (char-after) ?\n) (forward-char 1))
+    (setq end (point))
+    (goto-char beg)
+    (when (> end beg)
+      (setq org-subtree-clip-folded folded)
+      (if cut (kill-region beg end) (copy-region-as-kill beg end))
+      (setq org-subtree-clip (current-kill 0))
+      (message "%s: Subtree with %d characters"
+               (if cut "Cut" "Copied")
+               (length org-subtree-clip)))))
+
+(defun org-paste-subtree (&optional level tree)
+  "Paste the clipboard as a subtree, with modification of headline level.
+The entire subtree is promoted or demoted in order to match a new headline
+level.  By default, the new level is derived from the visible headings
+before and after the insertion point, and taken to be the inferior headline
+level of the two.  So if the previous visible heading is level 3 and the
+next is level 4 (or vice versa), level 4 will be used for insertion.
+This makes sure that the subtree remains an independent subtree and does
+not swallow low level entries.
+
+You can also force a different level, either by using a numeric prefix
+argument, or by inserting the heading marker by hand.  For example, if the
+cursor is after \"*****\", then the tree will be shifted to level 5.
+
+If you want to insert the tree as is, just use \\[yank].
+
+If optional TREE is given, use this text instead of the kill ring."
+  (interactive "P")
+  (unless (org-kill-is-subtree-p tree)
+    (error
+     (substitute-command-keys
+      "The kill is not a (set of) tree(s) - please use \\[yank] to yank anyway")))
+  (let* ((txt (or tree (current-kill 0)))
+         (^re (concat "^\\(" outline-regexp "\\)"))
+         (re  (concat "\\(" outline-regexp "\\)"))
+         (^re_ (concat "\\(" outline-regexp "\\)[  \t]*"))
+
+         (old-level (if (string-match ^re txt)
+                        (- (match-end 0) (match-beginning 0))
+                      -1))
+         (force-level (cond (level (prefix-numeric-value level))
+                            ((string-match
+                              ^re_ (buffer-substring (point-at-bol) (point)))
+                             (- (match-end 0) (match-beginning 0)))
+                            (t nil)))
+         (prevous-level (save-excursion
+                          (outline-previous-visible-heading 1)
+                          (if (looking-at re)
+                              (- (match-end 0) (match-beginning 0))
+                            1)))
+         (next-level (save-excursion
+                       (outline-next-visible-heading 1)
+                       (if (looking-at re)
+                           (- (match-end 0) (match-beginning 0))
+                         1)))
+         (new-level (or force-level (max prevous-level next-level)))
+         (shift (if (or (= old-level -1)
+                        (= new-level -1)
+                        (= old-level new-level))
+                    0
+                  (- new-level old-level)))
+         (shift1 shift)
+         (delta (if (> shift 0) -1 1))
+         (func (if (> shift 0) 'org-demote 'org-promote))
+         beg end)
+    ;; Remove the forces level indicator
+    (if force-level
+        (delete-region (point-at-bol) (point)))
+    ;; Make sure we start at the beginning of an empty line
+    (if (not (bolp)) (insert "\n"))
+    (if (not (looking-at "[ \t]*$"))
+        (progn (insert "\n") (backward-char 1)))
+    ;; Paste
+    (setq beg (point))
+    (insert txt)
+    (setq end (point))
+    (goto-char beg)
+    ;; Shift if necessary
+    (if (= shift 0)
+        (message "Pasted at level %d, without shift" new-level)
+      (save-restriction
+        (narrow-to-region beg end)
+        (while (not (= shift 0))
+          (org-map-region func (point-min) (point-max))
+          (setq shift (+ delta shift)))
+        (goto-char (point-min))
+        (message "Pasted at level %d, with shift by %d levels"
+                 new-level shift1)))
+    (if (and (eq org-subtree-clip (current-kill 0))
+             org-subtree-clip-folded)
+        ;; The tree was folded before it was killed/copied
+        (hide-subtree))))
+
+(defun org-kill-is-subtree-p (&optional txt)
+  "Check if the current kill is an outline subtree, or a set of trees.
+Returns nil if kill does not start with a headline, or if the first
+headline level is not the largest headline level in the tree.
+So this will actually acceept several entries of equal levels as well,
+which is OK for `org-paste-subtree'.
+If optional TXT is given, check this string instead of the current kill."
+  (let* ((kill (or txt (current-kill 0) ""))
+         (start-level (and (string-match (concat "\\`" outline-regexp) kill)
+                           (- (match-end 0) (match-beginning 0))))
+         (re (concat "^" outline-regexp))
+         (start 1))
+    (if (not start-level)
+        nil  ;; does not even start with a heading
+      (catch 'exit
+        (while (setq start (string-match re kill (1+ start)))
+          (if (< (- (match-end 0) (match-beginning 0)) start-level)
+              (throw 'exit nil)))
+        t))))
+
+;;; Completion
+
+(defun org-complete (&optional arg)
+  "Perform completion on word at point.
+At the beginning of a headline, this completes TODO keywords as given in
+`org-todo-keywords'.
+If the current word is preceeded by a backslash, completes the TeX symbols
+that are supported for HTML support.
+If the current word is preceeded by \"#+\", completes special words for
+setting file options.
+At all other locations, this simply calls `ispell-complete-word'."
+  (interactive "P")
+  (catch 'exit
+    (let* ((end (point))
+           (beg (save-excursion
+                  (if (equal (char-before (point)) ?\ ) (backward-char 1))
+                  (skip-chars-backward "a-zA-Z0-9_:")
+                  (point)))
+           (texp (equal (char-before beg) ?\\))
+           (opt (equal (buffer-substring (max (point-at-bol) (- beg 2))
+                                         beg)
+                       "#+"))
+           (pattern (buffer-substring-no-properties beg end))
+           (completion-ignore-case opt)
+           (type nil)
+           (table (cond
+                   (opt
+                    (setq type :opt)
+                    (mapcar (lambda (x) 
+                              (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)
+                              (cons (match-string 2 x) (match-string 1 x)))
+                            (org-split-string (org-get-current-options) "\n")))
+                   (texp 
+                    (setq type :tex)
+                    org-html-entities)
+                   ((string-match "\\`\\*+[ \t]*\\'"
+                                  (buffer-substring (point-at-bol) beg))
+                    (setq type :todo)
+                    (mapcar 'list org-todo-keywords))
+                   (t (progn (ispell-complete-word arg) (throw 'exit nil)))))
+           (completion (try-completion pattern table)))
+      (cond ((eq completion t)
+             (if (equal type :opt) 
+                 (insert (substring (cdr (assoc (upcase pattern) table))
+                                    (length pattern)))))
+            ((null completion)
+             (message "Can't find completion for \"%s\"" pattern)
+             (ding))
+            ((not (string= pattern completion))
+             (delete-region beg end)
+             (if (string-match " +$" completion) 
+                 (setq completion (replace-match "" t t completion)))
+             (insert completion)
+             (if (get-buffer-window "*Completions*")
+                 (delete-window (get-buffer-window "*Completions*")))
+             (if (and (eq type :todo)
+                      (assoc completion table))
+                 (insert " "))
+             (if (and (equal type :opt) (assoc completion table))
+                 (message (substitute-command-keys
+                           "Press \\[org-complete] again to insert example settings"))))
+            (t
+             (message "Making completion list...")
+             (let ((list (sort (all-completions pattern table) 'string<)))
+               (with-output-to-temp-buffer "*Completions*"
+                 (display-completion-list list)))
+             (message "Making completion list...%s" "done"))))))
+
+;;; Comments, TODO and DEADLINE
+
+(defun org-toggle-comment ()
+  "Change the COMMENT state of an entry."
+  (interactive)
+  (save-excursion
+    (org-back-to-heading)
+    (if (looking-at (concat outline-regexp
+                            "\\( +\\<" org-comment-string "\\>\\)"))
+        (replace-match "" t t nil 1)
+      (if (looking-at outline-regexp)
+          (progn
+            (goto-char (match-end 0))
+            (insert " " org-comment-string))))))
+
+(defun org-todo (&optional arg)
+  "Change the TODO state of an item.
+The state of an item is given by a keyword at the start of the heading,
+like
+     *** TODO Write paper
+     *** DONE Call mom
+
+The different keywords are specified in the variable `org-todo-keywords'.  By
+default the available states are \"TODO\" and \"DONE\".
+So for this example: when the item starts with TODO, it is changed to DONE.
+When it starts with DONE, the DONE is removed.  And when neither TODO nor
+DONE are present, add TODO at the beginning of the heading.
+
+With prefix arg, use completion to determined the new state.  With numeric
+prefix arg, switch to that state."
+  (interactive "P")
+  (save-excursion
+    (org-back-to-heading)
+    (if (looking-at outline-regexp) (goto-char (match-end 0)))
+    (or (looking-at (concat " +" org-todo-regexp " *"))
+        (looking-at " *"))
+    (let* ((this (match-string 1))
+           (completion-ignore-case t)
+           (member (member this org-todo-keywords))
+           (tail (cdr member))
+           (state (cond
+                  ((equal arg '(4))
+                   ;; Read a state with completion
+                   (completing-read "State: " (mapcar (lambda(x) (list x))
+                                                      org-todo-keywords)
+                                    nil t))
+                  (arg
+                   ;; user requests a specific state
+                   (nth (1- (prefix-numeric-value arg))
+                        org-todo-keywords))
+                  ((null member) (car org-todo-keywords))
+                  ((null tail) nil) ;; -> first entry
+                  ((eq org-todo-interpretation 'sequence)
+                   (car tail))
+                  ((memq org-todo-interpretation '(type priority))
+                   (if (eq this-command last-command)
+                       (car tail)
+                     (if (> (length tail) 0) org-done-string nil)))
+                  (t nil)))
+           (next (if state (concat " " state " ") " ")))
+      (replace-match next t t)
+      (run-hooks 'org-after-todo-state-change-hook)))
+  ;; Fixup cursor location if close to the keyword
+  (if (and (outline-on-heading-p)
+           (not (bolp))
+           (save-excursion (goto-char (point-at-bol))
+                           (looking-at org-todo-line-regexp))
+           (< (point) (+ 2 (or (match-end 2) (match-end 1)))))
+      (progn
+        (goto-char (or (match-end 2) (match-end 1)))
+        (just-one-space))))
+
+(defun org-show-todo-tree (arg)
+  "Make a compact tree which shows all headlines marked with TODO.
+The tree will show the lines where the regexp matches, and all higher
+headlines above the match."
+  (interactive "P")
+  (let ((case-fold-search nil)
+        (kwd-re (if arg org-todo-regexp org-not-done-regexp)))
+    (message "%d TODO entries found"
+             (org-occur (concat "^" outline-regexp " +" kwd-re )))))
+
+(defun org-deadline ()
+  "Insert the DEADLINE: string to make a deadline.
+A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down]
+to modify it to the correct date."
+  (interactive)
+  (insert
+   org-deadline-string " "
+   (format-time-string (car org-time-stamp-formats)
+                       (org-read-date nil 'to-time)))
+  (message (substitute-command-keys
+            "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date.")))
+
+(defun org-schedule ()
+  "Insert the SCHEDULED: string to schedule a TODO item.
+A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down]
+to modify it to the correct date."
+  (interactive)
+  (insert
+   org-scheduled-string " "
+   (format-time-string (car org-time-stamp-formats)
+                       (org-read-date nil 'to-time)))
+  (message (substitute-command-keys
+            "Use \\[org-timestamp-up-day] and \\[org-timestamp-down-day] to change the date.")))
+
+
+(defun org-occur (regexp &optional callback)
+  "Make a compact tree which shows all matches of REGEXP.
+The tree will show the lines where the regexp matches, and all higher
+headlines above the match.  It will also show the heading after the match,
+to make sure editing the matching entry is easy.
+if CALLBACK is non-nil, it is a function which is called to confirm
+that the match should indeed be shown."
+  (interactive "sRegexp: ")
+  (setq regexp (org-check-occur-regexp regexp))
+  (let ((cnt 0))
+    (save-excursion
+      (goto-char (point-min))
+      (hide-sublevels 1)
+      (while (re-search-forward regexp nil t)
+        (when (or (not callback)
+                  (funcall callback))
+          (setq cnt (1+ cnt))
+          (org-show-hierarchy-above))))
+    (if (interactive-p)
+        (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)
+         (org-flag-heading nil)))  ; show the next heading
+  (save-excursion                  ; show all higher headings
+    (while (condition-case nil
+               (progn (org-up-heading-all 1) t)
+             (error nil))
+      (org-flag-heading nil))))
+
+;;; Priorities
+
+(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z]\\)\\] ?\\)"
+  "Regular expression matching the priority indicator.")
+
+(defun org-priority-up ()
+  "Increase the priority of the current item."
+  (interactive)
+  (org-priority 'up))
+
+(defun org-priority-down ()
+  "Decrease the priority of the current item."
+  (interactive)
+  (org-priority 'down))
+
+(defun org-priority (&optional action)
+  "Change the priority of an item by ARG.
+ACTION can be set, up, or down."
+  (interactive)
+  (setq action (or action 'set))
+  (let (current new news have remove)
+    (save-excursion
+      (org-back-to-heading)
+      (if (looking-at org-priority-regexp)
+          (setq current (string-to-char (match-string 2))
+                have t)
+        (setq current org-default-priority))
+      (cond
+       ((eq action 'set)
+        (message (format "Priority A-%c, SPC to remove: " org-lowest-priority))
+        (setq new (read-char-exclusive))
+        (if (equal new ?\ ) (setq remove t)))
+       ((eq action 'up)
+        (setq new (1- current)))
+       ((eq action 'down)
+        (setq new (1+ current)))
+       (t (error "Illegal ection")))
+      (setq new (min (max ?A (upcase new)) org-lowest-priority))
+      (setq news (format "%c" new))
+      (if have
+          (if remove
+              (replace-match "" t t nil 1)
+            (replace-match news t t nil 2))
+        (looking-at org-todo-line-regexp)
+        (if (match-end 2)
+            (progn
+              (goto-char (match-end 2))
+              (insert " [#" news "]"))
+          (goto-char (match-beginning 3))
+          (insert "[#" news "] "))))
+    (if remove
+        (message "Priority removed")
+      (message "Priority of current item set to %s" news))))
+
+
+(defun org-get-priority (s)
+  "Find priority cookie and return priority."
+  (save-match-data
+    (if (not (string-match org-priority-regexp s))
+        (* 1000 (- org-lowest-priority org-default-priority))
+      (* 1000 (- org-lowest-priority 
+                 (string-to-char (match-string 2 s)))))))
+      
+;;; Timestamps
+
+(defvar org-last-changed-timestamp nil)
+
+(defun org-time-stamp (arg)
+  "Prompt for a date/time and insert a time stamp.
+If the user specifies a time like HH:MM, or if this command is called
+with a prefix argument, the time stamp will contain date and time.
+Otherwise, only the date will be included.  All parts of a date not
+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."
+  (interactive "P")
+  (let ((fmt (if arg (cdr org-time-stamp-formats)
+               (car org-time-stamp-formats)))
+        (org-time-was-given nil)
+        time)
+    (cond
+     ((and (org-at-timestamp-p)
+           (eq last-command 'org-time-stamp)
+           (eq this-command 'org-time-stamp))
+      (insert "--")
+      (setq time (let ((this-command this-command))
+                  (org-read-date arg 'totime)))
+      (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
+      (insert (format-time-string fmt time)))
+     ((org-at-timestamp-p)
+      (setq time (let ((this-command this-command))
+                   (org-read-date arg 'totime)))
+      (and (org-at-timestamp-p) (replace-match
+                                 (setq org-last-changed-timestamp 
+                                       (format-time-string fmt time))
+                                 t t))
+      (message "Timestamp updated"))
+     (t
+      (setq time (let ((this-command this-command))
+                  (org-read-date arg 'totime)))
+      (if org-time-was-given (setq fmt (cdr org-time-stamp-formats)))
+      (insert (format-time-string fmt time))))))
+
+;;; FIXME: Make the function take "Fri" as "next friday"
+(defun org-read-date (&optional with-time to-time)
+  "Read a date and make things smooth for the user.
+The prompt will suggest to enter an ISO date, but you can also enter anything
+which will at least partially be understood by `parse-time-string'.
+Unrecognized parts of the date will default to the current day, month ,year,
+hour and minute.  For example,
+  3-2-5         --> 2003-02-05
+  feb 15        --> currentyear-02-15
+  sep 12 9      --> 2009-09-12
+  12:45         --> today 12:45
+  22 sept 0:34  --> currentyear-09-22 0:34
+  12            --> currentyear-currentmonth-12
+  etc.
+The function understands only English month and weekday abbreviations,
+but this can be configured with the variables `parse-time-months' and
+`parse-time-weekdays'.
+
+While prompting, a calendar is popped up - you can also select the
+date with the mouse (button 1).  The calendar shows a period of three
+month. To scroll it to other months, use the keys `>' and `<'.  
+If you don't like the calendar, turn it off with 
+       \(setq org-popup-calendar-for-date-prompt nil).
+
+With optional argument TO-TIME, the date will immediately be converted
+to an internal time.
+With an optional argument WITH-TIME, the prompt will suggest to also
+insert a time.  Note that when WITH-TIME is not set, you can still
+enter a time, and this function will inform the calling routine about
+this change.  The calling routine may then choose to change the format
+used to insert the time stamp into the buffer to include the time."
+  (let* ((default-time
+           ;; Default time is either today, or, when entering a range,
+           ;; the range start.
+           (if (save-excursion
+                 (re-search-backward 
+                  (concat org-ts-regexp "--\\=")
+                  (- (point) 20) t))
+               (apply
+                'encode-time
+                (mapcar (lambda(x) (or x 0))  ;; FIXME: Problem with timezone?
+                        (parse-time-string (match-string 1))))
+             (current-time)))
+         (timestr (format-time-string
+                   (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time))
+         (prompt (format "YYYY-MM-DD [%s]: " timestr))
+         ans ans1 ans2
+         second minute hour day month year tl)
+
+    (if org-popup-calendar-for-date-prompt
+        ;; Also show a calendar for date selection
+        ;; Copied (with modifications) from planner.el by John Wiegley
+        (save-excursion
+          (save-window-excursion
+            (calendar)
+            (calendar-forward-day (- (time-to-days default-time)
+                                     (calendar-absolute-from-gregorian
+                                      (calendar-current-date))))
+            (let* ((old-map (current-local-map))
+                   (map (copy-keymap calendar-mode-map))
+                   (minibuffer-local-map (copy-keymap minibuffer-local-map)))
+              (define-key map (kbd "RET") 'org-calendar-select)
+              (define-key map (if org-xemacs-p [button1] [mouse-1])
+                'org-calendar-select)
+              (define-key minibuffer-local-map [(meta shift left)]
+                (lambda () (interactive)
+                  (org-eval-in-calendar '(calendar-backward-month 1))))
+              (define-key minibuffer-local-map [(meta shift right)]
+                (lambda () (interactive)
+                  (org-eval-in-calendar '(calendar-forward-month 1))))
+              (define-key minibuffer-local-map [(shift up)]
+                (lambda () (interactive)
+                  (org-eval-in-calendar '(calendar-backward-week 1))))
+              (define-key minibuffer-local-map [(shift down)]
+                (lambda () (interactive)
+                  (org-eval-in-calendar '(calendar-forward-week 1))))
+              (define-key minibuffer-local-map [(shift left)]
+                (lambda () (interactive)
+                  (org-eval-in-calendar '(calendar-backward-day 1))))
+              (define-key minibuffer-local-map [(shift right)]
+                (lambda () (interactive)
+                  (org-eval-in-calendar '(calendar-forward-day 1))))
+              (define-key minibuffer-local-map ">"
+                (lambda () (interactive)
+                  (org-eval-in-calendar '(scroll-calendar-left 1))))
+              (define-key minibuffer-local-map "<"
+                (lambda () (interactive)
+                  (org-eval-in-calendar '(scroll-calendar-right 1))))
+              (unwind-protect
+                  (progn
+                    (use-local-map map)
+                    (setq ans (read-string prompt "" nil nil))
+                    (setq ans (or ans1 ans2 ans)))
+                (use-local-map old-map)))))
+      ;; Naked prompt only
+      (setq ans (read-string prompt "" nil timestr)))
+
+    (if (string-match
+         "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans)
+        (progn
+          (setq year (if (match-end 2)
+                         (string-to-number (match-string 2 ans))
+                       (string-to-number (format-time-string "%Y")))
+                month (string-to-number (match-string 3 ans))
+                day (string-to-number (match-string 4 ans)))
+          (if (< year 100) (setq year (+ 2000 year)))
+          (setq ans (replace-match (format "%04d-%02d-%02d" year month day)
+                                   t t ans))))
+    (setq tl (parse-time-string ans)
+          year (or (nth 5 tl) (string-to-number (format-time-string "%Y")))
+          month (or (nth 4 tl) (string-to-number (format-time-string "%m")))
+          day (or (nth 3 tl) (string-to-number (format-time-string "%d")))
+          hour (or (nth 2 tl) (string-to-number (format-time-string "%H")))
+          minute (or (nth 1 tl) (string-to-number (format-time-string "%M")))
+          second (or (nth 0 tl) 0))
+    (if (and (boundp 'org-time-was-given)
+             (nth 2 tl))
+        (setq org-time-was-given t))
+    (if (< year 100) (setq year (+ 2000 year)))
+    (if to-time
+        (encode-time second minute hour day month year)
+      (if (or (nth 1 tl) (nth 2 tl))
+          (format "%04d-%02d-%02d %02d:%02d" year month day hour minute)
+        (format "%04d-%02d-%02d" year month day)))))
+
+(defun org-eval-in-calendar (form)
+  "Eval FORM in the calendar window and return to current window.
+Also, store the cursor date in variable ans2."
+  (let ((sw (selected-window)))
+    (select-window (get-buffer-window "*Calendar*"))
+    (eval form)
+    (when (calendar-cursor-to-date)
+      (let* ((date (calendar-cursor-to-date))
+             (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
+        (setq ans2 (format-time-string "%Y-%m-%d" time))))
+    (select-window sw)))
+
+(defun org-calendar-select ()
+  "Return to `org-read-date' with the date currently selected.
+This is used by `org-read-date' in a temporary keymap for the calendar buffer."
+  (interactive)
+  (when (calendar-cursor-to-date)
+    (let* ((date (calendar-cursor-to-date))
+           (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
+      (setq ans1 (format-time-string "%Y-%m-%d" time)))
+    (if (active-minibuffer-window) (exit-minibuffer))))
+          
+(defun org-check-deadlines (ndays)
+  "Check if there are any deadlines due or past due.
+A deadline is considered due if it happens within `org-deadline-warning-days'
+days from todays date.  If the deadline appears in an entry marked DONE,
+it is not shown.  The prefix arg NDAYS can be used to test that many
+days.  If the prefix are is a raw C-u prefix, all deadlines are shown."
+  (interactive "P")
+  (let* ((org-warn-days
+          (cond
+           ((equal ndays '(4)) 100000)
+           (ndays (prefix-numeric-value ndays))
+           (t org-deadline-warning-days)))
+         (case-fold-search nil)
+         (regexp (concat "\\<" org-deadline-string " *<\\([^>]+\\)>"))
+         (callback
+          (lambda ()
+            (and (let ((d1 (time-to-days (current-time)))
+                       (d2 (time-to-days
+                            (org-time-string-to-time (match-string 1)))))
+                   (< (- d2 d1) org-warn-days))
+                 (not (org-entry-is-done-p))))))
+    (message "%d deadlines past-due or due within %d days"
+             (org-occur regexp callback)
+             org-warn-days)))
+
+(defun org-evaluate-time-range (&optional to-buffer)
+  "Evaluate a time range by computing the difference between start and end.
+Normally the result is just printed in the echo area, but with prefix arg
+TO-BUFFER, the result is inserted just after the date stamp into the buffer.
+If the time range is actually in a table, the result is inserted into the
+next column.
+For time difference computation, a year is assumed to be exactly 365
+days in order to avoid rounding problems."
+  (interactive "P")
+  (save-excursion
+    (unless (org-at-date-range-p)
+      (goto-char (point-at-bol))
+      (re-search-forward org-tr-regexp (point-at-eol) t))
+    (if (not (org-at-date-range-p))
+        (error "Not at a time-stamp range, and none found in current line.")))
+  (let* ((ts1 (match-string 1))
+         (ts2 (match-string 2))
+         (match-end (match-end 0))
+         (time1 (org-time-string-to-time ts1))
+         (time2 (org-time-string-to-time ts2))
+         (t1 (time-to-seconds time1))
+         (t2 (time-to-seconds time2))
+         (diff (abs (- t2 t1)))
+         (negative (< (- t2 t1) 0))
+         (ys (floor (* 365 24 60 60)))
+         (ds (* 24 60 60))
+         (hs (* 60 60))
+         (fy "%dy %dd %02d:%02d")
+         (fd "%dd %02d:%02d")
+         (fh "%02d:%02d")
+         y d h m align)
+    (setq y (floor (/ diff ys))  diff (mod diff ys)
+          d (floor (/ diff ds))  diff (mod diff ds)
+          h (floor (/ diff hs))  diff (mod diff hs)
+          m (floor (/ diff 60)))
+    (if to-buffer
+        (progn
+          (goto-char match-end)
+          (when (and (org-at-table-p) (looking-at " *|"))
+            (setq align t)
+            (goto-char (match-end 0)))
+          (if (looking-at
+               "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]")
+              (replace-match ""))
+          (if negative (insert " -"))
+          (if (> y 0) (insert " " (format fy y d h m))
+            (if (> d 0) (insert " " (format fd d h m))
+              (insert " " (format fh h m))))
+          (if align (org-table-align))
+          (message "Time difference inserted"))
+      (message (org-make-tdiff-string y d h m)))))
+
+(defun org-make-tdiff-string (y d h m)
+  (let ((fmt "")
+        (l nil))
+    (if (> y 0) (setq fmt (concat fmt "%d year" (if (> y 1) "s" "") " ")
+                      l (push y l)))
+    (if (> d 0) (setq fmt (concat fmt "%d day"  (if (> d 1) "s" "") " ")
+                      l (push d l)))
+    (if (> h 0) (setq fmt (concat fmt "%d hour" (if (> h 1) "s" "") " ")
+                      l (push h l)))
+    (if (> m 0) (setq fmt (concat fmt "%d minute" (if (> m 1) "s" "") " ")
+                      l (push m l)))
+    (apply 'format fmt (nreverse l))))
+
+(defun org-time-string-to-time (s)
+  (apply 'encode-time (org-parse-time-string s)))
+
+(defun org-parse-time-string (s)
+  "Parse the standard Org-mode time string.
+This should be a lot faster than the normal parse-time-string."
+  (if (string-match org-ts-regexp1 s)
+      (list 0
+            (string-to-number (or (match-string 8 s) "0"))
+            (string-to-number (or (match-string 7 s) "0"))
+            (string-to-number (match-string 4 s))
+            (string-to-number (match-string 3 s))
+            (string-to-number (match-string 2 s))
+            nil nil nil)
+    (make-list 9 0)))
+
+(defun org-timestamp-up (&optional arg)
+  "Increase the date item at the cursor by one.
+If the cursor is on the year, change the year.  If it is on the month or
+the day, change that.
+With prefix ARG, change by that many units."
+  (interactive "p")
+  (org-timestamp-change (prefix-numeric-value arg)))
+
+(defun org-timestamp-down (&optional arg)
+  "Decrease the date item at the cursor by one.
+If the cursor is on the year, change the year.  If it is on the month or
+the day, change that.
+With prefix ARG, change by that many units."
+  (interactive "p")
+  (org-timestamp-change (- (prefix-numeric-value arg))))
+
+(defun org-timestamp-up-day (&optional arg)
+  "Increase the date in the time stamp by one day.
+With prefix ARG, change that many days."
+  (interactive "p")
+  (org-timestamp-change (prefix-numeric-value arg) 'day))
+
+(defun org-timestamp-down-day (&optional arg)
+  "Increase the date in the time stamp by one day.
+With prefix ARG, change that many days."
+  (interactive "p")
+  (org-timestamp-change (- (prefix-numeric-value arg)) 'day))
+
+(defsubst org-pos-in-match-range (pos n)
+  (and (match-beginning n)
+       (<= (match-beginning n) pos)
+       (>= (match-end n) pos)))
+
+(defun org-at-timestamp-p ()
+  "Determine if the the cursor is in or at a timestamp."
+  (interactive)
+  (let* ((tsr org-ts-regexp2)
+         (pos (point))
+         (ans (or (looking-at tsr)
+                  (save-excursion
+                    (skip-chars-backward "^<\n\r\t")
+                    (if (> (point) 1) (backward-char 1))
+                    (and (looking-at tsr)
+                         (> (- (match-end 0) pos) -1))))))
+    (and (boundp 'org-ts-what)
+         (setq org-ts-what
+              (cond
+               ((org-pos-in-match-range pos 2)      'year)
+               ((org-pos-in-match-range pos 3)      'month)
+               ((org-pos-in-match-range pos 7)      'hour)
+               ((org-pos-in-match-range pos 8)      'minute)
+               ((or (org-pos-in-match-range pos 4)
+                    (org-pos-in-match-range pos 5)) 'day)
+               (t 'day))))
+    ans))
+
+(defun org-timestamp-change (n &optional what)
+  "Change the date in the time stamp at point.
+The date will be changed by N times WHAT.  WHAT can be `day', `month',
+`year', `minute', `second'.  If WHAT is not given, the cursor position
+in the timestamp determines what will be changed."
+  (let ((fmt (car org-time-stamp-formats))
+        org-ts-what
+        (pos (point))
+        ts time time0)
+    (if (not (org-at-timestamp-p))
+        (error "Not at a timestamp"))
+    (setq org-ts-what (or what org-ts-what))
+    (setq fmt (if (<= (abs (- (cdr org-ts-lengths)
+                              (- (match-end 0) (match-beginning 0))))
+                      1)
+                  (cdr org-time-stamp-formats)
+                (car org-time-stamp-formats)))
+    (setq ts (match-string 0))
+    (replace-match "")
+    (setq time0 (org-parse-time-string ts))
+    (setq time
+          (apply 'encode-time
+                 (append
+                  (list (or (car time0) 0))
+                  (list (+ (if (eq org-ts-what 'minute) n 0) (nth 1 time0)))
+                  (list (+ (if (eq org-ts-what 'hour) n 0)   (nth 2 time0)))
+                  (list (+ (if (eq org-ts-what 'day) n 0)    (nth 3 time0)))
+                  (list (+ (if (eq org-ts-what 'month) n 0)  (nth 4 time0)))
+                  (list (+ (if (eq org-ts-what 'year) n 0)   (nth 5 time0)))
+                  (nthcdr 6 time0))))
+    (if (eq what 'calendar)
+        (let ((cal-date
+               (save-excursion
+                 (save-match-data
+                   (set-buffer "*Calendar*")
+                   (calendar-cursor-to-date)))))
+          (setcar (nthcdr 4 time0) (nth 0 cal-date)) ; month
+          (setcar (nthcdr 3 time0) (nth 1 cal-date)) ; day
+          (setcar (nthcdr 5 time0) (nth 2 cal-date)) ; year
+          (setcar time0 (or (car time0) 0))
+          (setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
+          (setcar (nthcdr 2 time0) (or (nth 1 time0) 0))
+          (setq time (apply 'encode-time time0))))
+    (insert (setq org-last-changed-timestamp (format-time-string fmt time)))
+    (goto-char pos)
+    ;; Try to recenter the calendar window, if any
+    (if (and org-calendar-follow-timestamp-change
+             (get-buffer-window "*Calendar*" t)
+             (memq org-ts-what '(day month year)))
+        (org-recenter-calendar (time-to-days time)))))
+
+(defun org-recenter-calendar (date)
+  "If the calendar is visible, recenter it to DATE."
+  (let* ((win (selected-window))
+         (cwin (get-buffer-window "*Calendar*" t)))
+    (when cwin
+      (select-window cwin)
+      (calendar-goto-date (if (listp date) date
+                            (calendar-gregorian-from-absolute date)))
+      (select-window win))))
+
+(defun org-goto-calendar (&optional arg)
+  "Go to the Emacs calendar at the current date.
+If there is a time stamp in the current line, go to that date.
+A prefix ARG can be used force the current date."
+  (interactive "P")
+  (let ((tsr org-ts-regexp) diff)
+    (if (or (org-at-timestamp-p)
+            (save-excursion
+              (beginning-of-line 1)
+              (looking-at (concat ".*" tsr))))
+        (let ((d1 (time-to-days (current-time)))
+              (d2 (time-to-days
+                   (org-time-string-to-time (match-string 1)))))
+          (setq diff (- d2 d1))))
+    (calendar)
+    (calendar-goto-today)
+    (if (and diff (not arg)) (calendar-forward-day diff))))
+
+(defun org-date-from-calendar ()
+  "Insert time stamp corresponding to cursor date in *Calendar* buffer.
+If there is already a time stamp at the cursor position, update it."
+  (interactive)
+  (org-timestamp-change 0 'calendar))
+
+;;; Agenda, and Diary Integration
+
+;;; Define the mode
+
+(defvar org-agenda-mode-map (make-sparse-keymap)
+  "Keymap for org-agenda-mode.")
+
+(defvar org-agenda-menu)
+(defvar org-agenda-follow-mode nil)
+(defvar org-agenda-buffer-name "*Org Agenda*")
+(defvar org-agenda-redo-command nil)
+
+;;;###autoload
+(defun org-agenda-mode ()
+  "Mode for time-sorted view on action items in Org-mode files."
+  (interactive)
+  (kill-all-local-variables)
+  (setq major-mode 'org-agenda-mode)
+  (setq mode-name "Org-Agenda")
+  (use-local-map org-agenda-mode-map)
+  (easy-menu-add org-agenda-menu)
+  (if org-startup-truncated (setq truncate-lines t))
+  (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
+  (setq org-agenda-follow-mode nil)
+  (easy-menu-change 
+   '("Agenda") "Agenda Files"
+   (append
+    (list 
+     ["Edit file list" (customize-variable 'org-agenda-files) t]
+     "--")
+   (mapcar 'org-file-menu-entry org-agenda-files)))
+  (org-agenda-set-mode-name)
+  (run-hooks 'org-agenda-mode-hook))
+
+(define-key org-agenda-mode-map [(tab)] 'org-agenda-goto)
+(define-key org-agenda-mode-map [(return)] 'org-agenda-switch-to)
+(define-key org-agenda-mode-map " " 'org-agenda-show)
+(define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
+(define-key org-agenda-mode-map "o" 'delete-other-windows)
+(define-key org-agenda-mode-map "l" 'org-agenda-recenter)
+(define-key org-agenda-mode-map "t" 'org-agenda-todo)
+(define-key org-agenda-mode-map "." 'org-agenda-goto-today)
+(define-key org-agenda-mode-map "w" 'org-agenda-week-view)
+(define-key org-agenda-mode-map [(shift right)] 'org-agenda-date-later)
+(define-key org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier)
+
+(define-key org-agenda-mode-map ">" 'org-agenda-date-today)
+(let ((l '(1 2 3 4 5 6 7 8 9 0)))
+  (while l (define-key org-agenda-mode-map
+             (int-to-string (pop l)) 'digit-argument)))
+
+(define-key org-agenda-mode-map "f" 'org-agenda-follow-mode)
+(define-key org-agenda-mode-map "d" 'org-agenda-toggle-diary)
+(define-key org-agenda-mode-map "r" 'org-agenda-redo)
+(define-key org-agenda-mode-map "q" 'org-agenda-quit)
+(define-key org-agenda-mode-map "x" 'org-agenda-exit)
+(define-key org-agenda-mode-map "P" 'org-agenda-show-priority)
+(define-key org-agenda-mode-map "p" 'org-agenda-priority)
+(define-key org-agenda-mode-map "," 'org-agenda-priority)
+(define-key org-agenda-mode-map "i" 'org-agenda-diary-entry)
+(define-key org-agenda-mode-map "+" 'org-agenda-priority-up)
+(define-key org-agenda-mode-map "-" 'org-agenda-priority-down)
+(define-key org-agenda-mode-map [(right)] 'org-agenda-later)
+(define-key org-agenda-mode-map [(left)] 'org-agenda-earlier)
+
+(defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
+  "Local keymap for agenda entries from Org-mode.")
+
+(define-key org-agenda-keymap 
+  (if org-xemacs-p [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
+(define-key org-agenda-keymap
+  (if org-xemacs-p [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
+
+(easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
+  '("Agenda"
+    ("Agenda Files")
+    "--"
+    ["Show" org-agenda-show t]
+    ["Go To (other window)" org-agenda-goto t]
+    ["Go To (one window)" org-agenda-switch-to t]
+    ["Follow Mode" org-agenda-follow-mode 
+     :style toggle :selected org-agenda-follow-mode :active t]
+    "--"
+    ["Cycle TODO" org-agenda-todo t]
+    ("Reschedule"
+     ["Reschedule +1 day" org-agenda-date-later t]
+     ["Reschedule -1 day" org-agenda-date-earlier t]
+     "--"
+     ["Reschedule to today" org-agenda-date-today t])
+    ("Priority"
+     ["Set Priority" org-agenda-priority t]
+     ["Increase Priority" org-agenda-priority-up t]
+     ["Decrease Priority" org-agenda-priority-down t]
+     ["Show Priority" org-agenda-show-priority t])
+    "--"
+    ["Rebuild" org-agenda-redo t]
+    ["Goto Today" org-agenda-goto-today t]
+    ["Next Dates" org-agenda-later (local-variable-p 'starting-day)]
+    ["Previous Dates" org-agenda-earlier (local-variable-p 'starting-day)]
+    "--"
+    ["Week/Day View" org-agenda-week-view (local-variable-p 'starting-day)]
+    ["Include Diary" org-agenda-toggle-diary
+     :style toggle :selected org-agenda-include-diary :active t]
+    "--"
+    ["New Diary Entry" org-agenda-diary-entry t]
+    "--"
+    ["Quit" org-agenda-quit t]
+    ["Exit and Release Buffers" org-agenda-exit t]
+    ))
+
+(defvar org-agenda-markers nil
+  "List of all currently active markers created by org-agenda")
+(defvar org-agenda-last-marker-time (time-to-seconds (current-time))
+  "Creation time of the last agenda marker.")
+
+(defun org-agenda-new-marker (pos)
+  "Return a new agenda marker.
+Org-mode keeps a list of these markers and resets them when they are
+no longer in use."
+  (let ((m (copy-marker pos)))
+    (setq org-agenda-last-marker-time (time-to-seconds (current-time)))
+    (push m org-agenda-markers)
+    m))
+
+(defun org-agenda-maybe-reset-markers (&optional force)
+  "Reset markers created by org-agenda.  But only if they are old enough."
+  (if (or force
+          (> (- (time-to-seconds (current-time))
+                org-agenda-last-marker-time)
+             5))
+      (while org-agenda-markers
+        (move-marker (pop org-agenda-markers) nil))))
+
+(defvar org-agenda-new-buffers nil
+  "Buffers created to visit agenda files.")
+
+(defun org-get-agenda-file-buffer (file)
+  "Get a buffer visiting FILE.  If the buffer needs to be created, add
+it to the list of buffers which might be released later."
+  (let ((buf (find-buffer-visiting file)))
+    (if buf
+        buf  ; just return it
+      ;; Make a new buffer and remember it
+      (setq buf (find-file-noselect file))
+      (if buf (push buf org-agenda-new-buffers))
+      buf)))
+
+(defun org-release-buffers (blist)
+  "Release all buffers in list, asking the user for confirmation when needed.
+When a buffer is unmodified, it is just killed.  When modified, it is saved
+\(if the user agrees) and then killed."
+  (let (buf file)
+    (while (setq buf (pop blist))
+      (setq file (buffer-file-name buf))
+      (when (and (buffer-modified-p buf)
+                 file
+                 (y-or-n-p (format "Save file %s? " file)))
+        (save-excursion
+          (set-buffer buf) (save-buffer)))
+      (kill-buffer buf))))
+
+(defun org-timeline (&optional include-all)
+  "Show a time-sorted view of the entries in the current org file.
+Only entries with a time stamp of today or later will be listed.  With
+one C-u prefix argument, also past entries will be listed.
+With two C-u prefixes, all unfinished TODO items will also be shown,
+under the current date.
+If the buffer contains an active region, only check the region for
+dates."
+  (interactive "P")
+  (require 'calendar)
+  (org-agenda-maybe-reset-markers 'force)
+  (let* ((dopast include-all)
+         (dotodo (equal include-all '(16)))
+         (entry (buffer-file-name))
+         (org-agenda-files (list (buffer-file-name)))
+         (date (calendar-current-date))
+         (win (selected-window))
+         (pos1 (point))
+         (beg (if (org-region-active-p) (region-beginning) (point-min)))
+         (end (if (org-region-active-p) (region-end) (point-max)))
+         (day-numbers (org-get-all-dates beg end 'no-ranges
+                                         t)) ; always include today
+         (today (time-to-days (current-time)))
+         (org-respect-restriction t)
+         (past t)
+         s e rtn d pos)
+    (setq org-agenda-redo-command 
+          (list 'progn
+                (list 'switch-to-buffer-other-window (current-buffer))
+                (list 'org-timeline include-all)))
+    (if (not dopast)
+        ;; Remove past dates from the list of dates.
+        (setq day-numbers (delq nil (mapcar (lambda(x)
+                                              (if (>= x today) x nil))
+                                            day-numbers))))
+    (switch-to-buffer-other-window 
+     (get-buffer-create org-agenda-buffer-name))
+    (setq buffer-read-only nil)
+    (erase-buffer)
+    (org-agenda-mode) (setq buffer-read-only nil)
+    (while (setq d (pop day-numbers))
+      (if (and (>= d today)
+               dopast
+               past)
+          (progn
+            (setq past nil)
+            (insert (make-string 79 ?-) "\n")))
+      (setq date (calendar-gregorian-from-absolute d))
+      (setq s (point))
+      (if dotodo
+          (setq rtn (org-agenda-get-day-entries 
+                     entry date :todo :timestamp))
+        (setq rtn (org-agenda-get-day-entries entry date :timestamp)))
+      (if (or rtn (equal d today))
+          (progn
+            (insert (calendar-day-name date) " "
+                    (number-to-string (extract-calendar-day date)) " "
+                    (calendar-month-name (extract-calendar-month date)) " "
+                    (number-to-string (extract-calendar-year date)) "\n")
+            (put-text-property s (1- (point)) 'face
+                               'org-link-face)
+            (if (equal d today)
+                (put-text-property s (1- (point)) 'org-today t))
+            (insert (org-finalize-agenda-entries rtn) "\n")
+            (put-text-property s (1- (point)) 'day d))))
+    (goto-char (point-min))
+    (setq buffer-read-only t)
+    (goto-char (or (text-property-any (point-min) (point-max) 'org-today t)
+                   (point-min)))
+    (when (not org-select-timeline-window)
+      (select-window win)
+      (goto-char pos1))))
+
+;;;###autoload
+(defun org-agenda (&optional include-all start-day ndays)
+  "Produce a weekly view from all files in variable `org-agenda-files'.
+The view will be for the current week, but from the overview buffer you
+will be able to go to other weeks.
+With one C-u prefix argument INCLUDE-ALL, all unfinished TODO items will
+also be shown, under the current date.
+START-DAY defaults to TODAY, or to the most recent match for the weekday
+given in `org-agenda-start-on-weekday'.
+NDAYS defaults to `org-agenda-ndays'."
+  (interactive "P")
+  (org-agenda-maybe-reset-markers 'force)
+  (require 'calendar)
+  (let* ((org-agenda-start-on-weekday
+          (if (or (equal ndays 1)
+                  (and (null ndays) (equal 1 org-agenda-ndays)))
+              nil org-agenda-start-on-weekday))
+         (files (copy-sequence org-agenda-files))
+         (win (selected-window))
+         (today (time-to-days (current-time)))
+         (sd (or start-day today))
+         (start (if (or (null org-agenda-start-on-weekday)
+                        (< org-agenda-ndays 7))
+                    sd
+                  (let* ((nt (calendar-day-of-week
+                              (calendar-gregorian-from-absolute sd)))
+                         (n1 org-agenda-start-on-weekday)
+                         (d (- nt n1)))
+                    (- sd (+ (if (< d 0) 7 0) d)))))
+         (day-numbers (list start))
+         s e rtn rtnall file date d start-pos)
+    (setq org-agenda-redo-command 
+          (list 'org-agenda include-all start-day ndays))
+    ;; Make the list of days
+    (setq ndays (or ndays org-agenda-ndays))
+    (while (> ndays 1)
+      (push (1+ (car day-numbers)) day-numbers)
+      (setq ndays (1- ndays)))
+    (setq day-numbers (nreverse day-numbers))
+    (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))
+        (progn
+          (delete-other-windows)
+          (switch-to-buffer-other-window 
+           (get-buffer-create org-agenda-buffer-name))))
+    (setq buffer-read-only nil)
+    (erase-buffer)
+    (org-agenda-mode) (setq buffer-read-only nil)
+    (set (make-local-variable 'starting-day) (car day-numbers))
+    (set (make-local-variable 'include-all-loc) include-all)
+    (when (and (or include-all org-agenda-include-all-todo)
+               (member today day-numbers))
+      (setq files org-agenda-files
+            rtnall nil)
+      (while (setq file (pop files))
+        (catch 'nextfile
+          (org-check-agenda-file file)
+          (setq date (calendar-gregorian-from-absolute today)
+                rtn (org-agenda-get-day-entries
+                     file date :todo))
+          (setq rtnall (append rtnall rtn))))
+      (if rtnall (insert (org-finalize-agenda-entries rtnall) "\n")))
+    (while (setq d (pop day-numbers))
+      (setq date (calendar-gregorian-from-absolute d)
+            s (point))
+      (if (or (= d today)
+              (and (not start-pos) (= d sd)))
+          (setq start-pos (point)))
+      (setq files org-agenda-files
+            rtnall nil)
+      (while (setq file (pop files))
+        (catch 'nextfile
+          (org-check-agenda-file file)
+          (setq rtn (org-agenda-get-day-entries file date))
+          (setq rtnall (append rtnall rtn))))
+      (if org-agenda-include-diary
+          (progn
+            (require 'calendar)
+            (require 'diary-lib)
+            (setq rtn (org-get-entries-from-diary date))
+            (setq rtnall (append rtnall rtn))))
+      (if (or rtnall org-agenda-show-all-dates)
+          (progn
+            (insert (format "%-9s %2d %-9s %4d\n"
+                            (calendar-day-name date)
+                            (extract-calendar-day date)
+                            (calendar-month-name (extract-calendar-month date))
+                            (extract-calendar-year date)))
+            (put-text-property s (1- (point)) 'face
+                               'org-link-face)
+            (if rtnall (insert (org-finalize-agenda-entries rtnall) "\n"))
+            (put-text-property s (1- (point)) 'day d))))            
+    (goto-char (point-min))
+    (setq buffer-read-only t)
+    (goto-char (or start-pos 1))
+    (if (not org-select-agenda-window) (select-window win))
+    (message "")))
+
+(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.
+  (when (not (file-exists-p file))
+    (message "non-existent file %s.  [R]emove from agenda-files or [A]bort?"
+             file)
+    (let ((r (downcase (read-char-exclusive))))
+      (cond
+       ((equal r ?r)
+        (org-remove-file file)
+        (throw 'nextfile t))
+       (t (error "Abort"))))))
+
+(defun org-agenda-quit (arg)
+  "Exit agenda by removing the window or the buffer."
+  (interactive "P")
+  (let ((buf (current-buffer)))
+    (if (not (one-window-p)) (delete-window))
+    (kill-buffer buf)
+    (org-agenda-maybe-reset-markers 'force)))
+
+(defun org-agenda-exit (arg)
+  "Exit agenda by removing the window or the buffer.
+Also kill all Org-mode buffers which have be loaded by `org-agenda'.
+Org-mode buffers visitied directly by the user will no be touched."
+  (interactive "P")
+  (org-release-buffers org-agenda-new-buffers)
+  (setq org-agenda-new-buffers nil)
+  (org-agenda-quit arg))
+
+(defun org-agenda-redo (&optional arg)
+  "Rebuild Agenda"
+  (interactive "P")
+  (eval org-agenda-redo-command))
+
+(defun org-agenda-goto-today (arg)
+  "Go to today."
+  (interactive "P")
+  (if (boundp 'starting-day)
+      (let ((cmd (car org-agenda-redo-command))
+            (iall (nth 1 org-agenda-redo-command))
+            (nday (nth 3 org-agenda-redo-command)))
+        (eval (list cmd iall nil nday)))
+    (goto-char (or (text-property-any (point-min) (point-max) 'org-today t)
+                   (point-min)))))
+
+(defun org-agenda-later (arg)
+  "Go forward in time by `org-agenda-ndays' days.
+With prefix ARG, go forward that many times `org-agenda-ndays'."
+  (interactive "p")
+  (unless (boundp 'starting-day)
+    (error "Not allowed"))
+  (org-agenda (if (boundp 'include-all-loc) include-all-loc nil)
+              (+ starting-day (* arg org-agenda-ndays))))
+
+(defun org-agenda-earlier (arg)
+  "Go back in time by `org-agenda-ndays' days.
+With prefix ARG, go back that many times `org-agenda-ndays'."
+  (interactive "p")
+  (unless (boundp 'starting-day)
+    (error "Not allowed"))
+  (org-agenda (if (boundp 'include-all-loc) include-all-loc nil)
+              (- starting-day (* arg org-agenda-ndays))))
+
+(defun org-agenda-day-view (arg)
+  "Switch agenda to single day view."
+  (interactive "P")
+  (unless (boundp 'starting-day)
+    (error "Not allowed"))
+  (setq org-agenda-ndays 1)
+  (org-agenda include-all-loc starting-day 1))
+
+(defun org-agenda-week-view (arg)
+  "Switch agenda to week view."
+  (interactive "P")
+  (unless (boundp 'starting-day)
+    (error "Not allowed"))
+  (setq org-agenda-ndays
+        (if (equal org-agenda-ndays 1) 7 1))
+  (org-agenda include-all-loc 
+              (or (get-text-property (point) 'day)
+                  starting-day))
+  (org-agenda-set-mode-name)
+  (message "Switched to %s view"
+           (if (equal org-agenda-ndays 1) "day" "week")))
+
+(defun org-agenda-follow-mode ()
+  "Toggle follow mode in an agenda buffer."
+  (interactive)
+  (setq org-agenda-follow-mode (not org-agenda-follow-mode))
+  (org-agenda-set-mode-name)
+  (message "Follow mode is %s"
+           (if org-agenda-follow-mode "on" "off")))
+
+(defun org-agenda-toggle-diary ()
+  "Toggle follow mode in an agenda buffer."
+  (interactive)
+  (setq org-agenda-include-diary (not org-agenda-include-diary))
+  (org-agenda-redo)
+  (org-agenda-set-mode-name)
+  (message "Diary inclusion turned %s"
+           (if org-agenda-include-diary "on" "off")))
+
+(defun org-agenda-set-mode-name ()
+  "Set the mode name to indicate all the small mode seetings."
+  (setq mode-name
+        (concat "Org-Agenda"
+                (if (equal org-agenda-ndays 1) " Day" "")
+                (if (equal org-agenda-ndays 7) " Week" "")
+                (if org-agenda-follow-mode " Follow" "")
+                (if org-agenda-include-diary " Diary" "")))
+  (force-mode-line-update))
+
+(defun org-agenda-post-command-hook ()
+  (if (and org-agenda-follow-mode
+           (get-text-property (point) 'org-marker))
+      (org-agenda-show)))
+
+(defun org-get-entries-from-diary (date)
+  "Get the (emacs calendar) diary entries for DATE."
+  (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*")
+         (diary-display-hook '(sort-diary-entries fancy-diary-display))
+         entries
+         (disable-org-agenda t))
+    (save-excursion
+      (save-window-excursion
+        (list-diary-entries date 1)))
+    (if (not (get-buffer fancy-diary-buffer))
+        (setq entries nil)
+      (save-excursion
+        (set-buffer fancy-diary-buffer)
+        (setq buffer-read-only nil)
+        (if (= (point-max) 1)
+            ;; No entries
+            (setq entries nil)
+          ;; Omit the date
+          (beginning-of-line 3)
+          (delete-region (point-min) (point))
+          (while (and (re-search-forward "^" nil t) (not (eobp)))
+            (replace-match "  Diary:     "))
+          (setq entries (buffer-substring (point-min) (- (point-max) 1))))
+        (set-buffer-modified-p nil)
+        (kill-buffer fancy-diary-buffer)))
+    (when entries
+      (setq entries (org-split-string entries "\n"))
+      (setq entries 
+            (mapcar 
+             (lambda (x)
+               (if (string-match "\\<\\([012][0-9]\\):\\([0-6][0-9]\\)" x)
+                   (add-text-properties
+                    1 (length x)
+                    (list 'time-of-day
+                          (+ (* 100 (string-to-number
+                                     (match-string 1 x)))
+                             (string-to-number (match-string 2 x))))
+                    x))
+               x)
+             entries)))))
+
+(defun org-add-file (&optional file)
+  "Add current file to the list of files in variable `org-agenda-files'.
+These are the files which are being checked for agenda entries.
+Optional argument FILE means, use this file instead of the current.
+It is possible (but not recommended) to add this function to the
+`org-mode-hook'." 
+  (interactive)
+  (catch 'exit
+    (let* ((file (or file (buffer-file-name)
+                     (if (interactive-p)
+                         (error "Buffer is not visiting a file")
+                       (throw 'exit nil))))
+           (true-file (file-truename file))
+           (afile (abbreviate-file-name file))
+           (present (delq nil (mapcar
+                               (lambda (x)
+                                 (equal true-file (file-truename x)))
+                               org-agenda-files))))
+      (if (not present)
+          (progn
+            (setq org-agenda-files 
+                  (cons afile org-agenda-files))
+            ;; Make sure custom.el does not end up with Org-mode
+            (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
+              (customize-save-variable 'org-agenda-files org-agenda-files))
+            (org-install-agenda-files-menu)
+            (message "Added file: %s" afile))
+        (message "File was already in list: %s" afile)))))
+
+(defun org-remove-file (&optional file)
+  "Remove current file from the list of files in variable `org-agenda-files'.
+These are the files which are being checked for agenda entries.
+Optional argument FILE means, use this file instead of the current."
+  (interactive)
+  (let* ((file (or file (buffer-file-name)))
+         (true-file (file-truename file))
+         (afile (abbreviate-file-name file))
+         (files (delq nil (mapcar 
+                           (lambda (x)
+                             (if (equal true-file
+                                        (file-truename x))
+                                 nil x))
+                           org-agenda-files))))
+    (if (not (= (length files) (length org-agenda-files)))
+        (progn
+          (setq org-agenda-files files)
+          (customize-save-variable 'org-agenda-files org-agenda-files)
+          (org-install-agenda-files-menu)
+          (message "Removed file: %s" afile))
+      (message "File was not in list: %s" afile))))
+
+(defun org-file-menu-entry (file)
+  (vector file (list 'find-file file) t))
+
+(defun org-get-all-dates (beg end &optional no-ranges force-today)
+  "Return a list of all relevant day numbers from BEG to END buffer positions.
+If NO-RANGES is non-nil, include only the start and end dates of a range,
+not every single day in the range.  If FORCE-TODAY is non-nil, make
+sure that TODAY is included in the list."
+  (let (dates date day day1 day2 ts1 ts2)
+    (if force-today
+        (setq dates (list (time-to-days (current-time)))))
+    (save-excursion
+      (goto-char beg)
+      (while (re-search-forward org-ts-regexp end t)
+        (setq day (time-to-days (org-time-string-to-time
+                                 (substring (match-string 1) 0 10))))
+        (or (memq day dates) (push day dates)))
+      (unless no-ranges
+        (goto-char beg)
+        (while (re-search-forward org-tr-regexp end t)
+          (setq ts1 (substring (match-string 1) 0 10)
+                ts2 (substring (match-string 2) 0 10)
+                day1 (time-to-days (org-time-string-to-time ts1))
+                day2 (time-to-days (org-time-string-to-time ts2)))
+          (while (< (setq day1 (1+ day1)) day2)
+            (or (memq day1 dates) (push day1 dates)))))
+      (sort dates '<))))
+
+;;;###autoload
+(defun org-diary (&rest args)
+  "Returns diary information from org-files.
+This function can be used in an \"sexp\" diary entry in the Emacs calendar.
+It accesses org files and extracts information from those files to be
+listed in the diary.  The function accepts arguments specifying what
+items should be listed.  The following arguments are allowed:
+
+   :timestamp    List the headlines of items containing a date stamp or
+                 date range matching the selected date.  Deadlines will
+                 also be listed, on the expiration day.
+
+   :deadline     List any deadlines past due, or due within
+                 `org-deadline-warning-days'.  The listing occurs only
+                 in the diary for *today*, not at any other date.  If
+                 an entry is marked DONE, it is no longer listed.
+
+   :scheduled    List all items which are scheduled for the given date.
+                 The diary for *today* also contains items which were
+                 scheduled earlier and are not yet marked DONE.
+
+   :todo         List all TODO items from the org-file.  This may be a
+                 long list - so this is not turned on by default.
+                 Like deadlines, these entires only show up in the
+                 diary for *today*, not at any other date.
+
+The call in the diary file should look like this:
+
+   &%%(org-diary) ~/path/to/some/orgfile.org
+
+Use a separate line for each org file to check.  Or, if you omit the file name,
+all files listed in `org-agenda-files' will be checked automatically:
+
+   &%%(org-diary)
+
+If you don't give any arguments (as in the example above), the default
+arguments (:deadline :scheduled :timestamp) are used.  So the example above may
+also be written as
+
+   &%%(org-diary :deadline :timestamp :scheduled)
+
+The function expects the lisp variables `entry' and `date' to be provided
+by the caller, because this is how the calendar works.  Don't use this
+function from a program - use `org-agenda-get-day-entries' instead." 
+  (org-agenda-maybe-reset-markers)
+  (setq args (or args '(:deadline :scheduled :timestamp)))
+  (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
+                    (list entry)
+                  org-agenda-files))
+         file rtn results)
+    ;; If this is called during org-agenda, don't return any entries to
+    ;; the calendar.  Org Agenda will list these entries itself.
+    (if (boundp 'disable-org-agenda) (setq files nil))
+    (while (setq file (pop files))
+      (setq rtn (apply 'org-agenda-get-day-entries file date args))
+      (setq results (append results rtn)))
+    (concat (org-finalize-agenda-entries results) "\n")))
+
+(defun org-agenda-get-day-entries (file date &rest args)
+  "Does the work for `org-diary' and `org-agenda'
+FILE is the path to a file to be checked for entries.  DATE is date like
+the one returned by `calendar-current-date'.  ARGS are symbols indicating
+which kind of entries should be extracted.  For details about these, see
+the documentation of `org-diary'."
+  (setq args (or args '(:deadline :scheduled :timestamp)))
+  (let* ((org-startup-with-deadline-check nil)
+         (org-startup-folded nil)
+         (buffer (if (file-exists-p file)
+;                     (find-file-noselect file)
+                     (org-get-agenda-file-buffer file)
+                   (error "No such file %s" file)))
+         (respect-narrow-p (boundp 'org-respect-restriction))
+         arg results rtn)
+    (if (not buffer)
+        ;; If file does not exist, make sure an error message ends up in diary
+        (format "ORG-AGENDA-ERROR: No such org-file %s" file)
+      (save-excursion
+        (set-buffer buffer)
+        (let ((case-fold-search nil))
+          (save-excursion
+            (save-restriction
+              (if respect-narrow-p
+                  (if (org-region-active-p)
+                      ;; Respect a region to restrict search
+                      (narrow-to-region (region-beginning) (region-end)))
+                ;; If we work for the calendar or many files, 
+                ;; get rid of any restriction
+                (widen))
+              (while (setq arg (pop args))
+                (cond
+                 ((and (eq arg :todo)
+                       (equal date (calendar-current-date)))
+                  (setq rtn (org-agenda-get-todos))
+                  (setq results (append results rtn)))
+                 ((eq arg :timestamp)
+                  (setq rtn (org-agenda-get-blocks))
+                  (setq results (append results rtn))
+                  (setq rtn (org-agenda-get-timestamps))
+                  (setq results (append results rtn)))
+                 ((eq arg :scheduled)
+                  (setq rtn (org-agenda-get-scheduled))
+                  (setq results (append results rtn)))
+                 ((and (eq arg :deadline)
+                       (equal date (calendar-current-date)))
+                  (setq rtn (org-agenda-get-deadlines))
+                  (setq results (append results rtn))))))))))
+    results))
+
+(defun org-entry-is-done-p ()
+  "Is the current entry marked DONE?"
+  (save-excursion
+    (and (re-search-backward "[\r\n]\\*" nil t)
+         (looking-at orb-nl-done-regexp))))
+
+(defun org-at-date-range-p ()
+  "It the cursor inside a date range?"
+  (interactive)
+  (save-excursion
+    (catch 'exit
+      (let ((pos (point)))
+        (skip-chars-backward "^<\r\n")
+        (skip-chars-backward "<")
+        (and (looking-at org-tr-regexp)
+             (>= (match-end 0) pos)
+             (throw 'exit t))
+        (skip-chars-backward "^<\r\n")
+        (skip-chars-backward "<")
+        (and (looking-at org-tr-regexp)
+             (>= (match-end 0) pos)
+             (throw 'exit t)))
+      nil)))
+
+(defun org-agenda-get-todos ()
+  "Return the TODO information for agenda display."
+  (let* ((props (list 'face nil
+                      'mouse-face 'highlight
+                      'keymap org-agenda-keymap
+                      'help-echo
+                      (format "mouse-2 or RET jump to org file %s"
+                              (abbreviate-file-name (buffer-file-name)))))
+         (regexp (concat "[\n\r]\\*+ *\\(" org-not-done-regexp
+                         "[^\n\r]*\\)"))
+         marker priority
+         ee txt pl)
+    (goto-char (point-min))
+    (while (re-search-forward regexp nil t)
+      (goto-char (match-beginning 1))
+      (setq marker (org-agenda-new-marker (point))
+            txt (org-format-agenda-item "" (match-string 1))
+            priority 
+            (+ (org-get-priority txt)
+               (if org-todo-kwd-priority-p
+                         (- org-todo-kwd-max-priority -2
+                            (length
+                             (member (match-string 2) org-todo-keywords)))
+                       1)))
+      (add-text-properties
+       0 (length txt) (append (list 'org-marker marker 'priority priority)
+                              props)
+       txt)
+      (push txt ee)
+      (goto-char (match-end 1)))
+    (nreverse ee)))
+
+(defconst org-agenda-no-heading-message
+  "No heading for this item in buffer or region")
+
+(defun org-agenda-get-timestamps ()
+  "Return the date stamp information for agenda display."
+  (let* ((props (list 'face nil
+                      'mouse-face 'highlight
+                      'keymap org-agenda-keymap
+                      'help-echo
+                      (format "mouse-2 or RET jump to org file %s"
+                              (abbreviate-file-name (buffer-file-name)))))
+         (regexp (regexp-quote
+                  (substring
+                   (format-time-string
+                    (car org-time-stamp-formats)
+                    (apply 'encode-time  ; DATE bound by calendar
+                           (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+                   0 11)))
+         marker deadlinep scheduledp tmp priority
+         ee txt)
+    (goto-char (point-min))
+    (while (re-search-forward regexp nil t)
+      (if (not (save-match-data (org-at-date-range-p)))
+          (progn
+            (setq marker (org-agenda-new-marker (point))
+                  tmp (buffer-substring (max (point-min)
+                                             (- (match-beginning 0)
+                                                org-ds-keyword-length))
+                                        (match-beginning 0))
+                  deadlinep (string-match org-deadline-regexp tmp)
+                  scheduledp (string-match org-scheduled-regexp tmp))
+            (save-excursion
+              (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
+                  (progn
+                    (goto-char (match-end 1))
+                    (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
+                    (setq txt (org-format-agenda-item
+                               (format "%s%s"
+                                       (if deadlinep  "Deadline:  " "")
+                                       (if scheduledp "Scheduled: " ""))
+                               (match-string 1))))
+                (setq txt org-agenda-no-heading-message))
+              (setq priority (org-get-priority txt))
+              (add-text-properties
+               0 (length txt) (append (list 'org-marker marker) props)
+               txt)
+              (if deadlinep
+                  (add-text-properties
+                   0 (length txt)
+                   (list 'face 'org-warning-face
+                         'priority (+ 100 priority))
+                   txt)
+                (if scheduledp
+                    (add-text-properties
+                     0 (length txt)
+                     (list 'face 'org-scheduled-today-face
+                           priority (+ 99 priority))
+                     txt)
+                  (add-text-properties
+                   0 (length txt)
+                   (list 'priority priority) txt)))
+              (push txt ee))
+            (outline-next-heading))))
+    (nreverse ee)))
+
+(defun org-agenda-get-deadlines ()
+  "Return the deadline information for agenda display."
+  (let* ((wdays org-deadline-warning-days)
+         (props (list 'face nil
+                      'mouse-face 'highlight
+                      'keymap org-agenda-keymap
+                      'help-echo
+                      (format "mouse-2 or RET jump to org file %s"
+                              (abbreviate-file-name (buffer-file-name)))))
+         (regexp org-deadline-time-regexp)
+         (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
+         (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
+         d2 diff pos
+         ee txt head)
+    (goto-char (point-min))
+    (while (re-search-forward regexp nil t)
+      (setq d2 (time-to-days
+                (org-time-string-to-time (match-string 1)))
+            pos (point)
+            diff (- d2 d1))
+      ;; When to show a deadline in the calendar:
+      ;; If the expiration is within wdays warning time.
+      ;; Past-due deadlines are only shown on the current date
+      (if (and (< diff wdays) todayp (not (= diff 0)))
+          (save-excursion
+            (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
+                (progn
+                  (goto-char (match-end 0))
+                  (setq head (buffer-substring-no-properties
+                              (point)
+                              (progn (skip-chars-forward "^\r\n")
+                                     (point))))
+                  (if (string-match org-looking-at-done-regexp head)
+                      (setq txt nil)
+                    (setq txt (org-format-agenda-item
+                               (format "In %3d d.: " diff) head))))
+              (setq txt org-agenda-no-heading-message))
+            (when txt
+              (add-text-properties
+               0 (length txt) 
+               (append 
+                (list 'org-marker (org-agenda-new-marker pos)
+                      'priority (+ (- 10 diff) (org-get-priority txt))
+                      'face (cond ((<= diff 0) 'org-warning-face)
+                                  ((<= diff 5) 'font-lock-function-name-face)
+                                  (t nil)))
+                props)
+               txt)
+              (push txt ee)))))
+    ee))
+
+(defun org-agenda-get-scheduled ()
+  "Return the scheduled information for agenda display."
+  (let* ((props (list 'face 'org-scheduled-previously-face
+                      'mouse-face 'highlight
+                      'keymap org-agenda-keymap
+                      'help-echo
+                      (format "mouse-2 or RET jump to org file %s"
+                              (abbreviate-file-name (buffer-file-name)))))
+         (regexp org-scheduled-time-regexp)
+         (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
+         (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
+         d2 diff marker pos
+         ee txt head)
+    (goto-char (point-min))
+    (while (re-search-forward regexp nil t)
+      (setq d2 (time-to-days
+                (org-time-string-to-time (match-string 1)))
+            pos (point)
+            diff (- d2 d1))
+      ;; When to show a scheduled item in the calendar:
+      ;; If it is on or past the date.
+      (if (and (< diff 0) todayp)
+          (save-excursion
+            (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
+                (progn
+                  (goto-char (match-end 0))
+                  (setq head (buffer-substring-no-properties
+                              (point)
+                              (progn (skip-chars-forward "^\r\n") (point))))
+                  (if (string-match org-looking-at-done-regexp head)
+                      (setq txt nil)
+                    (setq txt (org-format-agenda-item
+                               (format "Sched.%2dx: " (- 1 diff)) head))))
+              (setq txt org-agenda-no-heading-message))
+            (when txt
+              (setq marker (org-agenda-new-marker pos))
+              (add-text-properties
+               0 (length txt)
+               (append (list 'org-marker marker
+                             'priority (+ (- 5 diff) (org-get-priority txt)))
+                       props) txt)
+              (push txt ee)))))
+    ee))
+
+(defun org-agenda-get-blocks ()
+  "Return the date-range information for agenda display."
+  (let* ((props (list 'face nil
+                      'mouse-face 'highlight
+                      'keymap org-agenda-keymap
+                      'help-echo
+                      (format "mouse-2 or RET jump to org file %s"
+                              (abbreviate-file-name (buffer-file-name)))))
+         (regexp org-tr-regexp)
+         (d0 (calendar-absolute-from-gregorian date))
+         marker ee txt d1 d2 s1 s2)
+    (goto-char (point-min))
+    (while (re-search-forward regexp nil t)
+      (setq s1 (match-string 1)
+            s2 (match-string 2)
+            d1 (time-to-days (org-time-string-to-time s1))
+            d2 (time-to-days (org-time-string-to-time s2)))
+      (if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
+          ;; Only allow days between the limits, because the normal
+          ;; date stamps will catch the limits.
+          (save-excursion
+            (setq marker (org-agenda-new-marker (point)))
+            (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
+                (progn
+                  (goto-char (match-end 1))
+                  (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
+                  (setq txt (org-format-agenda-item 
+                             (format "(%d/%d): "
+                                     (1+ (- d0 d1)) (1+ (- d2 d1)))
+                             (match-string 1))))
+              (setq txt org-agenda-no-heading-message))
+            (add-text-properties
+             0 (length txt) (append (list 'org-marker marker
+                                          'priority (org-get-priority txt))
+                                    props)
+             txt)
+            (push txt ee)))
+      (outline-next-heading))
+    ;; Sort the entries by expiration date.
+    (nreverse ee)))
+
+
+(defun org-format-agenda-item (prefix txt)
+  "Format TXT to be inserted into the agenda buffer.
+In particular, this indents the lins and adds a category."
+  (let ((cat (or org-category
+                 (file-name-sans-extension
+                  (file-name-nondirectory (buffer-file-name)))))
+        time rtn)
+    (if (symbolp cat) (setq cat (symbol-name cat)))
+    (setq rtn (format "  %-10s %s%s" (concat cat ":") prefix txt))
+    (add-text-properties 
+     0 2 (list 'category (downcase cat)
+               'prefix-length (- (length rtn) (length txt))
+               'time-of-day (org-get-time-of-day rtn))
+     rtn)
+    rtn))
+  
+;; FIXME:  Should this be restricted to beginning of string?
+(defun org-get-time-of-day (s)
+  "Check string S for a time of day."
+  (save-match-data
+  (when (and 
+         (string-match
+          "\\<\\([012][0-9]\\)\\(:\\([0-6][0-9]\\)\\)?\\([AaPp][Mm]\\)?\\>" s)
+         (or (match-beginning 2) (match-beginning 4)))
+    (+ (* 100 (+ (string-to-number (match-string 1 s))
+                 (if (and (match-beginning 4)
+                          (equal (downcase (match-string 4 s)) "pm"))
+                     12 0)))
+       (if (match-beginning 3)
+           (string-to-number (match-string 3 s))
+         0)))))
+
+(defun org-finalize-agenda-entries (list)
+  "Sort and concatenate the agenda items."
+  (mapconcat 'identity (sort list 'org-entries-lessp) "\n"))
+
+(defsubst org-cmp-priority (a b)
+  "Compare the priorities of string a and b."
+  (let ((pa (or (get-text-property 1 'priority a) 0))
+        (pb (or (get-text-property 1 'priority b) 0)))
+    (cond ((> pa pb) +1)
+          ((< pa pb) -1)
+          (t nil))))
+
+(defsubst org-cmp-category (a b)
+  "Compare the string values of categories of strings a and b."
+  (let ((ca (or (get-text-property 1 'category a) ""))
+        (cb (or (get-text-property 1 'category b) "")))
+    (cond ((string-lessp ca cb) -1)
+          ((string-lessp cb ca) +1)
+          (t nil))))
+
+(defsubst org-cmp-time (a b)
+  "Compare the time-of-day values of strings a and b."
+  (let* ((def (if org-sort-agenda-notime-is-late 2401 -1))
+         (ta (or (get-text-property 1 'time-of-day a) def))
+         (tb (or (get-text-property 1 'time-of-day b) def)))
+    (cond ((< ta tb) -1)
+          ((< tb ta) +1)
+          (t nil))))
+
+(defun org-entries-lessp (a b)
+  "Predicate for sorting agenda entries."
+  (let* ((time-up (org-cmp-time a b))
+         (time-down (if time-up (- time-up) nil))
+         (priority-up (org-cmp-priority a b))
+         (priority-down (if priority-up (- priority-up) nil))
+         (category-up (org-cmp-category a b))
+         (category-down (if category-up (- category-up) nil))
+         (category-keep (if category-up +1 nil)))  ; FIXME +1 or -1?
+    (cdr (assoc 
+          (eval (cons 'or org-agenda-sorting-strategy))
+          '((-1 . t) (1 . nil) (nil . nil))))))
+
+(defun org-agenda-show-priority ()
+  "Show the priority of the current item.
+This priority is composed of the main priority given with the [#A] cookies,
+and by additional input from the age of a schedules or deadline entry."
+  (interactive)
+  (let* ((pri (get-text-property (point-at-bol) 'priority)))
+    (message "Priority is %d" (if pri pri -1000))))
+
+
+(defun org-agenda-goto ()
+  "Go to the Org-mode file which contains the item at point."
+  (interactive)
+  (let* ((marker (or (get-text-property (point) 'org-marker) 
+                     (org-agenda-error)))
+         (buffer (marker-buffer marker))
+         (pos (marker-position marker)))
+    (switch-to-buffer-other-window buffer)
+    (widen)
+    (goto-char pos)
+    (org-show-hidden-entry)
+    (save-excursion
+      (and (outline-next-heading)
+           (org-flag-heading nil)))))  ; show the next heading
+
+(defun org-agenda-switch-to ()
+  "Go to the Org-mode file which contains the item at point."
+  (interactive)
+  (let* ((marker (or (get-text-property (point) 'org-marker) 
+                     (org-agenda-error)))
+         (buffer (marker-buffer marker))
+         (pos (marker-position marker)))
+    (switch-to-buffer buffer)
+    (delete-other-windows)
+    (widen)
+    (goto-char pos)
+    (org-show-hidden-entry)
+    (save-excursion
+      (and (outline-next-heading)
+           (org-flag-heading nil)))))  ; show the next heading
+
+(defun org-agenda-goto-mouse (ev)
+  "Go to the Org-mode file which contains the deadline at the mouse click."
+  (interactive "e")
+  (mouse-set-point ev)
+  (org-agenda-goto))
+
+(defun org-agenda-show ()
+  "Display the Org-mode file which contains the item at point."
+  (interactive)
+  (let ((win (selected-window)))
+    (org-agenda-goto)
+    (select-window win)))
+
+(defun org-agenda-recenter (arg)
+  "Display the Org-mode file which contains the item at point and recenter."
+  (interactive "P")
+  (let ((win (selected-window)))
+    (org-agenda-goto)
+    (recenter arg)
+    (select-window win)))
+
+(defun org-agenda-show-mouse (ev)
+  "Display the Org-mode file which contains the deadline at the mouse click."
+  (interactive "e")
+  (mouse-set-point ev)
+  (org-agenda-show))
+
+(defun org-agenda-error ()
+  (error "Command not allowed in this line."))
+
+(defun org-agenda-todo ()
+  "Cycle TODO state of line at point, also in Org-mode file."
+  (interactive)
+  (let* ((props (text-properties-at (point)))
+         (col (current-column))
+         (marker (or (get-text-property (point) 'org-marker)
+                     (org-agenda-error)))
+         (pl (get-text-property (point-at-bol) 'prefix-length))
+         (buffer (marker-buffer marker))
+         (pos (marker-position marker))
+         (buffer-read-only nil)
+         newhead)
+    (save-excursion
+      (set-buffer buffer)
+      (widen)
+      (goto-char pos)
+      (org-show-hidden-entry)
+      (save-excursion
+        (and (outline-next-heading)
+             (org-flag-heading nil)))   ; show the next heading
+      (org-todo)
+      (setq newhead (org-get-heading)))
+    (beginning-of-line 1)
+    (move-to-column pl)
+    (if (looking-at ".*")
+        (progn
+          (replace-match newhead t t)
+          (move-to-column col)
+          (add-text-properties (point-at-bol) (point-at-eol) props)
+          (beginning-of-line 1))
+      (error "Line update did not work"))))
+
+(defun org-agenda-priority-up ()
+  "Increase the priority of line at point, also in Org-mode file."
+  (interactive)
+  (org-agenda-priority 'up))
+
+(defun org-agenda-priority-down ()
+  "Decrease the priority of line at point, also in Org-mode file."
+  (interactive)
+  (org-agenda-priority 'down))
+
+(defun org-agenda-priority (&optional force-direction)
+  "Set the priority of line at point, also in Org-mode file."
+  (interactive)
+  (let* ((props (text-properties-at (point)))
+         (col (current-column))
+         (marker (or (get-text-property (point) 'org-marker)
+                     (org-agenda-error)))
+         (pl (get-text-property (point-at-bol) 'prefix-length))
+         (buffer (marker-buffer marker))
+         (pos (marker-position marker))
+         (buffer-read-only nil)
+         newhead)
+    (save-excursion
+      (set-buffer buffer)
+      (widen)
+      (goto-char pos)
+      (org-show-hidden-entry)
+      (save-excursion
+        (and (outline-next-heading)
+             (org-flag-heading nil)))   ; show the next heading
+      (funcall 'org-priority force-direction)
+      (setq newhead (org-get-heading)))
+    (beginning-of-line 1)
+    (move-to-column pl)
+    (if (looking-at ".*")
+        (progn
+          (replace-match (concat newhead) t t)
+          (move-to-column col)
+          (add-text-properties (point-at-bol) (point-at-eol) props)
+          (beginning-of-line 1))
+      (error "Line update did not work"))))
+
+(defun org-agenda-date-later (arg &optional what)
+  "Change the date of this item to one day later."
+  (interactive "p")
+  (let* ((marker (or (get-text-property (point) 'org-marker)
+                     (org-agenda-error)))
+         (buffer (marker-buffer marker))
+         (pos (marker-position marker)))
+    (save-excursion
+      (set-buffer buffer)
+      (widen)
+      (goto-char pos)
+      (if (not (org-at-timestamp-p))
+          (error "Cannot find time stamp"))
+      (org-timestamp-change arg (or what 'day))
+      (message "Time stamp changed to %s" org-last-changed-timestamp))))
+
+(defun org-agenda-date-earlier (arg &optional what)
+  "Change the date of this item to one day earlier."
+  (interactive "p")
+  (org-agenda-date-later (- arg) what))
+
+(defun org-agenda-date-today (arg)
+  "Change the date of this item to one day later."
+  (interactive "p")
+  (let* ((marker (or (get-text-property (point) 'org-marker)
+                     (org-agenda-error)))
+         (buffer (marker-buffer marker))
+         (pos (marker-position marker)))
+    (save-excursion
+      (set-buffer buffer)
+      (widen)
+      (goto-char pos)
+      (if (not (org-at-timestamp-p))
+          (error "Cannot find time stamp"))
+      (org-time-stamp nil)
+      (message "Time stamp changed to %s" org-last-changed-timestamp))))
+
+(defun org-get-heading ()
+  "Return the heading of the current entry, without the stars."
+  (save-excursion
+    (if (and (re-search-backward "[\r\n]\\*" nil t)
+             (looking-at "[\r\n]\\*+[ \t]+\\(.*\\)"))
+        (match-string 1)
+      "")))
+
+(defun org-agenda-diary-entry (arg)
+  "Make a diary entry, like the `i' command from the calendar.
+All the standard commands work: block, weekly etc"
+  (interactive "P")
+  (require 'diary-lib)
+  (let* ((char (progn 
+                 (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic")
+                 (read-char-exclusive)))
+         (cmd (cdr (assoc char
+                          '((?d . insert-diary-entry)
+                            (?w . insert-weekly-diary-entry)
+                            (?m . insert-monthly-diary-entry)
+                            (?y . insert-yearly-diary-entry)
+                            (?a . insert-anniversary-diary-entry)
+                            (?b . insert-block-diary-entry)
+                            (?c . insert-cyclic-diary-entry)))))
+         (oldf (symbol-function 'calendar-cursor-to-date))
+         (point (point))
+         (mark (or (mark t) (point))))
+    (unless cmd
+      (error "No command associated with <%c>" char))
+    (unless (and (get-text-property point 'day)
+                 (or (not (equal ?b char))
+                     (get-text-property mark 'day)))
+      (error "Don't know which date to use for diary entry"))
+    ;; We implememnt this by hacking the `calendar-cursor-to-date' function
+    ;; and the `calendar-mark-ring' variable.  Saves a lot of code.
+    (let ((calendar-mark-ring
+           (list (calendar-gregorian-from-absolute
+                  (or (get-text-property mark 'day)
+                      (get-text-property point 'day))))))
+      (unwind-protect
+          (progn
+            (fset 'calendar-cursor-to-date
+                  (lambda (&optional error)
+                    (calendar-gregorian-from-absolute 
+                     (get-text-property point 'day))))
+            (call-interactively cmd))
+        (fset 'calendar-cursor-to-date oldf)))))
+  
+;;; Link Stuff
+
+(defun org-find-file-at-mouse (ev)
+  "Open file link or URL at mouse."
+  (interactive "e")
+  (mouse-set-point ev)
+  (org-open-at-point 'in-emacs))
+
+(defun org-open-at-mouse (ev)
+  "Open file link or URL at mouse."
+  (interactive "e")
+  (mouse-set-point ev)
+  (org-open-at-point))
+
+(defun org-open-at-point (&optional in-emacs)
+  "Open link at or after point.
+If there is no link at point, this function will search forward up to
+the end of the current subtree.
+Normally, files will be opened by an appropriate application.  If the
+optional argument IN-EMACS is non-nil, Emacs will visit the file."
+  (interactive "P")
+  (if (org-at-timestamp-p)
+      (org-agenda nil (time-to-days (org-time-string-to-time
+                                     (substring (match-string 1) 0 10)))
+                  1)
+    (let (type path line (pos (point)))
+      (save-excursion
+        (skip-chars-backward
+         (if org-allow-space-in-links "^\t\n\r" "^ \t\n\r"))
+        (if (re-search-forward
+             org-link-regexp
+             (save-excursion
+               (condition-case nil
+                   (progn (outline-end-of-subtree) (max pos (point)))
+                 (error (end-of-line 1) (point))))
+             t)
+            (setq type (match-string 1)
+                  path (match-string 2)))
+        (unless path
+          (error "No link found."))
+        ;; Remove any trailing spaces in path
+        (if (string-match " +\\'" path)
+            (setq path (replace-match "" t t path)))
+
+        (cond
+
+         ((string= type "file")
+          (if (string-match ":\\([0-9]+\\)\\'" path)
+              (setq line (string-to-number (match-string 1 path))
+                    path (substring path 0 (match-beginning 0))))
+          (org-open-file path in-emacs line))
+
+         ((string= type "news")
+          (org-follow-gnus-link path))
+
+         ((string= type "bbdb")
+          (org-follow-bbdb-link path))
+
+         ((string= type "gnus")
+          (let (group article)
+            (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
+                (error "Error in Gnus link"))
+            (setq group (match-string 1 path)
+                  article (match-string 3 path))
+            (org-follow-gnus-link group article)))
+
+         ((string= type "vm")
+          (let (folder article)
+            (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
+                (error "Error in VM link"))
+            (setq folder (match-string 1 path)
+                  article (match-string 3 path))
+            ;; in-emacs is the prefix arg, will be interpreted as read-only
+            (org-follow-vm-link folder article in-emacs)))
+
+         ((string= type "wl")
+          (let (folder article)
+            (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
+                (error "Error in Wanderlust link"))
+            (setq folder (match-string 1 path)
+                  article (match-string 3 path))
+            (org-follow-wl-link folder article)))
+
+         ((string= type "rmail")
+          (let (folder article)
+            (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
+                (error "Error in RMAIL link"))
+            (setq folder (match-string 1 path)
+                  article (match-string 3 path))
+            (org-follow-rmail-link folder article)))
+
+         ((string= type "shell")
+          (let ((cmd path))
+            (if (or (not org-confirm-shell-links)
+                    (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd)))
+                (shell-command cmd)
+              (error "Abort"))))
+
+         (t
+          (browse-url-at-point)))))))
+
+(defun org-follow-bbdb-link (name)
+  "Follow a BBDB link to NAME."
+  (require 'bbdb)
+  ;; First try an exact match
+  (bbdb-name (concat "\\`" name "\\'") nil)
+  (if (= 0 (buffer-size (get-buffer "*BBDB*")))
+      ;; No exact match - try partial match
+      (bbdb-name name nil)))
+
+(defun org-follow-gnus-link (&optional group article)
+  "Follow a Gnus link to GROUP and ARTICLE."
+  (require 'gnus)
+  (funcall (cdr (assq 'gnus org-link-frame-setup)))
+  (if group (gnus-fetch-group group))
+  (if article
+      (or (gnus-summary-goto-article article nil 'force)
+          (if (fboundp 'gnus-summary-insert-cached-articles)
+              (progn
+                (gnus-summary-insert-cached-articles)
+                (gnus-summary-goto-article article nil 'force))
+            (message "Message could not be found.")))))
+;;  (if article (gnus-summary-goto-article article nil 'force)))
+
+(defun org-follow-vm-link (&optional folder article readonly)
+  "Follow a VM link to FOLDER and ARTICLE."
+  (require 'vm)
+  (if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
+      ;; ange-ftp or efs or tramp access
+      (let ((user (or (match-string 1 folder) (user-login-name)))
+            (host (match-string 2 folder))
+            (file (match-string 3 folder)))
+        (cond
+         ((featurep 'tramp)
+          ;; use tramp to access the file
+          (if org-xemacs-p
+              (setq folder (format "[%s@%s]%s" user host file))
+            (setq folder (format "/%s@%s:%s" user host file))))
+         (t
+          ;; use ange-ftp or efs
+          (require (if org-xemacs-p 'efs 'ange-ftp))
+          (setq folder (format "/%s@%s:%s" user host file))))))
+  (when folder
+    (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly)
+    (sit-for 0.1)
+    (when article
+      (vm-select-folder-buffer)
+      (widen)
+      (let ((case-fold-search t))
+        (goto-char (point-min))
+        (if (not (re-search-forward
+                  (concat "^" "message-id: *" (regexp-quote article))))
+            (error "Could not find the specified message in this folder"))
+        (vm-isearch-update)
+        (vm-isearch-narrow)
+        (vm-beginning-of-message)
+        (vm-summarize)))))
+
+(defun org-follow-wl-link (folder article)
+  "Follow a Wanderlust link to FOLDER and ARTICLE."
+  (wl-summary-goto-folder-subr folder 'no-sync t nil t)
+  (if article (wl-summary-jump-to-msg-by-message-id article))
+  (wl-summary-redisplay))
+
+(defun org-follow-rmail-link (folder article)
+  "Follow an RMAIL link to FOLDER and ARTICLE."
+  (let (message-number)
+    (save-excursion
+      (save-window-excursion
+        (rmail (if (string= folder "RMAIL") rmail-file-name folder))
+        (setq message-number
+              (save-restriction
+                (widen)
+                (goto-char (point-max))
+                (if (re-search-backward
+                     (concat "^Message-ID:\\s-+" (regexp-quote 
+                                                  (or article "")))
+                     nil t)
+                    (rmail-what-message))))))
+    (if message-number
+        (progn
+          (rmail (if (string= folder "RMAIL") rmail-file-name folder))
+          (rmail-show-message message-number)
+          message-number)
+      (error "Message not found"))))
+
+(defun org-open-file (path &optional in-emacs line)
+  "Open the file at PATH.
+First, this expands any special file name abbreviations.  Then the
+configuration variable `org-file-apps' is checked if it contains an
+entry for this file type, and if yes, the corresponding command is launched.
+If no application is found, Emacs simply visits the file.
+With optional argument IN-EMACS, Emacs will visit the file.
+If the file does not exist, an error is thrown."
+  (let* ((file (convert-standard-filename (org-expand-file-name path)))
+         (dfile (downcase file))
+         ext cmd apps)
+    (if (and (not (file-exists-p file))
+             (not org-open-non-existing-files))
+        (error "No such file: %s" file))
+    (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile)
+        (setq ext (match-string 1 dfile))
+      (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile)
+          (setq ext (match-string 1 dfile))))
+    (setq apps (append org-file-apps (org-default-apps)))
+    (if in-emacs
+        (setq cmd 'emacs)
+      (setq cmd (or (cdr (assoc ext apps))
+                    (cdr (assoc t apps)))))
+    (cond
+     ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
+      (setq cmd (format cmd file))
+      (save-window-excursion
+        (shell-command (concat cmd " & &"))))
+     ((or (stringp cmd)
+          (eq cmd 'emacs))
+      (funcall (cdr (assq 'file org-link-frame-setup)) file)
+      (if line (goto-line line)))
+     ((consp cmd)
+      (eval cmd))
+     (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))))
+
+(defun org-default-apps ()
+  "Return the default applications for this operating system."
+  (cond
+   ((eq system-type 'darwin)
+    org-file-apps-defaults-macosx)
+   ((eq system-type 'windows-nt)
+    org-file-apps-defaults-windowsnt)
+   ((eq system-type 'linux)
+    org-file-apps-defaults-linux)
+   (t org-file-apps-defaults-linux)))
+
+(defun org-expand-file-name (path)
+  "Replace special path abbreviations and expand the file name."
+  (expand-file-name path))
+
+
+(defvar org-insert-link-history nil
+  "Minibuffer history for links inserted with `org-insert-link'.")
+
+(defvar org-stored-links nil
+  "Contains the links stored with `org-store-link'.")
+
+;;;###autoload
+(defun org-store-link (arg)
+  "\\<org-mode-map>Store an org-link to the current location.
+This link can later be inserted into an org-buffer with
+\\[org-insert-link].
+For some link types, a prefix arg is interpreted:
+For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
+For file links, arg negates `org-line-numbers-in-file-links'."
+  (interactive "P")
+  (let (link cpltxt)
+    (cond
+
+     ((eq major-mode 'bbdb-mode)
+      (setq link (concat "bbdb:"
+                         (bbdb-record-name (bbdb-current-record)))))
+
+     ((eq major-mode 'calendar-mode)
+      (let ((cd (calendar-cursor-to-date)))
+        (setq link
+              (format-time-string
+               (car org-time-stamp-formats)
+               (apply 'encode-time
+                      (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
+                            nil nil nil))))))
+
+     ((or (eq major-mode 'vm-summary-mode)
+          (eq major-mode 'vm-presentation-mode))
+      (and (eq major-mode 'vm-presentation-mode) (vm-summarize))
+      (vm-follow-summary-cursor)
+      (save-excursion
+       (vm-select-folder-buffer)
+       (let* ((message (car vm-message-pointer))
+              (folder (buffer-file-name))
+              (subject (vm-su-subject message))
+              (author (vm-su-full-name message))
+              (address (vm-su-from message))
+              (message-id (vm-su-message-id message)))
+         (setq folder (abbreviate-file-name folder))
+         (if (string-match (concat "^" (regexp-quote vm-folder-directory))
+                           folder)
+             (setq folder (replace-match "" t t folder)))
+         (setq cpltxt (concat author " on: " subject))
+         (setq link (concat cpltxt "\n  " "vm:" folder
+                            "#" message-id)))))
+
+     ((eq major-mode 'wl-summary-mode)
+      (let* ((msgnum (wl-summary-message-number))
+             (message-id (elmo-message-field wl-summary-buffer-elmo-folder
+                                             msgnum 'message-id))
+             (wl-message-entity (elmo-msgdb-overview-get-entity
+                                 msgnum (wl-summary-buffer-msgdb)))
+             (author (wl-summary-line-from)) ; FIXME: how to get author name?
+             (subject "???"))   ; FIXME: How to get subject of email?
+        (setq cpltxt (concat author  " on: " subject))
+        (setq link (concat cpltxt "\n  " "wl:" wl-summary-buffer-folder-name
+                           "#" message-id))))
+
+     ((eq major-mode 'rmail-mode)
+      (save-excursion
+        (save-restriction
+          (rmail-narrow-to-non-pruned-header)
+          (let ((folder (buffer-file-name))
+                (message-id (mail-fetch-field "message-id"))
+                (author (mail-fetch-field "from"))
+                (subject (mail-fetch-field "subject")))
+            (setq cpltxt (concat author  " on: " subject))
+            (setq link (concat cpltxt "\n  " "rmail:" folder
+                               "#" message-id))))))
+
+     ((eq major-mode 'gnus-group-mode)
+      (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
+                          (gnus-group-group-name))         ; version
+                         ((fboundp 'gnus-group-name)
+                          (gnus-group-name))
+                         (t "???"))))
+        (if (org-xor arg org-usenet-links-prefer-google)
+            (setq link (format "http://groups.google.com/groups?group=%s"
+                               group))
+          (setq link (concat "gnus:" group)))))
+
+     ((or (eq major-mode 'gnus-summary-mode)
+          (eq major-mode 'gnus-article-mode))
+      (gnus-article-show-summary)
+      (gnus-summary-beginning-of-article)
+      (let* ((group (car gnus-article-current))
+             (article (cdr gnus-article-current))
+             (header (gnus-summary-article-header article))
+             (author (mail-header-from header))
+             (message-id (mail-header-id header))
+             (date (mail-header-date header))
+             (subject (gnus-summary-subject-string)))
+        (setq cpltxt (concat author " on: " subject))
+        (if (org-xor arg org-usenet-links-prefer-google)
+            (setq link
+                  (concat
+                   cpltxt "\n  "
+                   (format "http://groups.google.com/groups?as_umsgid=%s"
+                           (org-fixup-message-id-for-http message-id))))
+          (setq link (concat cpltxt "\n" "gnus:" group
+                             "#" (number-to-string article))))))
+
+     ((eq major-mode 'w3-mode)
+      (setq link (url-view-url t)))
+     ((eq major-mode 'w3m-mode)
+      (setq link w3m-current-url))
+
+     ((buffer-file-name)
+      ;; Just link to this file here.
+      (setq link (concat "file:"
+                         (abbreviate-file-name (buffer-file-name))))
+      ;; Add the line number?
+      (if (org-xor org-line-numbers-in-file-links arg)
+          (setq link 
+                (concat link
+                        ":" (int-to-string 
+                             (+ (if (bolp) 1 0) (count-lines
+                                                 (point-min) (point))))))))
+     ((interactive-p)
+      (error "Cannot link to a buffer which is not visiting a file"))
+     (t (setq link nil)))
+
+    (if (and (interactive-p) link)
+        (progn
+          (setq org-stored-links
+                (cons (cons (or cpltxt link) link) org-stored-links))
+          (message "Stored: %s" (or cpltxt link)))
+      link)))
+
+(defun org-xor (a b)
+  "Exclusive or."
+  (or (and a (not b))
+      (and b (not a))))
+
+(defun org-get-header (header)
+  "Find a header field in the current buffer."
+  (save-excursion
+    (goto-char (point-min))
+    (let ((case-fold-search t) s)
+      (cond
+       ((eq header 'from)
+        (if (re-search-forward "^From:\\s-+\\(.*\\)" nil t)
+            (setq s (match-string 1)))
+	(while (string-match "\"" s)
+	  (setq s (replace-match "" t t s)))
+	(if (string-match "[<(].*" s)
+	    (setq s (replace-match "" t t s))))
+       ((eq header 'message-id)
+        (if (re-search-forward "^message-id:\\s-+\\(.*\\)" nil t)
+            (setq s (match-string 1))))
+       ((eq header 'subject)
+        (if (re-search-forward "^subject:\\s-+\\(.*\\)" nil t)
+            (setq s (match-string 1)))))
+      (if (string-match "\\`[ \t\]+" s) (setq s (replace-match "" t t s)))
+      (if (string-match "[ \t\]+\\'" s) (setq s (replace-match "" t t s)))
+      s)))
+
+
+(defun org-fixup-message-id-for-http (s)
+  "Replace special characters in a message id, so that it can be used
+in an http query."
+  (while (string-match "<" s)
+    (setq s (replace-match "%3C" t t s)))
+  (while (string-match ">" s)
+    (setq s (replace-match "%3E" t t s)))
+  (while (string-match "@" s)
+    (setq s (replace-match "%40" t t s)))
+  s)
+
+(defun org-insert-link (&optional complete-file)
+  "Insert a link. At the prompt, enter the link.
+
+Completion can be used to select a link previously stored with
+`org-store-link'.  When the empty string is entered (i.e. if you just
+press RET at the prompt), the link defaults to the most recently
+stored link.
+
+With a C-u prefix, prompts for a file to link to.  The file name can be
+selected using completion.  The path to the file will be relative to
+the current directory if the file is in the current directory or a
+subdirectory.  Otherwise, the link will be the absolute path as
+completed in the minibuffer (i.e. normally ~/path/to/file).
+
+With two C-u prefixes, enforce an absolute path even if the file
+is in the current directory or below."
+  (interactive "P")
+  (let ((link (if complete-file
+                  (read-file-name "File: ")
+                (completing-read
+                 "Link: " org-stored-links nil nil nil
+                 org-insert-link-history
+                 (or (car (car org-stored-links))))))
+	linktxt matched)
+    (if (or (not link) (equal link ""))
+      (error "No links available"))
+    (if complete-file
+        (let ((pwd (file-name-as-directory (expand-file-name "."))))
+          (cond
+           ((equal complete-file '(16))
+            (insert "file:" (abbreviate-file-name (expand-file-name link))))
+           ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
+                          (expand-file-name link))
+            (insert "file:" (match-string 1 (expand-file-name link))))
+           (t (insert "file:" link))))
+      (setq linktxt (cdr (assoc link org-stored-links)))
+      (if (not org-keep-stored-link-after-insertion)
+          (setq org-stored-links (delq (assoc link org-stored-links)
+                                       org-stored-links)))
+      (let ((lines (org-split-string (or linktxt link) "\n")))
+        (insert (car lines))
+        (setq matched (string-match org-link-regexp (car lines)))
+        (setq lines (cdr lines))
+        (while lines
+          (insert "\n")
+	  (if (save-excursion
+		(beginning-of-line 0)
+		(looking-at "[ \t]+\\S-"))
+	      (indent-relative))
+          (setq matched (or matched
+                            (string-match org-link-regexp (car lines))))
+          (insert (car lines))
+          (setq lines (cdr lines))))
+      (unless matched
+        (error "Add link type: http(s),ftp,mailto,file,news,bbdb,vm,wl,rmail,gnus, or shell")))))
+
+;;; Hooks for remember.el
+;;;###autoload
+(defun org-remember-annotation ()
+  "Return a link to the current location as an annotation for remember.el.
+If you are using Org-mode files as target for data storage with
+remember.el, then the annotations should include a link compatible with the
+conventions in Org-mode.  This function returns such a link."
+  (org-store-link nil))
+
+(defconst org-remember-help
+"Select a destination location for the note.
+UP/DOWN=headline   TAB=cycle visibility  [Q]uit   RET/<left>/<right>=Store
+RET at beg-of-buf -> Append to file as level 2 headline
+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.
+First prompts for an org file.  If the user just presses return, the value
+of `org-default-notes-file' is used.
+Then the command offers the headings tree of the selected file in order to
+file the text at a specific location.
+You can either immediately press RET to get the note appended to the
+file.  Or you can use vertical cursor motion and visibility cycling (TAB) to
+find a better place.  Then press RET or <left> or <right> in insert the note.
+
+Key      Cursor position   Note gets inserted
+-----------------------------------------------------------------------------
+RET      buffer-start      as level 2 heading at end of file
+RET      on headline       as sublevel of the heading at cursor
+RET      no heading        at cursor position, level taken from context.
+                           Or use prefix arg to specify level manually.
+<left>   on headline       as same level, before current heading
+<right>  on headline       as same level, after current heading
+
+So the fastest way to store the note is to press RET RET to append it to
+the default file.  This way your current train of thought is not
+interrupted, in accordance with the principles of remember.el.  But with
+little extra effort, you can push it directly to the correct location.
+
+Before being stored away, the function ensures that the text has a
+headline, i.e. a first line that starts with a \"*\".  If not, a headline
+is constructed from the current date and some additional data.
+
+If the variable `org-adapt-indentation' is non-nil, the entire text is
+also indented so that it starts in the same column as the headline
+\(i.e. after the stars).
+
+See also the variable `org-reverse-note-order'."  
+  (catch 'quit
+    (let* ((txt (buffer-substring (point-min) (point-max)))
+           (fastp current-prefix-arg)
+           (file (if fastp org-default-notes-file (org-get-org-file)))
+           (visiting (find-buffer-visiting file))
+           (org-startup-with-deadline-check nil)
+           (org-startup-folded nil)
+           spos level indent reversed)
+      ;; Modify text so that it becomes a nice subtree which can be inserted
+      ;; into an org tree.
+      (let* ((lines (split-string txt "\n"))
+             (first (car lines))
+             (lines (cdr lines)))
+        (if (string-match "^\\*+" first)
+            ;; Is already a headline
+            (setq indent (make-string (- (match-end 0) (match-beginning 0)
+                                         -1) ?\ ))
+          ;; We need to add a headline:  Use time and first buffer line
+          (setq lines (cons first lines)
+                first (concat "* " (current-time-string)
+                              " (" (remember-buffer-desc) ")")
+                indent "  "))
+        (if org-adapt-indentation
+            (setq lines (mapcar (lambda (x) (concat indent x)) lines)))
+        (setq txt (concat first "\n"
+                          (mapconcat 'identity lines "\n"))))
+      ;; Find the file
+      (if (not visiting)
+          (find-file-noselect file))
+      (save-excursion
+        (set-buffer (get-file-buffer file))
+        (setq reversed (org-notes-order-reversed-p))
+        (save-restriction
+          (save-excursion
+            (widen)
+            ;; Ask the User for a location
+            (setq spos (if fastp 1 (org-get-location
+                                    (current-buffer)
+                                    org-remember-help)))
+            (if (not spos) (throw 'quit nil)) ; return nil to show we did
+                                              ; not handle this note
+            (goto-char spos)
+            (cond ((bobp)
+                   ;; Put it at the start or end, as level 2
+                   (save-restriction
+                     (widen)
+                     (goto-char (if reversed (point-min) (point-max)))
+                     (if (not (bolp)) (newline))
+                     (org-paste-subtree (or current-prefix-arg 2) txt)))
+                  ((and (org-on-heading-p nil) (not current-prefix-arg))
+                   ;; Put it below this entry, at the beg/end of the subtree
+                   (org-back-to-heading)
+                   (setq level (outline-level))
+                   (if reversed
+                       (outline-end-of-heading)
+                     (outline-end-of-subtree))
+                   (if (not (bolp)) (newline))
+                   (beginning-of-line 1)
+                   (org-paste-subtree (1+ level) txt))
+                  (t
+                   ;; Put it right there, with automatic level determined by
+                   ;; org-paste-subtree or from prefix arg
+                   (org-paste-subtree current-prefix-arg txt)))
+            (when remember-save-after-remembering
+              (save-buffer)
+              (if (not visiting) (kill-buffer (current-buffer)))))))))
+  t)    ;; return t to indicate that we took care of this note.
+
+(defun org-get-org-file ()
+  "Read a filename, with default directory `org-directory'."
+  (let ((default (or org-default-notes-file remember-data-file)))
+    (read-file-name (format "File name [%s]: " default)
+                    (file-name-as-directory org-directory)
+                    default)))
+
+(defun org-notes-order-reversed-p ()
+  "Check if the current file should receive notes in reversed order."
+  (cond
+   ((not org-reverse-note-order) nil)
+   ((eq t org-reverse-note-order) t)
+   ((not (listp org-reverse-note-order)) nil)
+   (t (catch 'exit
+        (let  ((all org-reverse-note-order)
+               entry)
+          (while (setq entry (pop all))
+            (if (string-match (car entry) (buffer-file-name))
+                (throw 'exit (cdr entry))))
+          nil)))))
+
+;;; Tables
+
+;; Watch out:  Here we are talking about two different kind of tables.
+;; Most of the code is for the tables created with the Org-mode table editor.
+;; Sometimes, we talk about tables created and edited with the table.el
+;; Emacs package.  We call the former org-type tables, and the latter
+;; table.el-type tables.
+
+;; We use a before-change function to check if a table might need
+;; an update.
+(defvar org-table-may-need-update t
+  "Indicates of a table might need an update.
+This variable is set by `org-before-change-function'. `org-table-align'
+sets it back to nil.")
+
+(defun org-before-change-function (beg end)
+  "Every change indicates that a table might need an update."
+  (setq org-table-may-need-update t))
+
+(defconst org-table-line-regexp "^[ \t]*|"
+  "Detects an org-type table line.")
+(defconst org-table-dataline-regexp "^[ \t]*|[^-]"
+  "Detects an org-type table line.")
+(defconst org-table-hline-regexp "^[ \t]*|-"
+  "Detects an org-type table hline.")
+(defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
+  "Detects a table-type table hline.")
+(defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
+  "Detects an org-type or table-type table")
+(defconst org-table-border-regexp "^[ \t]*[^| \t]"
+  "Searching from within a table (any type) this finds the first line
+outside the table.")
+(defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
+  "Searching from within a table (any type) this finds the first line
+outside the table.")
+
+(defun org-table-create-with-table.el ()
+  "Use the table.el package to insert a new table.
+If there is already a table at point, convert between Org-mode tables
+and table.el tables."
+  (interactive)
+  (require 'table)
+  (cond
+   ((org-at-table.el-p)
+    (if (y-or-n-p "Convert table to Org-mode table? ")
+        (org-table-convert)))
+   ((org-at-table-p)
+    (if (y-or-n-p "Convert table to table.el table? ")
+        (org-table-convert)))
+   (t (call-interactively 'table-insert))))
+
+(defun org-table-create (&optional size)
+  "Query for a size and insert a table skeleton.
+SIZE is a string Columns x Rows like for example \"3x2\"."
+  (interactive "P")
+  (unless size
+    (setq size (read-string
+                (concat "Table size Columns x Rows [e.g. "
+                        org-table-default-size "]: ")
+                "" nil org-table-default-size)))
+
+  (let* ((pos (point))
+         (indent (make-string (current-column) ?\ ))
+         (split (org-split-string size " *x *"))
+         (rows (string-to-number (nth 1 split)))
+         (columns (string-to-number (car split)))
+         (line (concat (apply 'concat indent "|" (make-list columns "  |"))
+                       "\n")))
+    (if (string-match "^[ \t]*$" (buffer-substring-no-properties
+                                  (point-at-bol) (point)))
+        (beginning-of-line 1)
+      (newline))
+    (mapcar (lambda (x) (insert line)) (make-list rows t))
+    (goto-char pos)
+    (if (> rows 1)
+        ;; Insert a hline after the first row.
+        (progn
+          (end-of-line 1)
+          (insert "\n|-")
+          (goto-char pos)))
+    (org-table-align)))
+
+(defun org-table-convert-region (beg0 end0 nspace)
+  "Convert region to a table.
+The region goes from BEG0 to END0, but these borders will be moved
+slightly, to make sure a beginning of line in the first line is included.
+When NSPACE is non-nil, it indicates the minimum number of spaces that
+separate columns (default: just one space)"
+  (let* ((beg (min beg0 end0))
+         (end (max beg0 end0))
+         (tabsep t)
+         re)
+    (goto-char beg)
+    (beginning-of-line 1)
+    (setq beg (move-marker (make-marker) (point)))
+    (goto-char end)
+    (if (bolp) (backward-char 1) (end-of-line 1))
+    (setq end (move-marker (make-marker) (point)))
+    ;; Lets see if this is tab-separated material.  If every nonempty line
+    ;; contains a tab, we will assume that it is tab-separated material
+    (if nspace
+        (setq tabsep nil)
+      (goto-char beg)
+      (and (re-search-forward "^[^\n\t]+$" end t) (setq tabsep nil)))
+    (if nspace (setq tabsep nil))
+    (if tabsep
+        (setq re "^\\|\t")
+      (setq re (format "^ *\\| *\t *\\| \\{%d,\\}"
+                       (max 1 (prefix-numeric-value nspace)))))
+    (goto-char beg)
+    (while (re-search-forward re end t)
+      (replace-match "|" t t))
+    (goto-char beg)
+    (insert " ")
+    (org-table-align)))
+
+(defun org-table-import (file arg)
+  "Import FILE as a table.
+The file is assumed to be tab-separated.  Such files can be produced by most
+spreadsheet and database applications.  If no tabs (at least one per line)
+are found, lines will be split on whitespace into fields."
+  (interactive "f\nP")
+  (or (bolp) (newline))
+  (let ((beg (point))
+        (pm (point-max)))
+    (insert-file-contents file)
+    (org-table-convert-region beg (+ (point) (- (point-max) pm)) arg)))
+
+(defun org-table-export ()
+  "Export table as a tab-separated file.
+Such a file can be imported into a spreadsheet program like Excel."
+  (interactive)
+  (let* ((beg (org-table-begin))
+         (end (org-table-end))
+         (table (buffer-substring beg end))
+         (file (read-file-name "Export table to: "))
+         buf)
+    (unless (or (not (file-exists-p file))
+                (y-or-n-p (format "Overwrite file %s? " file)))
+      (error "Abort"))
+    (save-excursion
+      (find-file file)
+      (setq buf (current-buffer))
+      (erase-buffer)
+      (fundamental-mode)
+      (insert table)
+      (goto-char (point-min))
+      (while (re-search-forward "^[ \t]*|[ \t]*" nil t)
+        (replace-match "" t t)
+        (end-of-line 1))
+      (goto-char (point-min))
+      (while (re-search-forward "[ \t]*|[ \t]*$" nil t)
+        (replace-match "" t t)
+        (goto-char (min (1+ (point)) (point-max))))
+      (goto-char (point-min))
+      (while (re-search-forward "^-[-+]*$" nil t)
+        (replace-match "")
+        (if (looking-at "\n")
+            (delete-char 1)))
+      (goto-char (point-min))
+      (while (re-search-forward "[ \t]*|[ \t]*" nil t)
+        (replace-match "\t" t t))
+      (save-buffer))
+    (kill-buffer buf)))
+
+(defun org-table-align (&optional arg)
+  "Align the table at point by aligning all vertical bars."
+  (interactive "P")
+  (let* (
+         ;; Limits of table
+         (beg (org-table-begin))
+         (end (org-table-end))
+         ;; Current cursor position
+         (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
+         (colpos (org-table-current-column))
+         (winstart (window-start))
+         text lines (new "") lengths l typenums ty fields maxfields i
+         column
+         (indent "") cnt frac
+         rfmt hfmt
+         (spaces (if (org-in-invisibility-spec-p '(org-table))
+                     org-table-spaces-around-invisible-separators
+                   org-table-spaces-around-separators))
+         (sp1 (car spaces))
+         (sp2 (cdr spaces))
+         (rfmt1 (concat
+                 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|"))
+         (hfmt1 (concat
+                 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+"))
+         emptystrings)
+    (untabify beg end)
+    ;; (message "Aligning table...")
+    ;; Get the rows
+    (setq lines (org-split-string
+                 (buffer-substring-no-properties beg end) "\n"))
+    ;; Store the indentation of the first line
+    (if (string-match "^ *" (car lines))
+        (setq indent (make-string (- (match-end 0) (match-beginning 0)) ?\ )))
+    ;; Mark the hlines
+    (setq lines (mapcar (lambda (l) (if (string-match "^ *|-" l) nil l))
+                        lines))
+    ;; Get the data fields
+    (setq fields (mapcar
+                  (lambda (l)
+                      (org-split-string l " *| *"))
+                  (delq nil (copy-sequence lines))))
+    ;; How many fields in the longest line?
+    (condition-case nil
+        (setq maxfields (apply 'max (mapcar 'length fields)))
+      (error
+       (kill-region beg end)
+       (org-table-create org-table-default-size)
+       (error "Empty table - created default table")))
+    ;; A list of empty string to fill any short rows on output
+    (setq emptystrings (make-list maxfields ""))
+    ;; Get the maximum length of a field and the most common datatype
+    ;; for each column
+    (setq i -1)
+    (while (< (setq i (1+ i)) maxfields)   ;; Loop over all columns
+      (setq column (mapcar (lambda (x) (or (nth i x) "")) fields))
+      ;; maximum length
+      (push (apply 'max 1 (mapcar 'length column)) lengths)
+      ;; compute the fraction stepwise, ignoring empty fields
+      (setq cnt 0 frac 0.0)
+      (mapcar
+       (lambda (x)
+         (if (equal x "")
+             nil
+           (setq frac ( / (+ (* frac cnt)
+                             (if (string-match org-table-number-regexp x) 1 0))
+                          (setq cnt (1+ cnt))))))
+       column)
+      (push (>= frac org-table-number-fraction) typenums))
+    (setq lengths (nreverse lengths)
+          typenums (nreverse typenums))
+    ;; Compute the formats needed for output of the table
+    (setq rfmt (concat indent "|") hfmt (concat indent "|"))
+    (while (setq l (pop lengths))
+      (setq ty (if (pop typenums) "" "-")) ; number types flushright
+      (setq rfmt (concat rfmt (format rfmt1 ty l))
+            hfmt (concat hfmt (format hfmt1 (make-string l ?-)))))
+    (setq rfmt (concat rfmt "\n")
+          hfmt (concat (substring hfmt 0 -1) "|\n"))
+    ;; Produce the new table
+    (while lines
+      (setq l (pop lines))
+      (if l
+          (setq new (concat new (apply 'format rfmt
+                                       (append (pop fields) emptystrings))))
+        (setq new (concat new hfmt))))
+    ;; Replace the old one
+    (delete-region beg end)
+    (move-marker end nil)
+    (insert new)
+    ;; 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))
+    ))
+
+(defun org-table-begin (&optional table-type)
+  "Find the beginning of the table and return its position.
+With argument TABLE-TYPE, go to the beginning of a table.el-type table."
+  (save-excursion
+    (if (not (re-search-backward
+              (if table-type org-table-any-border-regexp
+                org-table-border-regexp)
+              nil t))
+        (error "Can't find beginning of table")
+      (goto-char (match-beginning 0))
+      (beginning-of-line 2)
+      (point))))
+
+(defun org-table-end (&optional table-type)
+  "Find the end of the table and return its position.
+With argument TABLE-TYPE, go to the end of a table.el-type table."
+  (save-excursion
+    (if (not (re-search-forward
+              (if table-type org-table-any-border-regexp
+                org-table-border-regexp)
+              nil t))
+        (goto-char (point-max))
+      (goto-char (match-beginning 0)))
+    (point-marker)))
+
+(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."
+  (interactive "P")
+  (if (and org-table-automatic-realign
+           org-table-may-need-update)
+      (org-table-align))
+  (if (org-at-table-hline-p)
+      (end-of-line 1))
+  (condition-case nil
+      (progn
+        (re-search-forward "|" (org-table-end))
+        (if (looking-at "[ \t]*$")
+            (re-search-forward "|" (org-table-end)))
+        (if (looking-at "-")
+            (progn
+              (beginning-of-line 0)
+              (org-table-insert-row 'below))
+          (if (looking-at " ") (forward-char 1))))
+    (error
+     (org-table-insert-row 'below))))
+
+(defun org-table-previous-field (&optional arg)
+  "Go to the previous field in the table.
+Before doing so, re-align the table if necessary."
+  (interactive "P")
+  (if (and org-table-automatic-realign
+           org-table-may-need-update)
+      (org-table-align))
+  (if (org-at-table-hline-p)
+      (end-of-line 1))
+  (re-search-backward "|" (org-table-begin))
+  (re-search-backward "|" (org-table-begin))
+  (while (looking-at "|\\(-\\|[ \t]*$\\)")
+    (re-search-backward "|" (org-table-begin)))
+  (if (looking-at "| ?")
+      (goto-char (match-end 0))))
+
+(defun org-table-next-row (&optional arg)
+  "Go to the next row (same column) in the current table.
+Before doing so, re-align the table if necessary."
+  (interactive "P")
+  (if (or (looking-at "[ \t]*$")
+          (save-excursion (skip-chars-backward " \t") (bolp)))
+      (newline)
+    (if (and org-table-automatic-realign
+             org-table-may-need-update)
+        (org-table-align))
+    (let ((col (org-table-current-column)))
+      (beginning-of-line 2)
+      (if (or (not (org-at-table-p))
+              (org-at-table-hline-p))
+          (progn
+            (beginning-of-line 0)
+            (org-table-insert-row 'below)))
+      (org-table-goto-column col)
+      (skip-chars-backward "^|\n\r")
+      (if (looking-at " ") (forward-char 1)))))
+
+(defun org-table-copy-from-above (n)
+  "Copy into the current column the nearest non-empty field from above.
+With prefix argument N, take the Nth non-empty field."
+  (interactive "p")
+  (let ((colpos (org-table-current-column))
+        (beg (org-table-begin))
+        txt)
+    (org-table-check-inside-data-field)
+    (if (save-excursion
+          (setq txt
+                (catch 'exit
+                  (while (progn (beginning-of-line 1)
+                                (re-search-backward org-table-dataline-regexp
+                                                    beg t))
+                    (org-table-goto-column colpos t)
+                    (if (and (looking-at
+                              "|[ \t]*\\([^| \t][^|]*[^| \t]\\)[ \t]*|")
+                             (= (setq n (1- n)) 0))
+                        (throw 'exit (match-string 1)))))))
+        (progn
+          (insert txt)
+          (org-table-align))
+      (error "No non-empty field found"))))
+
+(defun org-table-check-inside-data-field ()
+  "Is point inside a table data field?
+I.e. not on a hline or before the first or after the last column?"
+  (if (or (not (org-at-table-p))
+          (= (org-table-current-column) 0)
+          (org-at-table-hline-p)
+          (looking-at "[ \t]*$"))
+      (error "Not in table data field")))
+
+(defun org-table-blank-field ()
+  "Blank the current table field."
+  (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))))
+
+(defun org-table-get-field (&optional n replace)
+  "Return the value of the field in column N of current row.
+N defaults to current field.
+If REPLACE is a string, replace field with this value.  The return value
+is always the old value."
+  (and n (org-table-goto-column n))
+  (skip-chars-backward "^|")
+  (backward-char 1)
+  (if (looking-at "|[^|\r\n]*")
+      (let* ((pos (match-beginning 0))
+             (len (length (match-string 0)))
+             (val (buffer-substring (1+ pos) (match-end 0))))
+        (if replace
+            (replace-match (concat "|" replace)))
+        (goto-char (+ 2 pos))
+        val)))
+
+(defun org-table-current-column ()
+  "Find out which column we are in.
+When called interactively, column is also displayed in echo area."
+  (interactive)
+  (if (interactive-p) (org-table-check-inside-data-field))
+  (save-excursion
+    (let ((cnt 0) (pos (point)))
+      (beginning-of-line 1)
+      (while (search-forward "|" pos t)
+        (setq cnt (1+ cnt)))
+      (if (interactive-p) (message "This is table column %d" cnt))
+      cnt)))
+
+(defun org-table-goto-column (n &optional on-delim force)
+  "Move the cursor to the Nth column in the current table line.
+With optional argument ON-DELIM, stop with point before the left delimiter
+of the field. 
+If there are less than N fields, just go to after the last delimiter.
+However, when FORCE is non-nil, create new columns if necessary."
+  (let ((pos (point-at-eol)))
+    (beginning-of-line 1)
+    (when (> n 0)
+      (while (and (> (setq n (1- n)) -1)
+                  (or (search-forward "|" pos t)
+                      (and force
+                           (progn (end-of-line 1)
+                                  (skip-chars-backward "^|")
+                                  (insert " |")
+                                  (bachward-char 2) t)))))
+      (when (and force (not (looking-at ".*|")))
+        (save-excursion (end-of-line 1) (insert "|")))
+      (if on-delim
+          (backward-char 1)
+        (if (looking-at " ") (forward-char 1))))))
+
+(defun org-at-table-p (&optional table-type)
+  "Return t if the cursor is inside an org-type table."
+  (if org-enable-table-editor
+      (save-excursion
+        (beginning-of-line 1)
+        (looking-at (if table-type org-table-any-line-regexp
+                      org-table-line-regexp)))
+    nil))
+
+(defun org-table-recognize-table.el ()
+  "If there is a table.el table nearby, recognize it and move into it."
+  (if org-table-tab-recognizes-table.el
+      (if (org-at-table.el-p)
+          (progn
+            (beginning-of-line 1)
+            (if (looking-at org-table-dataline-regexp)
+                nil
+              (if (looking-at org-table1-hline-regexp)
+                  (progn
+                    (beginning-of-line 2)
+                    (if (looking-at org-table-any-border-regexp)
+                        (beginning-of-line -1)))))
+            (if (re-search-forward "|" (org-table-end t) t)
+                (progn
+                  (require 'table)
+                  (if (table--at-cell-p (point))
+                      t
+                    (message "recognizing table.el table...")
+                    (table-recognize-table)
+                    (message "recognizing table.el table...done")))
+              (error "This should not happen..."))
+            t)
+        nil)
+    nil))
+
+(defun org-at-table.el-p ()
+  "Return t if the cursor is inside a table.el-type table."
+  (save-excursion
+    (if (org-at-table-p 'any)
+        (progn
+          (goto-char (org-table-begin 'any))
+          (looking-at org-table1-hline-regexp))
+      nil)))
+
+(defun org-at-table-hline-p ()
+  "Return t if the cursor is inside a hline in a table."
+  (if org-enable-table-editor
+      (save-excursion
+        (beginning-of-line 1)
+        (looking-at org-table-hline-regexp))
+    nil))
+
+(defun org-table-insert-column (&optional arg)
+  "Insert a new column into the table."
+  (interactive "P")
+  (if (not (org-at-table-p))
+      (error "Not at a table"))
+  (org-table-find-dataline)
+  (let* ((col (max 1 (org-table-current-column)))
+         (beg (org-table-begin))
+         (end (org-table-end))
+         ;; Current cursor position
+         (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
+         (colpos col))
+    (goto-char beg)
+    (while (< (point) end)
+      (if (org-at-table-hline-p)
+          nil
+        (org-table-goto-column col t)
+        (insert "|   "))
+      (beginning-of-line 2))
+    (move-marker end nil)
+    (goto-line linepos)
+    (org-table-goto-column colpos))
+  (org-table-align))
+
+(defun org-table-find-dataline ()
+  "Find a dataline in the current table, which is needed for column commands."
+  (if (and (org-at-table-p)
+           (not (org-at-table-hline-p)))
+      t
+    (let ((col (current-column))
+          (end (org-table-end)))
+      (move-to-column col)
+      (while (and (< (point) end)
+                  (or (not (= (current-column) col))
+                      (org-at-table-hline-p)))
+        (beginning-of-line 2)
+        (move-to-column col))
+      (if (and (org-at-table-p)
+               (not (org-at-table-hline-p)))
+          t
+        (error
+         "Please position cursor in a data line for column operations")))))
+
+(defun org-table-delete-column (&optional arg)
+  "Insert a new column into the table."
+  (interactive "P")
+  (if (not (org-at-table-p))
+      (error "Not at a table"))
+  (org-table-find-dataline)
+  (org-table-check-inside-data-field)
+  (let* ((col (org-table-current-column))
+         (beg (org-table-begin))
+         (end (org-table-end))
+         ;; Current cursor position
+         (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
+         (colpos col))
+    (goto-char beg)
+    (while (< (point) end)
+      (if (org-at-table-hline-p)
+          nil
+        (org-table-goto-column col t)
+        (and (looking-at "|[^|\n]+|")
+             (replace-match "|")))
+      (beginning-of-line 2))
+    (move-marker end nil)
+    (goto-line linepos)
+    (org-table-goto-column colpos))
+  (org-table-align))
+
+(defun org-table-move-column (&optional left)
+  "Move the current column to the right.  With arg LEFT, move to the left."
+  (interactive "P")
+  (if (not (org-at-table-p))
+      (error "Not at a table"))
+  (org-table-find-dataline)
+  (org-table-check-inside-data-field)
+  (let* ((col (org-table-current-column))
+         (col1 (if left (1- col) col))
+         (beg (org-table-begin))
+         (end (org-table-end))
+         ;; Current cursor position
+         (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
+         (colpos (if left (1- col) (1+ col))))
+    (if (and left (= col 1))
+        (error "Cannot move column further left"))
+    (if (and (not left) (looking-at "[^|\n]*|[^|\n]*$"))
+        (error "Cannot move column further right"))
+    (goto-char beg)
+    (while (< (point) end)
+      (if (org-at-table-hline-p)
+          nil
+        (org-table-goto-column col1 t)
+        (and (looking-at "|\\([^|\n]+\\)|\\([^|\n]+\\)|")
+             (replace-match "|\\2|\\1|")))
+      (beginning-of-line 2))
+    (move-marker end nil)
+    (goto-line linepos)
+    (org-table-goto-column colpos))
+  (org-table-align))
+
+(defun org-table-move-row (&optional up)
+  "Move the current table line down. With arg UP, move it up."
+  (interactive "P")
+  (let ((col (current-column))
+        (pos (point))
+        (tonew (if up 0 2))
+        txt)
+    (beginning-of-line tonew)
+    (if (not (org-at-table-p))
+        (progn
+          (goto-char pos)
+          (error "Cannot move row further.")))
+    (goto-char pos)
+    (beginning-of-line 1)
+    (setq pos (point))
+    (setq txt (buffer-substring (point) (1+ (point-at-eol))))
+    (delete-region (point) (1+ (point-at-eol)))
+    (beginning-of-line tonew)
+    (insert txt)
+    (beginning-of-line 0)
+    (move-to-column col)))
+
+(defun org-table-insert-row (&optional arg)
+  "Insert a new row above the current line into the table.
+With prefix ARG, insert below the current line."
+  (interactive "P")
+  (if (not (org-at-table-p))
+      (error "Not at a table"))
+  (let ((line (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+    (if (string-match "^[ \t]*|-" line)
+        (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")
+    (beginning-of-line 0)
+    (re-search-forward "| ?" (point-at-eol) t)
+    (org-table-align)))
+
+(defun org-table-insert-hline (&optional arg)
+  "Insert a horizontal-line below the current line into the table.
+With prefix ARG, insert above the current line."
+  (interactive "P")
+  (if (not (org-at-table-p))
+      (error "Not at a table"))
+  (let ((line (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
+        (col (current-column))
+        start)
+    (if (string-match "^[ \t]*|-" line)
+        (setq line
+              (mapcar (lambda (x) (if (member x '(?| ?+))
+                                      (prog1 (if start ?+ ?|) (setq start t))
+                                    (if start ?- ?\ )))
+                      line))
+      (setq line
+            (mapcar (lambda (x) (if (equal x ?|)
+                                    (prog1 (if start ?+ ?|) (setq start t))
+                                    (if start ?- ?\ )))
+                    line)))
+    (beginning-of-line (if arg 1 2))
+    (apply 'insert line)
+    (if (equal (char-before (point)) ?+)
+        (progn (backward-delete-char 1) (insert "|")))
+    (insert "\n")
+    (beginning-of-line 0)
+    (move-to-column col)))
+
+(defun org-table-kill-row (&optional arg)
+  "Delete the current row or horizontal line from the table."
+  (interactive "P")
+  (if (not (org-at-table-p))
+      (error "Not at a table"))
+  (let ((col (current-column)))
+    (kill-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
+    (if (not (org-at-table-p)) (beginning-of-line 0))
+    (move-to-column col)))
+
+
+(defun org-table-cut-region (&optional arg)
+  "Copy region in table to the clipboard and blank all relevant fields."
+  (interactive "P")
+  (org-table-copy-region 'cut))
+
+(defvar org-table-clip nil
+  "Clipboard for table regions")
+
+(defun org-table-copy-region (&optional cut)
+  "Copy rectangular region in table to clipboard.
+A special clibbooard is used which can only be accessed
+with `org-table-paste-rectangle'"
+  (interactive "P")
+  (unless (org-region-active-p) (error "No active region"))
+  (let* ((beg (region-beginning))
+         (end (region-end))
+         l01 c01 l02 c02 l1 c1 l2 c2 ic1 ic2
+         region cols
+         (rpl (if cut "  " nil)))
+    (goto-char beg)
+    (org-table-check-inside-data-field)
+    (setq l01 (count-lines (point-min) (point))
+          c01 (org-table-current-column)) 
+    (goto-char end)
+    (org-table-check-inside-data-field)
+    (setq l02 (count-lines (point-min) (point))
+          c02 (org-table-current-column))
+    (setq l1 (min l01 l02) l2 (max l01 l02)
+          c1 (min c01 c02) c2 (max c01 c02))
+    (catch 'exit
+      (while t
+        (catch 'nextline
+          (if (> l1 l2) (throw 'exit t))
+          (goto-line l1)
+          (if (org-at-table-hline-p) (throw 'nextline (setq l1 (1+ l1))))
+          (setq cols nil ic1 c1 ic2 c2)
+          (while (< ic1 (1+ ic2))
+            (push (org-table-get-field ic1 rpl) cols)
+            (setq ic1 (1+ ic1)))
+          (push (nreverse cols) region)
+          (setq l1 (1+ l1)))))
+    (setq org-table-clip (nreverse region))
+    (if cut (org-table-align))))
+  
+(defun org-table-paste-rectangle (&optional arg)
+  "Paste a rectangluar region into a table.
+The upper right corner ends up in the current field.  All involved fields
+will be overwritten.  If the rectangle does not fit into the present table,
+the table is enlarged as needed.  The process ignores horizontal separator
+lines."
+  (interactive "P")
+  (unless (and org-table-clip (listp org-table-clip))
+    (error "First cut/copy a region to paste!"))
+  (org-table-check-inside-data-field)
+  (let* ((clip org-table-clip)
+         (line (count-lines (point-min) (point)))
+         (col (org-table-current-column))
+         (l line)
+         (org-enable-table-editor t)
+         (org-table-automatic-realign nil)
+         c cols field)
+    (while (setq cols (pop clip))
+      (while (org-at-table-hline-p) (beginning-of-line 2))
+      (if (not (org-at-table-p))
+          (progn (end-of-line 0) (org-table-next-field)))
+      (setq c col)
+      (while (setq field (pop cols))
+        (org-table-goto-column c nil 'force)
+        (org-table-get-field nil field)
+        (setq c (1+ c)))
+      (beginning-of-line 2))
+    (goto-line line)
+    (org-table-goto-column col)
+    (org-table-align)))
+
+(defun org-table-convert ()
+  "Convert from org-mode table to table.el and back.
+Obviously, this only works within limits.  When an Org-mode table is
+converted to table.el, all horizontal separator lines get lost, because
+table.el uses these as cell boundaries and has no notion of horizontal lines.
+A table.el table can be converted to an Org-mode table only if it does not
+do row or column spanning.  Multiline cells will become multiple cells.
+Beware, Org-mode does not test if the table can be successfully converted - it
+blindly applies a recipe that works for simple tables."
+  (interactive)
+  (require 'table)
+  (if (org-at-table.el-p)
+      ;; convert to Org-mode table
+      (let ((beg (move-marker (make-marker) (org-table-begin t)))
+            (end (move-marker (make-marker) (org-table-end t))))
+        (table-unrecognize-region beg end)
+        (goto-char beg)
+        (while (re-search-forward "^\\([ \t]*\\)\\+-.*\n" end t)
+          (replace-match ""))
+        (goto-char beg))
+    (if (org-at-table-p)
+        ;; convert to table.el table
+        (let ((beg (move-marker (make-marker) (org-table-begin)))
+              (end (move-marker (make-marker) (org-table-end))))
+          ;; first, get rid of all horizontal lines
+          (goto-char beg)
+          (while (re-search-forward "^\\([ \t]*\\)|-.*\n" end t)
+            (replace-match ""))
+          ;; insert a hline before first
+          (goto-char beg)
+          (org-table-insert-hline 'above)
+          ;; insert a hline after each line
+          (while (progn (beginning-of-line 2) (< (point) end))
+            (org-table-insert-hline))
+          (goto-char beg)
+          (setq end (move-marker end (org-table-end)))
+          ;; replace "+" at beginning and ending of hlines
+          (while (re-search-forward "^\\([ \t]*\\)|-" end t)
+            (replace-match "\\1+-"))
+          (goto-char beg)
+          (while (re-search-forward "-|[ \t]*$" end t)
+            (replace-match "-+"))
+          (goto-char beg)))))
+
+(defun org-table-wrap-region (arg)
+  "Wrap several fields in a column like a paragraph.
+This is useful if you'd like to spread the contents of a field over several
+lines, in order to keep the table compact.
+
+If there is an active region, and both point and mark are in the same column,
+the text in the column is wrapped to minimum width for the given number of
+lines.  Generally, this makes the table more compact.  A prefix ARG may be
+used to change the number of desired lines.  For example, `C-2 C-c C-q'
+formats the selected text to two lines.  If the region was longer than 2
+lines, the remaining lines remain empty.  A negative prefix argument reduces
+the current number of lines by that amount.  The wrapped text is pasted back
+into the table.  If you formatted it to more lines than it was before, fields
+further down in the table get overwritten - so you might need to make space in
+the table first.
+
+If there is no region, the current field is split at the cursor position and
+the text fragment to the right of the cursor is prepended to the field one
+line down.
+
+If there is no region, but you specify a prefix ARG, the current field gets
+blank, and the content is appended to the field above."
+  (interactive "P")
+  (org-table-check-inside-data-field)
+  (if (org-region-active-p)
+      ;; There is a region:  fill as a paragraph
+      (let ((beg (region-beginning))
+            nlines)
+        (org-table-cut-region)
+        (if (> (length (car org-table-clip)) 1)
+            (error "Region must be limited to single columm"))
+        (setq nlines (if arg
+                         (if (< arg 1)
+                             (+ (length org-table-clip) arg)
+                           arg)
+                       (length org-table-clip)))
+        (setq org-table-clip 
+              (mapcar 'list (org-wrap (mapconcat 'car org-table-clip " ")
+                                      nil nlines)))
+        (goto-char beg)
+        (org-table-paste-rectangle))
+    ;; No region, split the current field at point
+    (if arg
+        ;; combine with field above
+        (let ((s (org-table-blank-field))
+              (col (org-table-current-column)))
+          (beginning-of-line 0)
+          (while (org-at-table-hline-p) (beginning-of-line 0))
+          (org-table-goto-column col)
+          (skip-chars-forward "^|")
+          (skip-chars-backward " ")
+          (insert " " (org-trim s))
+          (org-table-align))
+      ;;  split field
+      (when (looking-at "\\([^|]+\\)+|")
+        (let ((s (match-string 1)))
+          (replace-match " |")
+          (goto-char (match-beginning 0))
+          (org-table-next-row)
+          (insert (org-trim s) " ")
+          (org-table-align))))))
+
+(defun org-trim (s)
+  "Remove whitespace at beginning and end of string."
+  (if (string-match "^[ \t]+" s) (setq s (replace-match "" t t s)))
+  (if (string-match "[ \t]+$" s) (setq s (replace-match "" t t s))))
+
+(defun org-wrap (string &optional width lines)
+  "Wrap string to either a number of lines, or a with in characters.
+If WIDTH is non-nil, the string is wrapped to that width, however many lines
+that costs.  If there is a work longer than WIDTH, the text is actually
+wrapped to the length of that word.
+IF WIDTH is nil and LINES is non-nil, the string is forced into at mot that
+many lines, whatever width that takes.
+The return value is a list of lines, without newlines at the end."
+  (let* ((words (org-split-string string "[ \t\n]+"))
+         (maxword (apply 'max (mapcar 'length words)))
+         (black (apply '+ (mapcar 'length words)))
+         (total (+ black (length words)))
+         w ll)
+    (cond (width
+           (org-do-wrap words (max maxword width)))
+          (lines
+           (setq w maxword)
+           (setq ll (org-do-wrap words maxword))
+           (if (<= (length ll) lines)
+               ll
+             (setq ll words)
+             (while (> (length ll) lines)
+               (setq w (1+ w))
+               (setq ll (org-do-wrap words w)))
+             ll))
+          (t (error "Cannot wrap this")))))
+           
+
+(defun org-do-wrap (words width)
+  "Creates lines of maximum width WIDTH (in characters) from word list WORDS."
+  (let (lines line)
+    (while words
+      (setq line (pop words))
+      (while (and words (< (+ (length line) (length (car words))) width))
+        (setq line (concat line " " (pop words))))
+      (setq lines (push line lines)))
+    (nreverse lines)))
+
+;; FIXME: I think I can make this more efficient
+(defun org-split-string (string &optional separators)
+  "Splits STRING into substrings at SEPARATORS.
+No empty strings are returned if there are matches at the beginning
+and end of string."
+  (let ((rexp (or separators "[ \f\t\n\r\v]+"))
+	(start 0)
+	notfirst
+	(list nil))
+    (while (and (string-match rexp string
+			      (if (and notfirst
+				       (= start (match-beginning 0))
+				       (< start (length string)))
+				  (1+ start) start))
+		(< (match-beginning 0) (length string)))
+      (setq notfirst t)
+      (or (eq (match-beginning 0) 0)
+	  (and (eq (match-beginning 0) (match-end 0))
+	       (eq (match-beginning 0) start))
+	  (setq list
+		(cons (substring string start (match-beginning 0))
+		      list)))
+      (setq start (match-end 0)))
+    (or (eq start (length string))
+	(setq list
+	      (cons (substring string start)
+		    list)))
+    (nreverse list)))
+
+(defun org-table-add-invisible-to-vertical-lines ()
+  "Add an `invisible' property to vertical lines of current table."
+  (interactive)
+  (let* ((beg (org-table-begin))
+         (end (org-table-end))
+         (end1))
+    (save-excursion
+      (goto-char beg)
+      (while (< (point) end)
+        (setq end1 (point-at-eol))
+        (if (looking-at org-table-dataline-regexp)
+            (while (re-search-forward "|" end1 t)
+              (add-text-properties (1- (point)) (point)
+                                   '(invisible org-table)))
+          (while (re-search-forward "[+|]" end1 t)
+            (add-text-properties (1- (point)) (point)
+                                 '(invisible org-table))))
+        (beginning-of-line 2)))))
+
+(defun org-table-toggle-vline-visibility (&optional arg)
+  "Toggle the visibility of table vertical lines.
+The effect is immediate and on all tables in the file.
+With prefix ARG, make lines invisible when ARG if positive, make lines
+visible when ARG is not positive"
+  (interactive "P")
+  (let ((action (cond
+                 ((and arg (> (prefix-numeric-value arg) 0)) 'on)
+                 ((and arg (< (prefix-numeric-value arg) 1)) 'off)
+                 (t (if (org-in-invisibility-spec-p '(org-table))
+                        'off
+                      'on)))))
+    (if (eq action 'off)
+        (progn
+          (org-remove-from-invisibility-spec '(org-table))
+          (org-table-map-tables 'org-table-align)
+          (message "Vertical table lines visible")
+          (if (org-at-table-p)
+              (org-table-align)))
+      (org-add-to-invisibility-spec '(org-table))
+      (org-table-map-tables 'org-table-align)
+      (message "Vertical table lines invisible"))
+    (redraw-frame (selected-frame))))
+
+(defun org-table-map-tables (function)
+  "Apply FUNCTION to the start of all tables in the  buffer."
+  (save-excursion
+    (save-restriction
+      (widen)
+      (goto-char (point-min))
+      (while (re-search-forward org-table-any-line-regexp nil t)
+        (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size)))
+        (beginning-of-line 1)
+        (if (looking-at org-table-line-regexp)
+            (save-excursion (funcall function)))
+        (re-search-forward org-table-any-border-regexp nil 1)))))
+
+(defun org-table-sum ()
+  "Sum numbers in region of current table column.
+The result will be displayed in the echo area, and will be available
+as kill to be inserted with \\[yank].
+
+If there is an active region, it is interpreted as a rectangle and all
+numbers in that rectangle will be summed.  If there is no active
+region and point is located in a table column, sum all numbers in that
+column.
+
+If at least on number looks like a time HH:MM or HH:MM:SS, all other
+numbers are assumed to be times as well (in decimal hours) and the
+numbers are added as such."
+  (interactive)
+  (save-excursion
+    (let (beg end col (timecnt 0) diff h m s)
+      (if (org-region-active-p)
+          (setq beg (region-beginning) end (region-end))
+        (setq col (org-table-current-column))
+        (goto-char (org-table-begin))
+        (unless (re-search-forward "^[ \t]*|[^-]" nil t)
+          (error "No table data"))
+        (org-table-goto-column col)
+        (skip-chars-backward "^|")
+        (setq beg (point))
+        (goto-char (org-table-end))
+        (unless (re-search-backward "^[ \t]*|[^-]" nil t)
+          (error "No table data"))
+        (org-table-goto-column col)
+        (skip-chars-forward "^|")
+        (setq end (point)))
+      (let* ((l1 (progn (goto-char beg)
+                        (+ (if (bolp) 1 0) (count-lines (point-min) (point)))))
+             (l2 (progn (goto-char end)
+                        (+ (if (bolp) 1 0) (count-lines (point-min) (point)))))
+             (items (if (= l1 l2)
+                        (split-string (buffer-substring beg end))
+                      (split-string
+                       (mapconcat 'identity (extract-rectangle beg end) " "))))
+             (numbers (delq nil (mapcar 'org-table-get-number-for-summing
+                                        items)))
+             (res (apply '+ numbers))
+             (sres (if (= timecnt 0)
+                       (format "%g" res)
+                     (setq diff (* 3600 res)
+                           h (floor (/ diff 3600)) diff (mod diff 3600)
+                           m (floor (/ diff 60)) diff (mod diff 60)
+                           s diff)
+                     (format "%d:%02d:%02d" h m s))))
+        (kill-new sres)
+        (message (substitute-command-keys
+                  (format "Sum of %d items: %-20s     (\\[yank] will insert result into buffer)"
+                          (length numbers) sres)))))))
+
+(defun org-table-get-number-for-summing (s)
+  (let (n)
+    (if (string-match "^ *|? *" s)
+        (setq s (replace-match "" nil nil s)))
+    (if (string-match " *|? *$" s)
+        (setq s (replace-match "" nil nil s)))
+    (setq n (string-to-number s))
+    (cond
+     ((and (string-match "0" s)
+           (string-match "\\`[-+ \t0.edED]+\\'" s)) 0)
+     ((string-match "\\`[ \t]+\\'" s)         nil)
+     ((string-match "\\`\\([0-9]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?\\'" s)
+      (let ((h (string-to-number (or (match-string 1 s) "0")))
+            (m (string-to-number (or (match-string 2 s) "0")))
+            (s (string-to-number (or (match-string 4 s) "0"))))
+        (if (boundp 'timecnt) (setq timecnt (1+ timecnt)))
+        (* 1.0 (+ h (/ m 60.0) (/ s 3600.0)))))
+     ((equal n 0)                             nil)
+     (t n))))
+
+(defvar org-table-current-formula nil)
+(defvar org-table-formula-history nil)
+(defun org-table-get-formula (current)
+  (if (and current (not (equal "" org-table-current-formula)))
+      org-table-current-formula
+    (setq org-table-current-formula
+          (read-string
+           "Formula [last]: " "" 'org-table-formula-history
+           org-table-current-formula))))
+
+(defun org-this-word ()
+  ;; Get the current word
+  (save-excursion
+    (let ((beg (progn (skip-chars-backward "^ \t\n") (point)))
+          (end (progn (skip-chars-forward "^ \t\n") (point))))
+      (buffer-substring-no-properties beg end))))
+
+(defun org-table-eval-formula (&optional ndown)
+  "Replace the table field value at the cursor by the result of a calculation.
+
+This function makes use of Dave Gillespie's calc package, arguably the most
+exciting program ever written for GNU Emacs.  So you need to have calc
+installed in order to use this function.
+
+In a table, this command replaces the value in the current field with the
+result of a formula.  While nowhere near the computation options of a
+spreadsheet program, this is still very useful.  Note that there is no
+automatic updating of a calculated field, nor will the field remember the
+formula.  The command needs to be applied again after changing input
+fields.
+
+When called, the command first prompts for a formula, which is read in the
+minibuffer.  Previously entered formulae are available through the history
+list, and the last used formula is the default, reachable by simply
+pressing RET.
+
+The formula can be any algebraic expression understood by the calc package.
+Before evaluation, variable substitution takes place: \"$\" is replaced by
+the field the cursor is currently in, and $1..$n reference the fields in
+the current row.  Values from a *different* row can *not* be referenced
+here, so the command supports only horizontal computing.  The formula can
+contain an optional printf format specifier after a semicolon, to reformat
+the result.
+
+A few examples for formulae:
+  $1+$2               Sum of first and second field
+  $1+$2;%f.2          Same, and format result to two digits after dec.point
+  exp($2)+exp($1)     Math functions can be used
+  $;%f.1              Reformat current cell to 1 digit after dec.point
+  ($3-32)*5/9         degrees F -> C conversion
+
+When called with a raw C-u prefix, the formula is applied to the current
+field, and to the same same column in all following rows, until reaching a
+horizontal line or the end of the table.  When the command is called with a
+numeric prefix argument (like M-3 or C-7 or C-u 24), the formula is applied
+to the current row, and to the following n-1 rows (but not beyond a
+separator line)."
+  (interactive "P")
+  (setq ndown (if (equal ndown '(4)) 10000 (prefix-numeric-value ndown)))
+  (require 'calc)
+  (org-table-check-inside-data-field)
+  (let* (fields
+         (org-table-automatic-realign nil)
+         (down (> ndown 1))
+         (formula (org-table-get-formula nil))
+         (n0 (org-table-current-column))
+         n form fmt x ev)
+    (if (string-match ";" formula)
+        (let ((tmp (org-split-string formula ";")))
+          (setq formula (car tmp) fmt (nth 1 tmp))))
+    (while (> ndown 0)
+      (setq fields (org-split-string
+                    (concat " " (buffer-substring
+                                 (point-at-bol) (point-at-eol))) "|"))
+      (setq ndown (1- ndown))
+      (setq form (copy-sequence formula))
+      (while (string-match "\\$\\([0-9]+\\)?" form)
+        (setq n (if (match-beginning 1)
+                    (string-to-int (match-string 1 form))
+                  n0)
+              x (nth n fields))
+        (unless x (error "Illegal field specifier \"%s\""
+                         (match-string 0 form)))
+        (if (equal (string-to-number x) 0) (setq x "0"))
+        (setq form (replace-match x t t form)))
+      (setq ev (calc-eval (list form) 'num))
+      (if (listp ev)
+          (error "Illegal expression: %s (%s at %d)" form (nth 1 ev) (car ev)))
+      (org-table-blank-field)
+      (if fmt
+          (insert (format fmt (string-to-number ev)))
+        (insert ev))
+      (if (and down (> ndown 0) (looking-at ".*\n[ \t]*|[^-]"))
+          (call-interactively 'org-return)
+        (setq ndown 0)))
+    (org-table-align)))
+
+;;; Exporting
+
+(defconst org-level-max 20)
+
+(defun org-export-find-first-heading-line (list)
+  "Remove all lines from LIST which are before  the first headline."
+  (let ((orig-list list)
+        (re (concat "^" outline-regexp)))
+    (while (and list
+                (not (string-match re (car list))))
+      (pop list))
+    (or list orig-list)))
+
+(defun org-skip-comments (lines)
+  "Skip lines starting with \"#\" and subtrees starting with COMMENT."
+  (let ((re1 (concat "^\\(\\*+\\)[ \t]+" org-comment-string))
+        (re2 "^\\(\\*+\\)[ \t\n\r]")
+        rtn line level)
+    (while (setq line (pop lines))
+      (cond
+       ((and (string-match re1 line)
+             (setq level (- (match-end 1) (match-beginning 1))))
+        ;; Beginning of a COMMENT subtree.  Skip it.
+        (while (and (setq line (pop lines))
+                    (or (not (string-match re2 line))
+                        (> (- (match-end 1) (match-beginning 1)) level))))
+        (setq lines (cons line lines)))
+       ((string-match "^#" line)
+        ;; an ordinary comment line
+        )
+       (t (setq rtn (cons line rtn)))))
+    (nreverse rtn)))
+
+;; ASCII
+
+(defconst org-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-)
+  "Characters for underlining headings in ASCII export.")
+
+(defconst org-html-entities
+  '(("nbsp")
+    ("iexcl")
+    ("cent")
+    ("pound")
+    ("curren")
+    ("yen")
+    ("brvbar")
+    ("sect")
+    ("uml")
+    ("copy")
+    ("ordf")
+    ("laquo")
+    ("not")
+    ("shy")
+    ("reg")
+    ("macr")
+    ("deg")
+    ("plusmn")
+    ("sup2")
+    ("sup3")
+    ("acute")
+    ("micro")
+    ("para")
+    ("middot")
+    ("odot"."o")
+    ("star"."*")
+    ("cedil")
+    ("sup1")
+    ("ordm")
+    ("raquo")
+    ("frac14")
+    ("frac12")
+    ("frac34")
+    ("iquest")
+    ("Agrave")
+    ("Aacute")
+    ("Acirc")
+    ("Atilde")
+    ("Auml")
+    ("Aring") ("AA"."&Aring;")
+    ("AElig")
+    ("Ccedil")
+    ("Egrave")
+    ("Eacute")
+    ("Ecirc")
+    ("Euml")
+    ("Igrave")
+    ("Iacute")
+    ("Icirc")
+    ("Iuml")
+    ("ETH")
+    ("Ntilde")
+    ("Ograve")
+    ("Oacute")
+    ("Ocirc")
+    ("Otilde")
+    ("Ouml")
+    ("times")
+    ("Oslash")
+    ("Ugrave")
+    ("Uacute")
+    ("Ucirc")
+    ("Uuml")
+    ("Yacute")
+    ("THORN")
+    ("szlig")
+    ("agrave")
+    ("aacute")
+    ("acirc")
+    ("atilde")
+    ("auml")
+    ("aring")
+    ("aelig")
+    ("ccedil")
+    ("egrave")
+    ("eacute")
+    ("ecirc")
+    ("euml")
+    ("igrave")
+    ("iacute")
+    ("icirc")
+    ("iuml")
+    ("eth")
+    ("ntilde")
+    ("ograve")
+    ("oacute")
+    ("ocirc")
+    ("otilde")
+    ("ouml")
+    ("divide")
+    ("oslash")
+    ("ugrave")
+    ("uacute")
+    ("ucirc")
+    ("uuml")
+    ("yacute")
+    ("thorn")
+    ("yuml")
+    ("fnof")
+    ("Alpha")
+    ("Beta")
+    ("Gamma")
+    ("Delta")
+    ("Epsilon")
+    ("Zeta")
+    ("Eta")
+    ("Theta")
+    ("Iota")
+    ("Kappa")
+    ("Lambda")
+    ("Mu")
+    ("Nu")
+    ("Xi")
+    ("Omicron")
+    ("Pi")
+    ("Rho")
+    ("Sigma")
+    ("Tau")
+    ("Upsilon")
+    ("Phi")
+    ("Chi")
+    ("Psi")
+    ("Omega")
+    ("alpha")
+    ("beta")
+    ("gamma")
+    ("delta")
+    ("epsilon")
+    ("varepsilon"."&epsilon;")
+    ("zeta")
+    ("eta")
+    ("theta")
+    ("iota")
+    ("kappa")
+    ("lambda")
+    ("mu")
+    ("nu")
+    ("xi")
+    ("omicron")
+    ("pi")
+    ("rho")
+    ("sigmaf") ("varsigma"."&sigmaf;")
+    ("sigma")
+    ("tau")
+    ("upsilon")
+    ("phi")
+    ("chi")
+    ("psi")
+    ("omega")
+    ("thetasym") ("vartheta"."&thetasym;")
+    ("upsih")
+    ("piv")
+    ("bull") ("bullet"."&bull;")
+    ("hellip") ("dots"."&hellip;")
+    ("prime")
+    ("Prime")
+    ("oline")
+    ("frasl")
+    ("weierp")
+    ("image")
+    ("real")
+    ("trade")
+    ("alefsym")
+    ("larr") ("leftarrow"."&larr;") ("gets"."&larr;")
+    ("uarr") ("uparrow"."&uarr;")
+    ("rarr") ("to"."&rarr;") ("rightarrow"."&rarr;")
+    ("darr")("downarrow"."&darr;")
+    ("harr") ("leftrightarrow"."&harr;")
+    ("crarr") ("hookleftarrow"."&crarr;") ; has round hook, not quite CR
+    ("lArr") ("Leftarrow"."&lArr;")
+    ("uArr") ("Uparrow"."&uArr;")
+    ("rArr") ("Rightarrow"."&rArr;")
+    ("dArr") ("Downarrow"."&dArr;")
+    ("hArr") ("Leftrightarrow"."&hArr;")
+    ("forall")
+    ("part") ("partial"."&part;")
+    ("exist") ("exists"."&exist;")
+    ("empty") ("emptyset"."&empty;")
+    ("nabla")
+    ("isin") ("in"."&isin;")
+    ("notin")
+    ("ni")
+    ("prod")
+    ("sum")
+    ("minus")
+    ("lowast") ("ast"."&lowast;")
+    ("radic")
+    ("prop") ("proptp"."&prop;")
+    ("infin") ("infty"."&infin;")
+    ("ang") ("angle"."&ang;")
+    ("and") ("vee"."&and;")
+    ("or") ("wedge"."&or;")
+    ("cap")
+    ("cup")
+    ("int")
+    ("there4")
+    ("sim")
+    ("cong") ("simeq"."&cong;")
+    ("asymp")("approx"."&asymp;")
+    ("ne") ("neq"."&ne;")
+    ("equiv")
+    ("le")
+    ("ge")
+    ("sub") ("subset"."&sub;")
+    ("sup") ("supset"."&sup;")
+    ("nsub")
+    ("sube")
+    ("supe")
+    ("oplus")
+    ("otimes")
+    ("perp")
+    ("sdot") ("cdot"."&sdot;")
+    ("lceil")
+    ("rceil")
+    ("lfloor")
+    ("rfloor")
+    ("lang")
+    ("rang")
+    ("loz") ("Diamond"."&loz;")
+    ("spades") ("spadesuit"."&spades;")
+    ("clubs") ("clubsuit"."&clubs;")
+    ("hearts") ("diamondsuit"."&hearts;")
+    ("diams") ("diamondsuit"."&diams;")
+    ("quot")
+    ("amp")
+    ("lt")
+    ("gt")
+    ("OElig")
+    ("oelig")
+    ("Scaron")
+    ("scaron")
+    ("Yuml")
+    ("circ")
+    ("tilde")
+    ("ensp")
+    ("emsp")
+    ("thinsp")
+    ("zwnj")
+    ("zwj")
+    ("lrm")
+    ("rlm")
+    ("ndash")
+    ("mdash")
+    ("lsquo")
+    ("rsquo")
+    ("sbquo")
+    ("ldquo")
+    ("rdquo")
+    ("bdquo")
+    ("dagger")
+    ("Dagger")
+    ("permil")
+    ("lsaquo")
+    ("rsaquo")
+    ("euro")
+
+    ("arccos"."arccos")
+    ("arcsin"."arcsin")
+    ("arctan"."arctan")
+    ("arg"."arg")
+    ("cos"."cos")
+    ("cosh"."cosh")
+    ("cot"."cot")
+    ("coth"."coth")
+    ("csc"."csc")
+    ("deg"."deg")
+    ("det"."det")
+    ("dim"."dim")
+    ("exp"."exp")
+    ("gcd"."gcd")
+    ("hom"."hom")
+    ("inf"."inf")
+    ("ker"."ker")
+    ("lg"."lg")
+    ("lim"."lim")
+    ("liminf"."liminf")
+    ("limsup"."limsup")
+    ("ln"."ln")
+    ("log"."log")
+    ("max"."max")
+    ("min"."min")
+    ("Pr"."Pr")
+    ("sec"."sec")
+    ("sin"."sin")
+    ("sinh"."sinh")
+    ("sup"."sup")
+    ("tan"."tan")
+    ("tanh"."tanh")
+    )
+  "Entities for TeX->HTML translation.
+Entries can be like (\"ent\"), in which case \"\\ent\" will be translated to
+\"&ent;\".  An entry can also be a dotted pair like (\"ent\".\"&other;\").
+In that case, \"\\ent\" will be translated to \"&other;\".
+The list contains HTML entities for Latin-1, Greek and other symbols.
+It is supplemented by a number of commonly used TeX macros with appropriate
+translations.")
+
+(defun org-export-as-ascii (arg)
+  "Export the outline as a pretty ASCII file.
+If there is an active region, export only the region.
+The prefix ARG specifies how many levels of the outline should become
+underlined headlines.  The default is 3."
+  (interactive "P")
+  (setq-default org-todo-line-regexp org-todo-line-regexp)
+  (let* ((region
+          (buffer-substring
+           (if (org-region-active-p) (region-beginning) (point-min))
+           (if (org-region-active-p) (region-end) (point-max))))
+         (lines (org-export-find-first-heading-line
+                 (org-skip-comments (org-split-string region "[\r\n]"))))
+         (org-startup-with-deadline-check nil)
+         (level 0) line txt
+         (umax nil)
+         (case-fold-search nil)
+         (filename (concat (file-name-sans-extension (buffer-file-name))
+                           ".txt"))
+         (buffer (find-file-noselect filename))
+         (levels-open (make-vector org-level-max nil))
+	 (date  (format-time-string "%Y/%m/%d" (current-time)))
+	 (time  (format-time-string "%X" (current-time)))
+         (author      user-full-name)
+	 (title       (buffer-name))
+         (options     nil)
+	 (email       user-mail-address)
+         (language    org-export-default-language)
+	 (text        nil)
+         (last-level  1)
+         (todo nil)
+         (lang-words nil))
+
+    (org-init-section-numbers)
+
+    (find-file-noselect filename)
+
+    ;; Search for the export key lines
+    (org-parse-key-lines)
+
+    (setq lang-words (or (assoc language org-export-language-setup)
+                         (assoc "en" org-export-language-setup)))
+    (if org-export-ascii-show-new-buffer
+	(switch-to-buffer-other-window buffer)
+      (set-buffer buffer))
+    (erase-buffer)
+    (fundamental-mode)
+    (if options (org-parse-export-options options))
+    (setq umax (if arg (prefix-numeric-value arg)
+                 org-export-headline-levels))
+
+    ;; File header
+    (if title (org-insert-centered title ?=))
+    (insert "\n")
+    (if (or author email)
+        (insert (concat (nth 1 lang-words) ": " (or author "")
+                        (if email (concat " <" email ">") "")
+                        "\n")))
+    (if (and date time)
+        (insert (concat (nth 2 lang-words) ": " date " " time "\n")))
+    (if text (insert (concat (org-html-expand-for-ascii text) "\n\n")))
+
+    (insert "\n\n")
+
+    (if org-export-with-toc
+        (progn
+          (insert (nth 3 lang-words) "\n"
+                  (make-string (length (nth 3 lang-words)) ?=) "\n")
+          (mapcar '(lambda (line)
+		     (if (string-match org-todo-line-regexp
+                                       line)
+			 ;; This is a headline
+			 (progn
+			   (setq level (- (match-end 1) (match-beginning 1))
+				 txt (match-string 3 line)
+                                 todo
+                                 (or (and (match-beginning 2)
+                                          (not (equal (match-string 2 line)
+                                                      org-done-string)))
+                                        ; TODO, not DONE
+                                     (and (= level umax)
+                                          (org-search-todo-below
+                                           line lines level))))
+                           (setq txt (org-html-expand-for-ascii txt))
+
+                           (if org-export-with-section-numbers
+                               (setq txt (concat (org-section-number level)
+                                                 " " txt)))
+			   (if (<= level umax)
+			       (progn
+				 (insert
+                                  (make-string (* (1- level) 4) ?\ )
+				  (format (if todo "%s (*)\n" "%s\n") txt))
+				 (setq last-level level))
+			     ))))
+		  lines)))
+
+    (org-init-section-numbers)
+    (while (setq line (pop lines))
+      ;; Remove the quoted HTML tags.
+      (setq line (org-html-expand-for-ascii line))
+      (cond
+       ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
+        ;; a Headline
+        (setq level (- (match-end 1) (match-beginning 1))
+              txt (match-string 2 line))
+        (org-ascii-level-start level txt umax))
+       (t (insert line "\n"))))
+    (normal-mode)
+    (save-buffer)
+    (goto-char (point-min))))
+
+(defun org-search-todo-below (line lines level)
+  "Search the subtree below LINE for any TODO entries."
+  (let ((rest (cdr (memq line lines)))
+        (re org-todo-line-regexp)
+        line lv todo)
+    (catch 'exit
+      (while (setq line (pop rest))
+        (if (string-match re line)
+            (progn
+              (setq lv (- (match-end 1) (match-beginning 1))
+                    todo (and (match-beginning 2)
+                              (not (equal (match-string 2 line)
+                                          org-done-string))))
+                                        ; TODO, not DONE
+              (if (<= lv level) (throw 'exit nil))
+              (if todo (throw 'exit t))))))))
+
+;; FIXME: Try to handle <b> and <i> as faces via text properties.
+;; FIXME: Can I implement *bold*,/italic/ and _underline_ for AXCII export?
+(defun org-html-expand-for-ascii (line)
+  "Handle quoted HTML for ASCII export."
+  (if org-export-html-expand
+      (while (string-match "@<[^<>\n]*>" line)
+        ;; We just remove the tags for now.
+        (setq line (replace-match "" nil nil line))))
+  line)
+
+(defun org-insert-centered (s &optional underline)
+  "Insert the string S centered and underline it with character UNDERLINE."
+  (let ((ind (max (/ (- 80 (length s)) 2) 0)))
+    (insert (make-string ind ?\ ) s "\n")
+    (if underline
+        (insert (make-string ind ?\ )
+                (make-string (length s) underline)
+                "\n"))))
+
+(defun org-ascii-level-start (level title umax)
+  "Insert a new level in ASCII export."
+  (let (char)
+    (if (> level umax)
+        (insert (make-string (* 2 (- level umax 1)) ?\ ) "* " title "\n")
+      (if (or (not (equal (char-before) ?\n))
+              (not (equal (char-before (1- (point))) ?\n)))
+          (insert "\n"))
+      (setq char (nth (- umax level) (reverse org-ascii-underline)))
+      (if org-export-with-section-numbers
+          (setq title (concat (org-section-number level) " " title)))
+      (insert title "\n" (make-string (length title) char) "\n"))))
+
+;; HTML
+
+(defun org-get-current-options ()
+  "Return a string with current options as keyword options.
+Does include HTML export options as well as TODO and CATEGORY stuff."
+  (format
+   "#+TITLE:     %s
+#+AUTHOR:    %s
+#+EMAIL:     %s
+#+LANGUAGE:  %s
+#+TEXT:      Some descriptive text to be emitted.  Several lines OK.
+#+OPTIONS:   H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s *:%s TeX:%s
+#+CATEGORY:  %s
+#+SEQ_TODO:  %s
+#+TYP_TODO:  %s
+"
+   (buffer-name) (user-full-name) user-mail-address org-export-default-language
+   org-export-headline-levels
+   org-export-with-section-numbers
+   org-export-with-toc
+   org-export-preserve-breaks
+   org-export-html-expand
+   org-export-with-fixed-width
+   org-export-with-tables
+   org-export-with-sub-superscripts
+   org-export-with-emphasize
+   org-export-with-TeX-macros
+   (file-name-nondirectory (buffer-file-name))
+   (if (equal org-todo-interpretation 'sequence)
+       (mapconcat 'identity org-todo-keywords " ")
+     "TODO FEEDBACK VERIFY DONE")
+   (if (equal org-todo-interpretation 'type)
+       (mapconcat 'identity org-todo-keywords " ")
+     "Me Jason Marie DONE")))
+
+(defun org-insert-export-options-template ()
+  "Insert into the buffer a template with information for exporting."
+  (interactive)
+  (if (not (bolp)) (newline))
+  (let ((s (org-get-current-options)))
+    (and (string-match "#\\+CATEGORY" s)
+         (setq s (substring s 0 (match-beginning 0))))
+    (insert s)))
+
+(defun org-toggle-fixed-width-section (arg)
+  "Toggle the fixed-width indicator at the beginning of lines in the region.
+If there is no active region, only acts on the current line.
+If the first non-white  character in the first line of the region is a
+vertical bar \"|\", then the command removes the bar from all lines in
+the region.  If the first character is not a bar, the command adds a
+bar to all lines, in the column given by the beginning of the region.
+
+If there is a numerical prefix ARG, create ARG new lines starting with \"|\"."
+  (interactive "P")
+  (let* ((cc 0)
+         (regionp (org-region-active-p))
+         (beg (if regionp (region-beginning) (point)))
+         (end (if regionp (region-end)))
+         (nlines (or arg (if (and beg end) (count-lines beg end) 1)))
+         (re "[ \t]*\\(:\\)")
+         off)
+    (save-excursion
+      (goto-char beg)
+      (setq cc (current-column))
+      (beginning-of-line 1)
+      (setq off (looking-at re))
+      (while (> nlines 0)
+        (setq nlines (1- nlines))
+        (beginning-of-line 1)
+        (cond
+         (arg
+          (move-to-column cc t)
+          (insert ":\n")
+          (forward-line -1))
+         ((and off (looking-at re))
+          (replace-match "" t t nil 1))
+         ((not off) (move-to-column cc t) (insert ":")))
+        (forward-line 1)))))
+
+(defun org-export-as-html-and-open (arg)
+  "Export the outline as HTML and immediately open it with a browser.
+If there is an active region, export only the region.
+The prefix ARG specifies how many levels of the outline should become
+headlines.  The default is 3.  Lower levels will become bulleted lists."
+  (interactive "P")
+  (org-export-as-html arg 'hidden)
+  (org-open-file (buffer-file-name)))
+
+(defun org-export-as-html-batch ()
+  "Call org-export-as-html, may be used in batch processing as
+emacs 	--batch
+	--load=$HOME/lib/emacs/org.el
+	--eval \"(setq org-export-headline-levels 2)\"
+	--visit=MyFile --funcall org-export-as-html-batch"
+  (org-export-as-html org-export-headline-levels 'hidden))
+
+(defun org-export-as-html (arg &optional hidden)
+  "Export the outline as a pretty HTML file.
+If there is an active region, export only the region.
+The prefix ARG specifies how many levels of the outline should become
+headlines.  The default is 3.  Lower levels will become bulleted lists."
+  (interactive "P")
+  (setq-default org-todo-line-regexp org-todo-line-regexp)
+  (setq-default org-deadline-line-regexp org-deadline-line-regexp)
+  (setq-default org-done-string org-done-string)
+  (let* ((region-p (org-region-active-p))
+         (region
+          (buffer-substring
+           (if region-p (region-beginning) (point-min))
+           (if region-p (region-end) (point-max))))
+         (all_lines
+          (org-skip-comments (org-split-string region "[\r\n]")))
+         (lines (org-export-find-first-heading-line all_lines))
+         (level 0) (line "") (origline "") txt todo
+	 (last-level 1)
+         (umax nil)
+         (filename (concat (file-name-sans-extension (buffer-file-name))
+                           ".html"))
+         (buffer (find-file-noselect filename))
+         (levels-open (make-vector org-level-max nil))
+	 (date  (format-time-string "%Y/%m/%d" (current-time)))
+	 (time  (format-time-string "%X" (current-time)))
+         (author      user-full-name)
+	 (title       (buffer-name))
+         (options     nil)
+	 (email       user-mail-address)
+         (language    org-export-default-language)
+	 (text        nil)
+         (lang-words  nil)
+	 (head-count  0) cnt
+         table-open type
+         table-buffer table-orig-buffer
+	 )
+    (message "Exporting...")
+
+    (org-init-section-numbers)
+
+    ;; Search for the export key lines
+    (org-parse-key-lines)
+    (setq lang-words (or (assoc language org-export-language-setup)
+                         (assoc "en" org-export-language-setup)))
+
+    ;; Switch to the output buffer
+    (if (or hidden (not org-export-html-show-new-buffer))
+        (set-buffer buffer)
+      (switch-to-buffer-other-window buffer))
+    (erase-buffer)
+    (fundamental-mode)
+    (let ((case-fold-search nil))
+      (if options (org-parse-export-options options))
+      (setq umax (if arg (prefix-numeric-value arg)
+                   org-export-headline-levels))
+
+      ;; File header
+      (insert (format
+               "<html lang=\"%s\"><head>
+<title>%s</title>
+<meta http-equiv=\"Content-Type\" content=\"text/html\">
+<meta name=generator content=\"Org-mode\">
+<meta name=generated content=\"%s %s\">
+<meta name=author content=\"%s\">
+</head><body>
+"
+         language (org-html-expand title) date time author))
+      (if title     (insert (concat "<H1 align=\"center\">"
+                                    (org-html-expand title) "</H1>\n")))
+      (if author    (insert (concat (nth 1 lang-words) ": " author "\n")))
+      (if email	  (insert (concat "<a href=\"mailto:" email "\">&lt;"
+                                  email "&gt;</a>\n")))
+      (if (or author email) (insert "<br>\n"))
+      (if (and date time) (insert (concat (nth 2 lang-words) ": "
+                                          date " " time "<br>\n")))
+      (if text      (insert (concat "<p>\n" (org-html-expand text))))
+      (if org-export-with-toc
+          (progn
+            (insert (format "<H2>%s</H2>\n" (nth 3 lang-words)))
+            (insert "<ul>\n")
+            (mapcar '(lambda (line)
+                       (if (string-match org-todo-line-regexp line)
+                           ;; This is a headline
+                           (progn
+                             (setq level (- (match-end 1) (match-beginning 1))
+                                   txt (save-match-data 
+                                         (org-html-expand
+                                          (match-string 3 line)))
+                                   todo
+                                   (or (and (match-beginning 2)
+                                            (not (equal (match-string 2 line)
+                                                        org-done-string)))
+                                        ; TODO, not DONE
+                                       (and (= level umax)
+                                            (org-search-todo-below
+                                             line lines level))))
+                             (if org-export-with-section-numbers
+                                 (setq txt (concat (org-section-number level)
+                                                   " " txt)))
+                             (if (<= level umax)
+                                 (progn
+                                   (setq head-count (+ head-count 1))
+                                   (if (> level last-level)
+                                       (progn
+                                         (setq cnt (- level last-level))
+                                         (while (>= (setq cnt (1- cnt)) 0)
+                                           (insert "<ul>"))
+                                         (insert "\n")))
+                                   (if (< level last-level)
+                                       (progn
+                                         (setq cnt (- last-level level))
+                                         (while (>= (setq cnt (1- cnt)) 0)
+                                           (insert "</ul>"))
+                                         (insert "\n")))
+                                   (insert
+                                    (format
+                                     (if todo
+                                         "<li><a href=\"#sec-%d\"><span style='color:red'>%s</span></a></li>\n"
+                                       "<li><a href=\"#sec-%d\">%s</a></li>\n")
+                                     head-count txt))
+                                   (setq last-level level))
+                               ))))
+                    lines)
+            (while (> last-level 0)
+              (setq last-level (1- last-level))
+              (insert "</ul>\n"))
+            ))
+      (setq head-count 0)
+      (org-init-section-numbers)
+
+      (while (setq line (pop lines) origline line)
+        ;; replace "<" and ">" by "&lt;" and "&gt;"
+        ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
+        (setq line (org-html-expand line))
+
+        ;; Verbatim lines
+        (if (and org-export-with-fixed-width
+                 (string-match "^[ \t]*:\\(.*\\)" line))
+            (progn
+              (let ((l (match-string 1 line)))
+                (while (string-match " " l)
+                  (setq l (replace-match "&nbsp;" t t l)))
+                (insert "\n<span style='font-family:Courier'>"
+                        l "</span>"
+                        (if (and lines
+                                 (not (string-match "^[ \t]+\\(:.*\\)"
+                                                    (car lines))))
+                            "<br>\n" "\n"))))
+
+          (when (string-match org-link-regexp line)
+            (setq type (match-string 1 line))
+            (cond
+             ((member type '("http" "https" "ftp" "mailto" "news"))
+              ;; standard URL
+              (setq line (replace-match
+                          "<a href=\"\\1:\\2\">&lt;\\1:\\2&gt;</a>"
+                          nil nil line)))
+             ((string= type "file")
+              ;; FILE link
+
+	      (let* ((filename (match-string 2 line))
+		     (file-is-image-p
+		      (save-match-data
+			(string-match (org-image-file-name-regexp) filename))))
+		(setq line (replace-match
+			    (if (and org-export-html-inline-images
+                                     file-is-image-p)
+                                "<img src=\"\\2\"/>"
+			      "<a href=\"\\2\">\\1:\\2</a>")
+                            nil nil line))))
+
+             ((member type '("bbdb" "vm" "wl" "rmail" "gnus" "shell"))
+              (setq line (replace-match
+                          "<i>&lt;\\1:\\2&gt;</i>" nil nil line)))))
+
+          ;; TODO items
+          (if (and (string-match org-todo-line-regexp line)
+                   (match-beginning 2))
+              (if (equal (match-string 2 line) org-done-string)
+                  (setq line (replace-match
+                              "<span style='color:green'>\\2</span>"
+                              nil nil line 2))
+                (setq line (replace-match "<span style='color:red'>\\2</span>"
+                                          nil nil line 2))))
+
+          ;; DEADLINES
+          (if (string-match org-deadline-line-regexp line)
+              (progn
+              (if (save-match-data
+                    (string-match "<a href"
+                                  (substring line 0 (match-beginning 0))))
+                  nil  ; Don't do the replacement - it is inside a link
+                (setq line (replace-match "<span style='color:red'>\\&</span>"
+                                          nil nil line 1)))))
+
+          (cond
+           ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
+            ;; This is a headline
+            (setq level (- (match-end 1) (match-beginning 1))
+                  txt (match-string 2 line))
+            (if (<= level umax) (setq head-count (+ head-count 1)))
+            (org-html-level-start level txt umax
+                                  (and org-export-with-toc (<= level umax))
+                                  head-count))
+
+           ((and org-export-with-tables
+                 (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)" line))
+            (if (not table-open)
+                ;; New table starts
+                (setq table-open t table-buffer nil table-orig-buffer nil))
+            ;; Accumulate lines
+            (setq table-buffer (cons line table-buffer)
+                  table-orig-buffer (cons origline table-orig-buffer))
+            (when (or (not lines)
+                      (not (string-match "^\\([ \t]*\\)\\(|\\|\\+-+\\+\\)"
+                                         (car lines))))
+              (setq table-open nil
+                    table-buffer (nreverse table-buffer)
+                    table-orig-buffer (nreverse table-orig-buffer))
+              (insert (org-format-table-html table-buffer table-orig-buffer))))
+           (t
+            ;; Normal lines
+            ;; Lines starting with "-", and empty lines make new paragraph.
+            (if (string-match "^ *-\\|^[ \t]*$" line) (insert "<p>"))
+            (insert line (if org-export-preserve-breaks "<br>\n" "\n"))))
+          ))
+      (if org-export-html-with-timestamp
+          (insert org-export-html-html-helper-timestamp))
+      (insert "</body>\n</html>\n")
+      (normal-mode)
+      (save-buffer)
+      (goto-char (point-min)))))
+
+(defun org-format-table-html (lines olines)
+  "Find out which HTML converter to use and return the HTML code."
+  (if (string-match "^[ \t]*|" (car lines))
+      ;; A normal org table
+      (org-format-org-table-html lines)
+    ;; Table made by table.el - test for spanning
+    (let* ((hlines (delq nil (mapcar
+                              (lambda (x)
+                                (if (string-match "^[ \t]*\\+-" x) x
+                                  nil))
+                              lines)))
+           (first (car hlines))
+           (ll (and (string-match "\\S-+" first)
+                    (match-string 0 first)))
+           (re (concat "^[ \t]*" (regexp-quote ll)))
+           (spanning (delq nil (mapcar (lambda (x) (not (string-match re x)))
+                                       hlines))))
+      (if (and (not spanning)
+               (not org-export-prefer-native-exporter-for-tables))
+          ;; We can use my own converter with HTML conversions
+          (org-format-table-table-html lines)
+        ;; Need to use the code generator in table.el, with the original text.
+        (org-format-table-table-html-using-table-generate-source olines)))))
+
+(defun org-format-org-table-html (lines)
+  "Format a table into html."
+  (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
+  (setq lines (nreverse lines))
+  (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
+  (setq lines (nreverse lines))
+  (let ((head (and org-export-highlight-first-table-line
+                   (delq nil (mapcar
+                              (lambda (x) (string-match "^[ \t]*|-" x))
+                              lines))))
+        lastline line fields html empty)
+    (setq html (concat org-export-html-table-tag "\n"))
+    (while (setq lastline line
+                 line (pop lines))
+      (setq empty "&nbsp")
+      (catch 'next-line
+        (if (string-match "^[ \t]*|-" line)
+            (if lastline
+                ;; A hline: simulate an empty table row instead.
+                (setq line (org-fake-empty-table-line lastline)
+                      head nil
+                      empty "")
+              ;; Ignore this line
+              (throw 'next-line t)))
+        ;; Break the line into fields
+        (setq fields (org-split-string line "[ \t]*|[ \t]*"))
+        (setq html (concat
+                    html
+                    "<tr>"
+                    (mapconcat (lambda (x)
+                                 (if (equal x "") (setq x empty))
+                                 (if head
+                                     (concat "<th>" x "</th>")
+                                   (concat "<td valign=\"top\">" x "</td>")))
+                               fields "")
+                    "</tr>\n"))))
+    (setq html (concat html "</table>\n"))
+    html))
+
+(defun org-fake-empty-table-line (line)
+  "Replace everything except \"|\" with spaces."
+  (let ((i (length line))
+	(newstr (copy-sequence line)))
+    (while (> i 0)
+      (setq i (1- i))
+      (if (not (eq (aref newstr i) ?|))
+	  (aset newstr i ?\ )))
+    newstr))
+
+(defun org-format-table-table-html (lines)
+  "Format a table generated by table.el into html.
+This conversion does *not* use `table-generate-source' from table.el.
+This has the advantage that Org-mode's HTML conversions can be used.
+But it has the disadvantage, that no cell- or row-spanning is allowed."
+  (let (line field-buffer
+             (head org-export-highlight-first-table-line)
+             fields html empty)
+    (setq html (concat org-export-html-table-tag "\n"))
+    (while (setq line (pop lines))
+      (setq empty "&nbsp")
+      (catch 'next-line
+        (if (string-match "^[ \t]*\\+-" line)
+            (progn
+              (if field-buffer
+                  (progn
+                    (setq html (concat
+                                html
+                                "<tr>"
+                                (mapconcat
+                                 (lambda (x)
+                                   (if (equal x "") (setq x empty))
+                                   (if head
+                                       (concat "<th valign=\"top\">" x
+                                               "</th>\n")
+                                     (concat "<td valign=\"top\">" x
+                                             "</td>\n")))
+                                 field-buffer "\n")
+                                "</tr>\n"))
+                    (setq head nil)
+                    (setq field-buffer nil)))
+              ;; Ignore this line
+              (throw 'next-line t)))
+        ;; Break the line into fields and store the fields
+        (setq fields (org-split-string line "[ \t]*|[ \t]*"))
+        (if field-buffer
+            (setq field-buffer (mapcar
+                                (lambda (x)
+                                  (concat x "<br>" (pop fields)))
+                                field-buffer))
+          (setq field-buffer fields))))
+    (setq html (concat html "</table>\n"))
+    html))
+
+(defun org-format-table-table-html-using-table-generate-source (lines)
+  "Format a table into html, using `table-generate-source' from table.el.
+This has the advantage that cell- or row-spanning is allowed.
+But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
+  (require 'table)
+  (save-excursion
+    (set-buffer (get-buffer-create " org-tmp1 "))
+    (erase-buffer)
+    (insert (mapconcat 'identity lines "\n"))
+    (goto-char (point-min))
+    (if (not (re-search-forward "|[^+]" nil t))
+        (error "Error processing table."))
+    (table-recognize-table)
+    (save-excursion
+      (set-buffer (get-buffer-create " org-tmp2 "))
+      (erase-buffer))
+    (table-generate-source 'html " org-tmp2 ")
+    (set-buffer " org-tmp2 ")
+    (buffer-substring (point-min) (point-max))))
+
+(defun org-html-expand (string)
+  "Prepare STRING for HTML export. Applies all active conversions."
+  ;; First check if there is a link in the line - if yes, apply conversions
+  ;; only before the start of the link.
+  (let* ((m (string-match org-link-regexp string))
+         (s (if m (substring string 0 m) string))
+         (r (if m (substring string m) "")))
+    ;; convert < to &lt; and > to &gt;
+    (while (string-match "<" s)
+      (setq s (replace-match "&lt;" nil nil s)))
+    (while (string-match ">" s)
+      (setq s (replace-match "&gt;" nil nil s)))
+    (if org-export-html-expand
+        (while (string-match "@&lt;\\([^&]*\\)&gt;" s)
+          (setq s (replace-match "<\\1>" nil nil s))))
+    (if org-export-with-emphasize
+        (setq s (org-export-html-convert-emphasize s)))
+    (if org-export-with-sub-superscripts
+        (setq s (org-export-html-convert-sub-super s)))
+    (if org-export-with-TeX-macros
+        (let ((start 0) wd ass)
+          (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)" s start))
+            (setq wd (match-string 1 s))
+            (if (setq ass (assoc wd org-html-entities))
+                (setq s (replace-match (or (cdr ass)
+                                           (concat "&" (car ass) ";"))
+                                       t t s))
+              (setq start (+ start (length wd)))))))
+    (concat s r)))
+
+(defun org-create-multibrace-regexp (left right n)
+  "Create a regular expression which will match a balanced sexp.
+Opening delimiter is LEFT, and closing delimiter is RIGHT, both given
+as single character strings.
+The regexp returned will match the entire expression including the
+delimiters.  It will also define a single group which contains the
+match except for the outermost delimiters. The maximum depth of
+stacked delimiters is N. Escaping delimiters is not possible."
+  (let* ((nothing (concat "[^" "\\" left "\\" right "]*?"))
+         (or "\\|")
+         (re nothing)
+         (next (concat "\\(?:" nothing left nothing right "\\)+" nothing)))
+    (while (> n 1)
+      (setq n (1- n)
+            re (concat re or next)
+            next (concat "\\(?:" nothing left next right "\\)+" nothing)))
+    (concat left "\\(" re "\\)" right)))
+
+(defvar org-match-substring-regexp
+  (concat
+   "\\([^\\]\\)\\([_^]\\)\\("
+   "\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
+   "\\|"
+   "\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
+   "\\|"
+   "\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)")
+  "The regular expression matching a sub- or superscript.")
+
+(defun org-export-html-convert-sub-super (string)
+  "Convert sub- and superscripts in STRING to HTML."
+  (let (key c)
+    (while (string-match org-match-substring-regexp string)
+      (setq key (if (string= (match-string 2 string) "_") "sub" "sup"))
+      (setq c (or (match-string 8 string)
+                  (match-string 6 string)
+                  (match-string 5 string)))
+      (setq string (replace-match
+                    (concat (match-string 1 string)
+                            "<" key ">" c "</" key ">")
+                    t t string)))
+    (while (string-match "\\\\\\([_^]\\)" string)
+      (setq string (replace-match (match-string 1 string) t t string))))
+  string)
+
+(defun org-export-html-convert-emphasize (string)
+  (while (string-match
+          "\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)"
+          string)
+    (setq string (replace-match
+                  (concat "<b>" (match-string 3 string) "</b>")
+                  t t string 2)))
+  (while (string-match
+          "\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)"
+          string)
+    (setq string (replace-match
+                  (concat "<i>" (match-string 3 string) "</i>")
+                  t t string 2)))
+  (while (string-match
+          "\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)"
+          string)
+    (setq string (replace-match
+                  (concat "<u>" (match-string 3 string) "</u>")
+                  t t string 2)))
+  string)
+
+(defun org-parse-key-lines ()
+  "Find the special key lines with the information for exporters."
+  (save-excursion
+    (goto-char 0)
+    (let ((re (org-make-options-regexp
+               '("TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")))
+          key)
+      (while (re-search-forward re nil t)
+        (setq key (match-string 1))
+        (cond ((string-equal key "TITLE")
+               (setq title (match-string 2)))
+              ((string-equal key "AUTHOR")
+               (setq author (match-string 2)))
+              ((string-equal key "EMAIL")
+               (setq email (match-string 2)))
+              ((string-equal key "LANGUAGE")
+               (setq language (match-string 2)))
+              ((string-equal key "TEXT")
+               (setq text (concat text "\n" (match-string 2))))
+              ((string-equal key "OPTIONS")
+               (setq options (match-string 2))))))))
+
+(defun org-parse-export-options (s)
+  "Parse the export options line."
+  (let ((op '(("H"     . org-export-headline-levels)
+              ("num"   . org-export-with-section-numbers)
+              ("toc"   . org-export-with-toc)
+              ("\\n"   . org-export-preserve-breaks)
+              ("@"     . org-export-html-expand)
+              (":"     . org-export-with-fixed-width)
+              ("|"     . org-export-with-tables)
+              ("^"     . org-export-with-sub-superscripts)
+              ("*"     . org-export-with-emphasize)
+              ("TeX"   . org-export-with-TeX-macros)))
+        o)
+    (while (setq o (pop op))
+      (if (string-match (concat (regexp-quote (car o)) ":\\([^ \t\n\r;,.]*\\)")
+                        s)
+          (set (make-local-variable (cdr o))
+               (car (read-from-string (match-string 1 s))))))))
+
+(defun org-html-level-start (level title umax with-toc head-count)
+  "Insert a new level in HTML export."
+  (let ((l (1+ (max level umax))))
+    (while (<= l org-level-max)
+      (if (aref levels-open (1- l))
+          (progn
+            (org-html-level-close l)
+            (aset levels-open (1- l) nil)))
+      (setq l (1+ l)))
+    (if (> level umax)
+        (progn
+          (if (aref levels-open (1- level))
+              (insert "<li>" title "<p>\n")
+            (aset levels-open (1- level) t)
+            (insert "<ul><li>" title "<p>\n")))
+      (if org-export-with-section-numbers
+          (setq title (concat (org-section-number level) " " title)))
+      (setq level (+ level 1))
+      (if with-toc
+	  (insert (format "\n<H%d><a name=\"sec-%d\">%s</a></H%d>\n"
+			  level head-count title level))
+	(insert (format "\n<H%d>%s</H%d>\n" level title level))))))
+
+(defun org-html-level-close (level)
+  "Terminate one level in HTML export."
+  (insert "</ul>"))
+
+
+;; Variable holding the vector with section numbers
+(defvar org-section-numbers (make-vector org-level-max 0))
+
+(defun org-init-section-numbers ()
+  "Initialize the vector for the section numbers."
+  (let* ((level  -1)
+         (numbers (nreverse (org-split-string "" "\\.")))
+         (depth (1- (length org-section-numbers)))
+         (i depth) number-string)
+    (while (>= i 0)
+      (if (> i level)
+          (aset org-section-numbers i 0)
+        (setq number-string (or (car numbers) "0"))
+        (if (string-match "\\`[A-Z]\\'" number-string)
+            (aset org-section-numbers i
+                  (- (string-to-char number-string) ?A -1))
+            (aset org-section-numbers i (string-to-int number-string)))
+        (pop numbers))
+      (setq i (1- i)))))
+
+(defun org-section-number (&optional level)
+  "Return a string with the current section number.
+When LEVEL is non-nil, increase section numbers on that level."
+  (let* ((depth (1- (length org-section-numbers))) idx n (string ""))
+    (when level
+      (when (> level -1)
+        (aset org-section-numbers
+              level (1+ (aref org-section-numbers level))))
+      (setq idx (1+ level))
+      (while (<= idx depth)
+        (if (not (= idx 1))
+            (aset org-section-numbers idx 0))
+        (setq idx (1+ idx))))
+    (setq idx 0)
+    (while (<= idx depth)
+      (setq n (aref org-section-numbers idx))
+      (setq string (concat string (if (not (string= string "")) "." "")
+                           (int-to-string n)))
+      (setq idx (1+ idx)))
+    (save-match-data
+      (if (string-match "\\`\\([@0]\\.\\)+" string)
+          (setq string (replace-match "" nil nil string)))
+      (if (string-match "\\(\\.0\\)+\\'" string)
+          (setq string (replace-match "" nil nil string))))
+    string))
+
+
+;;; Key bindings
+
+;; - Bindings in Org-mode map are currently
+;;   0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t  the alphabet
+;;             abcd fgh j lmnopqrstuvwxyz ? #    -+ /=     [] ; |,.<>   \t  necessary bindings
+;;                 e                                                        (?) useful from outline-mode
+;;                     i k                 @                                expendable from outline-mode
+;;   0123456789                          !   $%^&   * ()_{}    "     ~`'    free
+
+(define-key org-mode-map [(tab)] 'org-cycle)
+(define-key org-mode-map "\C-i" 'org-cycle)
+(define-key org-mode-map [(meta tab)] 'org-complete)
+(define-key org-mode-map "\M-\C-i" 'org-complete)
+(define-key org-mode-map [(meta shift left)] 'org-shiftmetaleft)
+(define-key org-mode-map [(meta left)] 'org-metaleft)
+(define-key org-mode-map [(meta shift right)] 'org-shiftmetaright)
+(define-key org-mode-map [(meta shift up)] 'org-shiftmetaup)
+(define-key org-mode-map [(meta shift down)] 'org-shiftmetadown)
+(define-key org-mode-map [(meta right)] 'org-metaright)
+(define-key org-mode-map [(meta up)] 'org-metaup)
+(define-key org-mode-map [(meta down)] 'org-metadown)
+;(define-key org-mode-map "\C-c\C-h\C-w" 'org-cut-subtree)
+;(define-key org-mode-map "\C-c\C-h\M-w" 'org-copy-subtree)
+;(define-key org-mode-map "\C-c\C-h\C-y" 'org-paste-subtree)
+(define-key org-mode-map "\C-c\C-h\C-w" 'org-cut-special)
+(define-key org-mode-map "\C-c\C-h\M-w" 'org-copy-special)
+(define-key org-mode-map "\C-c\C-h\C-y" 'org-paste-special)
+(define-key org-mode-map "\C-c\C-j" 'org-goto)
+(define-key org-mode-map "\C-c\C-t" 'org-todo)
+(define-key org-mode-map "\C-c\C-s" 'org-schedule)
+(define-key org-mode-map "\C-c\C-d" 'org-deadline)
+(define-key org-mode-map "\C-c;"    'org-toggle-comment)
+(define-key org-mode-map "\C-c\C-v" 'org-show-todo-tree)
+(define-key org-mode-map "\C-c\C-w" 'org-check-deadlines)
+(define-key org-mode-map "\C-c/"    'org-occur)   ; Minor-mode reserved
+(define-key org-mode-map "\C-c\C-m" 'org-insert-heading)
+(define-key org-mode-map "\M-\C-m"  'org-insert-heading)
+(define-key org-mode-map "\C-c\C-l" 'org-insert-link)
+(define-key org-mode-map "\C-c\C-o" 'org-open-at-point)
+(define-key org-mode-map "\C-c\C-z" 'org-time-stamp)  ; Alternative binding
+(define-key org-mode-map "\C-c."    'org-time-stamp)  ; Minor-mode reserved
+(define-key org-mode-map "\C-c,"    'org-priority)    ; Minor-mode reserved
+(define-key org-mode-map "\C-c\C-y" 'org-evaluate-time-range)
+(define-key org-mode-map "\C-c>"    'org-goto-calendar)
+(define-key org-mode-map "\C-c<"    'org-date-from-calendar)
+(define-key org-mode-map "\C-c["    'org-add-file)
+(define-key org-mode-map "\C-c]"    'org-remove-file)
+(define-key org-mode-map "\C-c\C-r"       'org-timeline)
+;(define-key org-mode-map [(shift up)]     'org-timestamp-up)
+;(define-key org-mode-map [(shift down)]   'org-timestamp-down)
+(define-key org-mode-map [(shift up)]     'org-shiftup)
+(define-key org-mode-map [(shift down)]   'org-shiftdown)
+(define-key org-mode-map [(shift left)]   'org-timestamp-down-day)
+(define-key org-mode-map [(shift right)]  'org-timestamp-up-day)
+(define-key org-mode-map "\C-c-"          'org-table-insert-hline)
+;; The following line is e.g. necessary for German keyboards under Suse Linux
+(unless org-xemacs-p
+  (define-key org-mode-map [S-iso-lefttab]  'org-shifttab))
+(define-key org-mode-map [(shift tab)]    'org-shifttab)
+(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 [(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)
+(define-key org-mode-map "\C-c "          'org-table-blank-field)
+(define-key org-mode-map "\C-c+"          'org-table-sum)
+(define-key org-mode-map "\C-c|"          'org-table-toggle-vline-visibility)
+(define-key org-mode-map "\C-c="          'org-table-eval-formula)
+(define-key org-mode-map "\C-c#"          'org-table-create-with-table.el)
+(define-key org-mode-map "\C-c\C-q"       'org-table-wrap-region)
+(define-key org-mode-map "\C-c\C-xa"      'org-export-as-ascii)
+(define-key org-mode-map "\C-c\C-x\C-a"   'org-export-as-ascii)
+(define-key org-mode-map "\C-c\C-xt"      'org-insert-export-options-template)
+(define-key org-mode-map "\C-c:"          'org-toggle-fixed-width-section)
+(define-key org-mode-map "\C-c\C-xh"      'org-export-as-html)
+(define-key org-mode-map "\C-c\C-x\C-h"   'org-export-as-html-and-open)
+
+(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."))
+
+(defun org-shifttab ()
+  "Call `(org-cycle t)' or `org-table-previous-field'."
+  (interactive)
+  (cond
+   ((org-at-table-p) (org-table-previous-field))
+   (t (org-cycle '(4)))))
+
+(defun org-shiftmetaleft (&optional arg)
+  "Call `org-promote-subtree' or `org-table-delete-column'."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-delete-column arg))
+   ((org-on-heading-p) (org-promote-subtree arg))
+   (t (org-shiftcursor-error))))
+(defun org-shiftmetaright (&optional arg)
+  "Call `org-demote-subtree' or `org-table-insert-column'."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-insert-column arg))
+   ((org-on-heading-p) (org-demote-subtree arg))
+   (t (org-shiftcursor-error))))
+(defun org-shiftmetaup (&optional arg)
+  "Call `org-move-subtree-up' or `org-table-kill-row'."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-kill-row arg))
+   ((org-on-heading-p) (org-move-subtree-up arg))
+   (t (org-shiftcursor-error))))
+(defun org-shiftmetadown (&optional arg)
+  "Call `org-move-subtree-down' or `org-table-insert-row'."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-insert-row arg))
+   ((org-on-heading-p) (org-move-subtree-down arg))
+   (t (org-shiftcursor-error))))
+
+(defun org-metaleft (&optional arg)
+  "Call `org-do-promote' or `org-table-move-column' to left."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-move-column 'left))
+   ((or (org-on-heading-p) (org-region-active-p)) (org-do-promote arg))
+   (t (backward-word (prefix-numeric-value arg)))))
+(defun org-metaright (&optional arg)
+  "Call `org-do-demote' or `org-table-move-column' to right."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-move-column nil))
+   ((or (org-on-heading-p) (org-region-active-p)) (org-do-demote arg))
+   (t (forward-word (prefix-numeric-value arg)))))
+(defun org-metaup (&optional arg)
+  "Call `org-move-subtree-up' or `org-table-move-row' up."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-move-row 'up))
+   ((org-on-heading-p) (org-move-subtree-up arg))
+   (t (org-shiftcursor-error))))
+(defun org-metadown (&optional arg)
+  "Call `org-move-subtree-down' or `org-table-move-row' down."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-move-row nil))
+   ((org-on-heading-p) (org-move-subtree-down arg))
+   (t (org-shiftcursor-error))))
+
+(defun org-shiftup (&optional arg)
+  "Call `org-timestamp-up' or `org-priority-up'."
+  (interactive "P")
+  (cond
+   ((org-at-timestamp-p) (org-timestamp-up arg))
+   (t (org-priority-up))))
+
+(defun org-shiftdown (&optional arg)
+  "Call `org-timestamp-down' or `org-priority-down'."
+  (interactive "P")
+  (cond
+   ((org-at-timestamp-p) (org-timestamp-down arg))
+   (t (org-priority-down))))
+
+(defun org-copy-special (arg)
+  "Call either `org-table-copy' or `org-copy-subtree'."
+  (interactive "P")
+  (if (org-at-table-p)
+      (org-table-copy-region arg)
+    (org-copy-subtree arg)))
+
+(defun org-cut-special (arg)
+  "Call either `org-table-copy' or `org-copy-subtree'."
+  (interactive "P")
+  (if (org-at-table-p)
+      (org-table-cut-region arg)
+    (org-cut-subtree arg)))
+
+(defun org-paste-special (arg)
+  "Call either `org-table-paste-rectangle' or `org-paste-subtree'."
+  (interactive "P")
+  (if (org-at-table-p)
+      (org-table-paste-rectangle arg)
+    (org-paste-subtree arg)))
+
+(defun org-ctrl-c-ctrl-c (&optional arg)
+  "Call realign table, or recognize a table.el table.
+When the cursor is inside a table created by the table.el package,
+activate that table.  Otherwise, if the cursor is at a normal table
+created with org.el, re-align that table.  This command works even if
+the automatic table editor has been turned off."
+  (interactive "P")
+  (let  ((org-enable-table-editor t))
+    (cond
+     ((org-at-table.el-p)
+      (require 'table)
+      (beginning-of-line 1)
+      (re-search-forward "|" (save-excursion (end-of-line 2) (point)))
+      (table-recognize-table))
+     ((org-at-table-p)
+      (org-table-align))
+     ((org-region-active-p)
+      (org-table-convert-region (region-beginning) (region-end) arg))
+     ((and (region-beginning) (region-end))
+      (if (y-or-n-p "Convert inactive region to table? ")
+          (org-table-convert-region (region-beginning) (region-end) arg)
+        (error "Abort")))
+     (t (error "No table at point, and no region to make one.")))))
+
+(defun org-return (&optional arg)
+  "Call `org-table-next-row' or `newline'."
+  (interactive "P")
+  (cond
+   ((org-at-table-p) (org-table-next-row))
+   (t (newline))))
+
+
+;;; Menu entries
+
+;; First, remove the outline menus.
+(if org-xemacs-p
+    (add-hook 'org-mode-hook
+              (lambda ()
+                (delete-menu-item '("Headings"))
+                (delete-menu-item '("Show"))
+                (delete-menu-item '("Hide"))
+                (set-menubar-dirty-flag)))
+  (setq org-mode-map (delq (assoc 'menu-bar (cdr org-mode-map))
+                             org-mode-map)))
+
+;; Define the Org-mode menus
+(easy-menu-define org-org-menu org-mode-map "Org menu"
+  '("Org"
+    ["Cycle Visibility" org-cycle (or (bobp) (outline-on-heading-p))]
+    ["Sparse Tree" org-occur t]
+    ["Show All" show-all t]
+    "--"
+    ["New Heading" org-insert-heading t]
+    ("Navigate Headings"
+     ["Up" outline-up-heading t]
+     ["Next" outline-next-visible-heading t]
+     ["Previous" outline-previous-visible-heading t]
+     ["Next Same Level" outline-forward-same-level t]
+     ["Previous Same Level" outline-backward-same-level t]
+     "--"
+     ["Jump" org-goto t])
+    ("Edit Structure"
+     ["Move subtree up" org-shiftmetaup (not (org-at-table-p))]
+     ["Move subtree down" org-shiftmetadown (not (org-at-table-p))]
+     "--"
+     ["Copy Subtree"  org-copy-special (not (org-at-table-p))]
+     ["Cut Subtree"  org-cut-special (not (org-at-table-p))]
+     ["Paste Subtree"  org-paste-special (not (org-at-table-p))]
+     "--"
+     ["Promote Heading" org-metaleft (not (org-at-table-p))]
+     ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))]
+     ["Demote Heading"  org-metaright (not (org-at-table-p))]
+     ["Demote Subtree"  org-shiftmetaright (not (org-at-table-p))])
+    "--"
+    ("TODO lists"
+     ["TODO/DONE/-" org-todo t]
+     ["Show TODO Tree" org-show-todo-tree t]
+     "--"
+     ["Set priority" org-priority t]
+     ["Priority up" org-shiftup t]
+     ["Priority down" org-shiftdown t])
+    ("Dates and Scheduling"
+     ["Timestamp" org-time-stamp t]
+     ("Change Date"
+      ["1 day later" org-timestamp-up-day t]
+      ["1 day earlier" org-timestamp-down-day t]
+      ["1 ... later" org-shiftup t]
+      ["1 ... earlier" org-shiftdown t])
+     ["Compute Time Range" org-evaluate-time-range t]
+     ["Schedule Item" org-schedule t]
+     ["Deadline" org-deadline t]
+     "--"
+     ["Goto Calendar" org-goto-calendar t]
+     ["Date from Calendar" org-date-from-calendar t])
+    "--"
+    ("Timeline/Agenda"
+     ["Show TODO Tree this file"  org-show-todo-tree t]
+     ["Check Deadlines this file" org-check-deadlines t]
+     ["Timeline current file" org-timeline t]
+     "--"
+     ["Adenda (multifile)" org-agenda-overview t])
+    ("File List for Agenda")
+    "--"
+    ("Hyperlinks"
+     ["Store Link (global)" org-store-link t]
+     ["Insert Link" org-insert-link t]
+     ["Follow Link" org-open-at-point t])
+    ;; ["BBDB" org-bbdb-name t]
+    "--"
+    ("Table"
+     ["Align" org-ctrl-c-ctrl-c (org-at-table-p)]
+     ["Next field" org-cycle (org-at-table-p)]
+     ["Previous Field" org-shifttab (org-at-table-p)]
+     ["Next row" org-return (org-at-table-p)]
+     "--"
+     ["Blank field" org-table-blank-field (org-at-table-p)]
+     ["Copy field from above" org-table-copy-from-above (org-at-table-p)]
+     "--"
+     ("Column"
+      ["Move column left" org-metaleft (org-at-table-p)]
+      ["Move column right" org-metaright (org-at-table-p)]
+      ["Delete column" org-shiftmetaleft (org-at-table-p)]
+      ["Insert column" org-shiftmetaright (org-at-table-p)])
+     ("Row"
+      ["Move row up" org-metaup (org-at-table-p)]
+      ["Move row down" org-metadown (org-at-table-p)]
+      ["Delete row" org-shiftmetaup (org-at-table-p)]
+      ["Insert row" org-shiftmetadown (org-at-table-p)]
+      "--"
+      ["Insert hline" org-table-insert-hline (org-at-table-p)])
+     ("Rectangle"
+      ["Copy rectangle" org-copy-special (org-at-table-p)]
+      ["Cut rectangle" org-cut-special (org-at-table-p)]
+      ["Paste rectangle" org-paste-special (org-at-table-p)]
+      ["Fill rectangle" org-table-wrap-region (org-at-table-p)])
+     "--"
+     ["Which column?" org-table-current-column (org-at-table-p)]
+     ["Sum column/rectangle" org-table-sum 
+      (or (org-at-table-p) (org-region-active-p))]
+     ["Eval formula" org-table-eval-formula (org-at-table-p)]
+     "--"
+     ["Invisible Vlines" org-table-toggle-vline-visibility
+      :style toggle :selected (org-in-invisibility-spec-p '(org-table))]
+     "--"
+     ["Create" org-table-create (and (not (org-at-table-p))
+                                     org-enable-table-editor)]
+     ["Convert region" org-ctrl-c-ctrl-c (not (org-at-table-p 'any))]
+     ["Import from file" org-table-import (not (org-at-table-p))]
+     ["Export to file" org-table-export (org-at-table-p)]
+     "--"
+     ["Create/convert from/to table.el" org-table-create-with-table.el t])
+    "--"
+    ("Export"
+     ["ASCII" org-export-as-ascii t]
+     ["HTML"  org-export-as-html t]
+     ["HTML, and open" org-export-as-html-and-open t]
+     "--"
+     ["Option template" org-insert-export-options-template t]
+     ["Toggle fixed width" org-toggle-fixed-width-section t])
+    "--"
+    ("Documentation"
+     ["Show Version" org-version t]
+     ["Info Documentation" org-info t])
+    ("Customize"
+     ["Browse Org Group" org-customize t]
+     "--"
+     ["Build Full Customize Menu" org-create-customize-menu
+      (fboundp 'customize-menu-create)])
+    ))
+
+
+(defun org-info (&optional node)
+  "Read documentation for Org-mode in the info system.
+With optional NODE, go directly to that node."
+  (interactive)
+  (require 'info)
+  (Info-goto-node (format "(org)%s" (or node ""))))
+
+
+(defun org-install-agenda-files-menu ()
+  (easy-menu-change 
+   '("Org") "File List for Agenda"
+   (append
+    (list 
+     ["Edit file list" (customize-variable 'org-agenda-files) t]
+     ["Add current file to list" org-add-file t]
+     ["Remove current file from list" org-remove-file t]
+     "--")
+    (mapcar 'org-file-menu-entry org-agenda-files))))
+
+;;; Documentation
+
+(defun org-customize ()
+  "Call the customize function with org as argument."
+  (interactive)
+  (customize-browse 'org))
+
+(defun org-create-customize-menu ()
+  "Create a full customization menu for Org-mode, insert it into the menu."
+  (interactive)
+  (if (fboundp 'customize-menu-create)
+      (progn
+	(easy-menu-change
+	 '("Org") "Customize"
+	 `(["Browse Org group" org-customize t]
+	   "--"
+	   ,(customize-menu-create 'org)
+	   ["Set" Custom-set t]
+	   ["Save" Custom-save t]
+	   ["Reset to Current" Custom-reset-current t]
+	   ["Reset to Saved" Custom-reset-saved t]
+	   ["Reset to Standard Settings" Custom-reset-standard t]))
+	(message "\"Org\"-menu now contains full customization menu"))
+    (error "Cannot expand menu (outdated version of cus-edit.el)")))
+
+;;; Miscellaneous stuff
+
+(defun org-move-line-down (arg)
+  "Move the current line up."
+  (interactive "p")
+  (let ((col (current-column))
+	beg end pos)
+    (beginning-of-line 1) (setq beg (point))
+    (beginning-of-line 2) (setq end (point))
+    (beginning-of-line (+ 1 arg))
+    (setq pos (move-marker (make-marker) (point)))
+    (insert (delete-and-extract-region beg end))
+    (goto-char pos)
+    (move-to-column col)))
+
+(defun org-move-line-up (arg)
+  "Move the current line up."
+  (interactive "p")
+  (let ((col (current-column))
+	beg end pos)
+    (beginning-of-line 1) (setq beg (point))
+    (beginning-of-line 2) (setq end (point))
+    (beginning-of-line (+ -2 arg))
+    (setq pos (move-marker (make-marker) (point)))
+    (insert (delete-and-extract-region beg end))
+    (goto-char pos)
+    (move-to-column col)))
+
+;; Functions needed for Emacs/XEmacs region compatibility
+
+(defun org-region-active-p ()
+  "Is transient-mark-mode on and the region active?
+Works on both Emacs and XEmacs."
+  (if org-ignore-region
+      nil
+    (if org-xemacs-p
+        (and zmacs-regions (region-active-p))
+      (and transient-mark-mode mark-active))))
+
+(defun org-add-to-invisibility-spec (arg)
+  "Add elements to `buffer-invisibility-spec'.
+See documentation for `buffer-invisibility-spec' for the kind of elements
+that can be added."
+  (cond
+   ((fboundp 'add-to-invisibility-spec)
+    (add-to-invisibility-spec arg))
+   ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t))
+	(setq buffer-invisibility-spec (list arg)))
+   (t
+    (setq buffer-invisibility-spec
+	  (cons arg buffer-invisibility-spec)))))
+
+(defun org-remove-from-invisibility-spec (arg)
+  "Remove elements from `buffer-invisibility-spec'."
+  (if (fboundp 'remove-from-invisibility-spec)
+      (remove-from-invisibility-spec arg)
+    (if (consp buffer-invisibility-spec)
+        (setq buffer-invisibility-spec
+              (delete arg buffer-invisibility-spec)))))
+
+(defun org-in-invisibility-spec-p (arg)
+  "Is ARG a member of `buffer-invisibility-spec'?."
+  (if (consp buffer-invisibility-spec)
+      (member arg buffer-invisibility-spec)
+    nil))
+
+(defun org-image-file-name-regexp ()
+  "Return regexp matching the file names of images."
+  (if (fboundp 'image-file-name-regexp)
+      (image-file-name-regexp)
+    (let ((image-file-name-extensions
+           '("png" "jpeg" "jpg" "gif" "tiff" "tif"
+             "xbm" "xpm" "pbm" "pgm" "ppm")))
+      (concat "\\."
+              (regexp-opt (nconc (mapcar 'upcase
+                                         image-file-name-extensions)
+                                 image-file-name-extensions)
+                          t)
+              "\\'"))))
+
+;; Functions needed for compatibility with old outline.el
+
+;; The following functions capture almost the entire compatibility code
+;; between the different versions of outline-mode.  The only other place 
+;; where this is important are the font-lock-keywords.  Search for
+;; `org-noutline-p' to find it.
+
+;; C-a should go to the beginning of a *visible* line, also in the
+;; new outline.el.  I guess this should be patched into Emacs?
+(defun org-beginning-of-line ()
+  "Go to the beginning of the current line.  If that is invisible, continue
+to a visible line beginning.  This makes the function of C-a more intuitive."
+  (interactive)
+  (beginning-of-line 1)
+  (if (bobp)
+      nil
+    (backward-char 1)
+    (if (org-invisible-p)
+        (while (and (not (bobp)) (org-invisible-p))
+          (backward-char 1)
+          (beginning-of-line 1))
+      (forward-char 1))))
+(when org-noutline-p
+  (define-key org-mode-map "\C-a" 'org-beginning-of-line))
+
+(defun org-invisible-p ()
+  "Check if point is at a character currently not visible."
+  (if org-noutline-p
+      ;; Early versions of noutline don't have `outline-invisible-p'.
+      (if (fboundp 'outline-invisible-p)
+          (outline-invisible-p)
+        (get-char-property (point) 'invisible))
+    (save-excursion
+      (skip-chars-backward "^\r\n")
+      (if (bobp)
+          nil
+        (equal (char-before) ?\r)))))
+
+(defun org-back-to-heading (&optional invisible-ok)
+  "Move to previous heading line, or beg of this line if it's a heading.
+Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
+  (if org-noutline-p
+      (outline-back-to-heading invisible-ok)
+    (if (looking-at outline-regexp)
+        t
+      (if (re-search-backward (concat (if invisible-ok "[\r\n]" "^")
+                                      outline-regexp)
+                              nil t)
+          (if invisible-ok
+              (progn (forward-char 1)
+                     (looking-at outline-regexp)))
+        (error "Before first heading")))))
+
+(defun org-on-heading-p (&optional invisible-ok)
+  "Return t if point is on a (visible) heading line.
+If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
+  (if org-noutline-p
+      (outline-on-heading-p 'invisible-ok)
+    (save-excursion
+      (skip-chars-backward "^\n\r")
+      (and (looking-at outline-regexp)
+           (or invisible-ok
+               (bobp)
+               (equal (char-before) ?\n))))))
+
+(defun org-up-heading-all (arg)
+  "Move to the heading line of which the present line is a subheading.
+This function considers both visible and invisible heading lines.
+With argument, move up ARG levels."
+  (if org-noutline-p
+      (outline-up-heading-all arg)
+    (org-back-to-heading t)
+    (looking-at outline-regexp)
+    (if (<= (- (match-end 0) (match-beginning 0)) arg)
+        (error "Cannot move up %d levels" arg)
+    (re-search-backward
+     (concat "[\n\r]" (regexp-quote
+                       (make-string (- (match-end 0) (match-beginning 0) arg)
+                                    ?*))
+             "[^*]"))
+    (forward-char 1))))
+
+(defun org-show-hidden-entry ()
+  "Show an entry where even the heading is hidden."
+  (save-excursion
+    (if (not org-noutline-p)
+        (progn
+          (org-back-to-heading t)
+          (org-flag-heading nil)))
+    (show-entry)))
+
+(defun org-check-occur-regexp (regexp)
+  "If REGEXP starts with \"^\", modify it to check for \\r as well.
+Of course, only for the old outline mode."
+  (if org-noutline-p
+      regexp
+    (if (string-match "^\\^" regexp)
+        (concat "[\n\r]" (substring regexp 1))
+      regexp)))
+
+(defun org-flag-heading (flag &optional entry)
+  "Flag the current heading. FLAG non-nil means make invisible.
+When ENTRY is non-nil, show the entire entry."
+  (save-excursion
+    (org-back-to-heading t)
+    (if (not org-noutline-p)
+        ;; Make the current headline visible
+        (outline-flag-region (max 1 (1- (point))) (point) (if flag ?\r ?\n)))
+    ;; Check if we should show the entire entry
+    (if entry
+        (progn
+          (show-entry)
+          (save-excursion  ;; FIXME: Is this the fix for points in the   -|
+                           ;;        middle of text?                      |
+            (and (outline-next-heading)   ;;                              |
+                 (org-flag-heading nil))))  ; show the next heading      _|
+      (outline-flag-region (max 1 (1- (point)))
+                           (save-excursion (outline-end-of-heading) (point))
+                           (if org-noutline-p
+                               flag
+                             (if flag ?\r ?\n))))))
+
+(defun org-make-options-regexp (kwds)
+  "Make a regular expression for keyword lines."
+  (concat
+   (if org-noutline-p "^" "[\n\r]")
+   "#?[ \t]*\\+\\("
+   (mapconcat 'regexp-quote kwds "\\|")
+   "\\):[ \t]*"
+   (if org-noutline-p "\\(.+\\)" "\\([^\n\r]+\\)")))
+
+;; Advise the bookmark-jump function to make jump position visible
+;; Wrapped into eval-after-load to avoid loading advice unnecessarily
+(eval-after-load "bookmark"
+  '(defadvice bookmark-jump (after org-make-visible activate)
+     "Make the position visible."
+     (and (eq major-mode 'org-mode)
+          (org-invisible-p)
+          (org-show-hierarchy-above))))
+
+;;; Finish up
+
+(provide 'org)
+
+(run-hooks 'org-load-hook)
+
+;;; org.el ends here
+
+;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
--- a/lisp/textmodes/tex-mode.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/textmodes/tex-mode.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1190,14 +1190,14 @@
 	      (forward-sexp 1))
 	    ;; Now check that like matches like.
 	    (goto-char start)
-	    (while (progn (skip-syntax-forward "^(")
-			  (not (eobp)))
-	      (let ((match (matching-paren (following-char))))
-		(save-excursion
+	    (while (re-search-forward "\\s(" nil t)
+	      (save-excursion
+		(let ((pos (match-beginning 0)))
+		  (goto-char pos)
 		  (forward-sexp 1)
-		  (or (= (preceding-char) match)
-		      (error "Mismatched parentheses"))))
-	      (forward-char 1)))
+		  (or (eq (preceding-char) (cdr (syntax-after pos)))
+		      (eq (char-after pos) (cdr (syntax-after (1- (point)))))
+		      (error "Mismatched parentheses"))))))
 	(error
 	 (skip-syntax-forward " .>")
 	 (setq failure-point (point)))))
@@ -1693,9 +1693,12 @@
   (let* ((file (or tex-main-file
 		   ;; Compatibility with AUCTeX.
 		   (with-no-warnings
-		    (when (and (boundp 'TeX-master) (stringp TeX-master))
-		      (make-local-variable 'tex-main-file)
-		      (setq tex-main-file TeX-master)))
+		    (when (boundp 'TeX-master)
+		      (cond ((stringp TeX-master)
+			     (make-local-variable 'tex-main-file)
+			     (setq tex-main-file TeX-master))
+			    ((and (eq TeX-master t) buffer-file-name)
+			     (file-relative-name buffer-file-name)))))
 		   ;; Try to guess the main file.
 		   (if (not buffer-file-name)
 		       (error "Buffer is not associated with any file")
--- a/lisp/tooltip.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/tooltip.el	Wed Dec 08 22:20:27 2004 +0000
@@ -508,7 +508,7 @@
 
 ;;;###autoload
 (defcustom tooltip-mode nil
-  "Toggle tooltip-mode.
+  "Non-nil if Tooltip mode is enabled.
 Setting this variable directly does not take effect;
 use either \\[customize] or the function `tooltip-mode'."
   :set (lambda (symbol value)
--- a/lisp/url/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/url/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,15 @@
+2004-11-30  Paul Pogonyshev  <pogonyshev@gmx.net>
+
+	* url-http.el (url-http-handle-cookies): Bind `url-current-object'
+	to `url-http-cookies-sources' so that cookies are attributed to
+	proper domain.
+	(url-http): Make local variable `url-http-cookies-sources'.
+
+2004-11-28  Andreas Schwab  <schwab@suse.de>
+
+	* url-http.el (url-http-create-request): Don't add newline after
+	the request data.
+
 2004-11-20  Masatake YAMATO  <jet@gyve.org>
 
 	* url.el (url-mm-callback): Delay the invocation
--- a/lisp/url/url-http.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/url/url-http.el	Wed Dec 08 22:20:27 2004 +0000
@@ -255,15 +255,16 @@
 	   (if ref-url (concat
 			"Referer: " ref-url "\r\n"))
 	   extra-headers
-	   ;; Any data
+	   ;; Length of data
 	   (if url-request-data
 	       (concat
 		"Content-length: " (number-to-string
 				    (length url-request-data))
-		"\r\n\r\n"
-		url-request-data))
+		"\r\n"))
 	   ;; End request
-	   "\r\n"))
+	   "\r\n"
+	   ;; Any data
+	   url-request-data))
     (url-http-debug "Request is: \n%s" request)
     request))
 
@@ -341,7 +342,8 @@
 The buffer must already be narrowed to the headers, so mail-fetch-field will
 work correctly."
   (let ((cookies (mail-fetch-field "Set-Cookie" nil nil t))
-	(cookies2 (mail-fetch-field "Set-Cookie2" nil nil t)))
+	(cookies2 (mail-fetch-field "Set-Cookie2" nil nil t))
+	(url-current-object url-http-cookies-sources))
     (and cookies (url-http-debug "Found %d Set-Cookie headers" (length cookies)))
     (and cookies2 (url-http-debug "Found %d Set-Cookie2 headers" (length cookies2)))
     (while cookies
@@ -1042,7 +1044,8 @@
 		       url-http-process
 		       url-http-method
 		       url-http-extra-headers
-		       url-http-data))
+		       url-http-data
+		       url-http-cookies-sources))
 	  (set (make-local-variable var) nil))
 
 	(setq url-http-method (or url-request-method "GET")
@@ -1054,7 +1057,10 @@
 	      url-http-chunked-counter 0
 	      url-callback-function callback
 	      url-callback-arguments cbargs
-	      url-http-after-change-function 'url-http-wait-for-headers-change-function)
+	      url-http-after-change-function 'url-http-wait-for-headers-change-function
+	      url-http-cookies-sources (if (boundp 'proxy-object)
+					   proxy-object
+					 url-current-object))
 
 	(set-process-buffer connection buffer)
 	(set-process-sentinel connection 'url-http-end-of-document-sentinel)
--- a/lisp/vc-cvs.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/vc-cvs.el	Wed Dec 08 22:20:27 2004 +0000
@@ -189,7 +189,7 @@
       (let ((state (vc-file-getprop file 'vc-state)))
         ;; If we should stay local, use the heuristic but only if
         ;; we don't have a more precise state already available.
-	(if (memq state '(up-to-date edited))
+	(if (memq state '(up-to-date edited nil))
 	    (vc-cvs-state-heuristic file)
 	  state))
     (with-temp-buffer
--- a/lisp/vc-hooks.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/vc-hooks.el	Wed Dec 08 22:20:27 2004 +0000
@@ -461,6 +461,12 @@
           (vc-file-setprop file 'vc-state
                            (vc-call state-heuristic file)))))
 
+(defun vc-recompute-state (file)
+  "Recompute the version control state of FILE, and return it.
+This calls the possibly expensive function vc-BACKEND-state,
+rather than the heuristic."
+  (vc-file-setprop file 'vc-state (vc-call state file)))
+
 (defsubst vc-up-to-date-p (file)
   "Convenience function that checks whether `vc-state' of FILE is `up-to-date'."
   (eq (vc-state file) 'up-to-date))
--- a/lisp/vc.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/vc.el	Wed Dec 08 22:20:27 2004 +0000
@@ -1116,12 +1116,6 @@
 editing non-current versions is not supported by default."
   t)
 
-(defun vc-recompute-state (file)
-  "Force a recomputation of the version control state of FILE.
-The state is computed using the exact, and possibly expensive
-function `vc-BACKEND-state', not the heuristic."
-  (vc-file-setprop file 'vc-state (vc-call state file)))
-
 (defun vc-next-action-on-file (file verbose &optional comment)
   "Do The Right Thing for a given FILE under version control.
 If COMMENT is specified, it will be used as an admin or checkin comment.
--- a/lisp/wid-edit.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/wid-edit.el	Wed Dec 08 22:20:27 2004 +0000
@@ -339,6 +339,8 @@
       ;; one character.
       (let ((overlay (make-overlay (1- to) to nil t nil)))
 	(overlay-put overlay 'field 'boundary)
+        ;; We need the real field for tabbing.
+	(overlay-put overlay 'real-field widget)
 	;; Use `local-map' here, not `keymap', so that normal editing
 	;; works in the field when, say, Custom uses `suppress-keymap'.
 	(overlay-put overlay 'local-map keymap)
@@ -1085,14 +1087,23 @@
   :type 'function
   :group 'widgets)
 
+(defun widget-narrow-to-field ()
+  "Narrow to field"
+  (interactive)
+  (let ((field (widget-field-find (point))))
+    (if field
+	(narrow-to-region (line-beginning-position) (line-end-position)))))
+
 (defun widget-complete ()
   "Complete content of editable field from point.
 When not inside a field, move to the previous button or field."
   (interactive)
   (let ((field (widget-field-find (point))))
     (if field
-	(widget-apply field :complete)
-      (error "Not in an editable field"))))
+	(save-restriction
+	  (widget-narrow-to-field)
+	  (widget-apply field :complete))
+	  (error "Not in an editable field"))))
 
 ;;; Setting up the buffer.
 
@@ -1140,7 +1151,7 @@
   "Return the widget field at POS, or nil if none."
   (let ((field (get-char-property (or pos (point)) 'field)))
     (if (eq field 'boundary)
-	nil
+	(get-char-property (or pos (point)) 'real-field)
       field)))
 
 (defun widget-field-buffer (widget)
--- a/lisp/xml.el	Sun Nov 28 14:39:06 2004 +0000
+++ b/lisp/xml.el	Wed Dec 08 22:20:27 2004 +0000
@@ -179,7 +179,7 @@
       xml)))
 
 
-(let* ((start-chars (concat ":[:alpha:]_"))
+(let* ((start-chars (concat "[:alpha:]:_"))
        (name-chars  (concat "-[:digit:]." start-chars))
 ;;[3]   	S	   ::=   	(#x20 | #x9 | #xD | #xA)+
        (whitespace  "[ \t\n\r]"))
@@ -371,7 +371,9 @@
       (let ((pos (match-end 0)))
 	(unless (search-forward "]]>" nil t)
 	  (error "XML: (Not Well Formed) CDATA section does not end anywhere in the document"))
-	(buffer-substring pos (match-beginning 0))))
+	(concat
+	 (buffer-substring pos (match-beginning 0))
+	 (xml-parse-string))))
      ;;  DTD for the document
      ((looking-at "<!DOCTYPE")
       (let ((dtd (xml-parse-dtd parse-ns)))
@@ -599,7 +601,7 @@
 	     (t
 	      (if xml-validating-parser 
 		  (error "XML: (Validity) Invalid element type in the DTD"))))
-	    
+
 	    ;;  rule [45]: the element declaration must be unique
 	    (if (and (assoc element dtd)
 		     xml-validating-parser)
@@ -650,8 +652,25 @@
 					       (xml-parse-fragment
 						xml-validating-parser
 						parse-ns))))))))
+	   ;; skip parameter entity declarations
+	   ((or (looking-at (concat "<!ENTITY[ \t\n\r]+%[ \t\n\r]+\\(" xml-name-re
+				    "\\)[ \t\n\r]+SYSTEM[ \t\n\r]+"
+				    "\\(\"[^\"]*\"\\|'[^']*'\\)[ \t\n\r]*>"))
+		(looking-at (concat "<!ENTITY[ \t\n\r]+"
+				    "%[ \t\n\r]+"
+				    "\\(" xml-name-re "\\)[ \t\n\r]+"
+				    "PUBLIC[ \t\n\r]+"
+				    "\\(\"[- \r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*\""
+				    "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'\\)[ \t\n\r]+"
+				    "\\(\"[^\"]+\"\\|'[^']+'\\)"
+				    "[ \t\n\r]*>")))
+	    (goto-char (match-end 0)))
+	   ;; skip parameter entities
+	   ((looking-at (concat "%" xml-name-re ";"))
+	    (goto-char (match-end 0)))
 	   (t
-	    (error "XML: (Validity) Invalid DTD item")))))
+	    (when xml-validating-parser
+	      (error "XML: (Validity) Invalid DTD item"))))))
       (if (looking-at "\\s-*]>")
 	  (goto-char (nth 1 (match-data)))))
     (nreverse dtd)))
@@ -703,7 +722,7 @@
 
   (let ((point 0)
 	children end-point)
-    (while (string-match "&\\([^;]+\\);" string point)
+    (while (string-match "&\\([^;]*\\);" string point)
       (setq end-point (match-end 0))
       (let* ((this-part (match-string 1 string))
 	     (prev-part (substring string point (match-beginning 0)))
@@ -721,10 +740,12 @@
 		       (if c (string c))))
 		    (entity
 		     (cdr entity))
+		    ((eq (length this-part) 0)
+		     (error "XML: (Not Well-Formed) No entity given"))
 		    (t
-		     (if xml-validating-parser
+		     (when xml-validating-parser
 			 (error "XML: (Validity) Undefined entity `%s'"
-				(match-string 1 this-part)))))))
+				this-part))))))
 
 	(cond ((null children)
 	       ;; FIXME: If we have an entity that expands into XML, this won't work.
--- a/lispref/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,46 @@
+2004-12-05  Richard M. Stallman  <rms@gnu.org>
+
+	* Makefile.in (maintainer-clean): Remove the info files
+	in $(infodir) where they are created.
+
+2004-12-03  Richard M. Stallman  <rms@gnu.org>
+
+	* windows.texi (Selecting Windows): get-lru-window and
+	get-largest-window don't consider dedicated windows.
+
+	* text.texi (Undo): Document undo-in-progress.
+
+2004-11-26  Richard M. Stallman  <rms@gnu.org>
+
+	* locals.texi (Standard Buffer-Local Variables): Undo prev change.
+	Remove a few vars that are not always buffer-local.
+
+2004-11-24  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* locals.texi (Standard Buffer-Local Variables): Comment out
+	xref's to non-existent node `Yet to be written'.
+
+2004-11-24  Richard M. Stallman  <rms@gnu.org>
+
+	* processes.texi (Synchronous Processes): Grammar fix.
+
+	* numbers.texi (Comparison of Numbers): Add eql.
+
+	* locals.texi (Standard Buffer-Local Variables): Add many vars.
+
+	* intro.texi (Printing Notation): Fix previous change.
+
+	* display.texi (Customizing Bitmaps): Move indicate-buffer-boundaries
+	and default-indicate-buffer-boundaries from here.
+	(Usual Display): To here.
+	(Scroll Bars): Add scroll-bar-mode and scroll-bar-width.
+	(Usual Display): Move tab-width up.
+
+	* customize.texi (Variable Definitions): Replace
+	show-paren-mode example with tooltip-mode.
+	(Simple Types, Composite Types, Defining New Types):
+	Minor cleanups.
+
 2004-11-21  Jesper Harder  <harder@ifa.au.dk>
 
 	* processes.texi (Synchronous Processes, Output from Processes):
--- a/lispref/Makefile.in	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/Makefile.in	Wed Dec 08 22:20:27 2004 +0000
@@ -124,7 +124,8 @@
 distclean: clean
 
 maintainer-clean: clean
-	rm -f elisp elisp-[1-9] elisp-[1-9][0-9] elisp.dvi elisp.oaux
+	rm -f elisp.dvi elisp.oaux
+	cd $(infodir); rm -f elisp elisp-[1-9] elisp-[1-9][0-9] 
 
 dist: $(infodir)/elisp elisp.dvi
 	-rm -rf temp
--- a/lispref/customize.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/customize.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -300,17 +300,17 @@
 operation of a certain feature.  Assuming that the package is coded to
 check the value of the option, you still need to arrange for the package
 to be loaded.  You can do that with @code{:require}.  @xref{Common
-Keywords}.  Here is an example, from the library @file{paren.el}:
+Keywords}.  Here is an example, from the library @file{tooltip.el}:
 
 @example
-(defcustom show-paren-mode nil
-  "Toggle Show Paren mode..."
+(defcustom tooltip-mode nil
+  "Non-nil if Tooltip mode is enabled..."
   :set (lambda (symbol value)
-         (show-paren-mode (or value 0)))
+	 (tooltip-mode (or value 0)))
   :initialize 'custom-initialize-default
   :type 'boolean
-  :group 'paren-showing
-  :require 'paren)
+  :require 'tooltip
+  :group 'tooltip)
 @end example
 
 If a customization item has a type such as @code{hook} or @code{alist},
@@ -529,7 +529,7 @@
 The @code{group} widget is used here instead of @code{list} only because
 the formatting is better suited for the purpose.
 
-Similarily, you can have alists with more values associated with each
+Similarly, you can have alists with more values associated with each
 key, using variations of this trick:
 
 @smallexample
@@ -538,7 +538,7 @@
                          ("ken"    52 t))
   "Alist of basic info about people.
 Each element has the form (NAME AGE MALE-FLAG)."
-  :type '(alist :value-type (group age boolean)))
+  :type '(alist :value-type (group integer boolean)))
 
 (defcustom pets '(("brian")
                   ("dorith" "dog" "guppy")
@@ -665,7 +665,7 @@
 @end example
 
 @noindent
-so that the menu offers @samp{Number of spaces} and @samp{Literal Text}.
+so that the menu offers @samp{Number of spaces} and @samp{Literal text}.
 
 In any alternative for which @code{nil} is not a valid value, other than
 a @code{const}, you should specify a valid default for that alternative
@@ -824,8 +824,8 @@
 Use @var{criteria} to match possible values.  This is used only in
 @code{restricted-sexp}.
 
-@item :args @var{argumentlist}
-Use the elements of @var{argumentlist} as the arguments of the type
+@item :args @var{argument-list}
+Use the elements of @var{argument-list} as the arguments of the type
 construct.  For instance, @code{(const :args (foo))} is equivalent to
 @code{(const foo)}.  You rarely need to write @code{:args} explicitly,
 because normally the arguments are recognized automatically as
@@ -1066,12 +1066,12 @@
 @subsection Defining New Types
 
 In the previous sections we have described how to construct elaborate
-type specifications for @code{defcustom}.  In some cases you may want to
-give such a type specification a name.  The obvious case is when you are
-using the same type for many user options, rather than repeat the
-specification for each option, you can give the type specification a
-name once, and use that name each @code{defcustom}.  The other case is
-when a user option accept a recursive datastructure.  To make it
+type specifications for @code{defcustom}.  In some cases you may want
+to give such a type specification a name.  The obvious case is when
+you are using the same type for many user options: rather than repeat
+the specification for each option, you can give the type specification
+a name, and use that name each @code{defcustom}.  The other case is
+when a user option's value is a recursive data structure.  To make it
 possible for a datatype to refer to itself, it needs to have a name.
 
 Since custom types are implemented as widgets, the way to define a new
@@ -1097,40 +1097,39 @@
   :type 'binary-tree-of-string)
 @end example
 
-The function to define a new widget is name @code{define-widget}.  The
+The function to define a new widget is called @code{define-widget}.  The
 first argument is the symbol we want to make a new widget type.  The
 second argument is a symbol representing an existing widget, the new
 widget is going to be defined in terms of difference from the existing
 widget.  For the purpose of defining new customization types, the
-@code{lazy} widget is perfect, because it accept a @code{:type} keyword
+@code{lazy} widget is perfect, because it accepts a @code{:type} keyword
 argument with the same syntax as the keyword argument to
 @code{defcustom} with the same name.  The third argument is a
 documentation string for the new widget.  You will be able to see that
 string with the @kbd{M-x widget-browse @key{ret} binary-tree-of-string
 @key{ret}} command.
 
-After these mandatory arguments follows the keyword arguments.  The most
-important is @code{:type}, which describes the datatype we want to match
+After these mandatory arguments follow the keyword arguments.  The most
+important is @code{:type}, which describes the data type we want to match
 with this widget.  Here a @code{binary-tree-of-string} is described as
 being either a string, or a cons-cell whose car and cdr are themselves
 both @code{binary-tree-of-string}.  Note the reference to the widget
 type we are currently in the process of defining.  The @code{:tag}
 attribute is a string to name the widget in the user interface, and the
-@code{:offset} argument are there to ensure that child nodes are
-indented four spaces relatively to the parent node, making the tree
+@code{:offset} argument is there to ensure that child nodes are
+indented four spaces relative to the parent node, making the tree
 structure apparent in the customization buffer.
 
 The @code{defcustom} shows how the new widget can be used as an ordinary
 customization type.
 
-If you wonder about the name @code{lazy}, know that the other composite
-widgets convert their inferior widgets to internal form when the widget
-is instantiated in a buffer.  This conversion is recursive, so the
-inferior widgets will convert @emph{their} inferior widgets.  If the
-datastructure is itself recursive, this conversion will go on forever,
-or at least until Emacs run out of stack space.  The @code{lazy} widget
-stop this recursion, it will only convert its @code{:type} argument when
-needed.
+The reason for the name @code{lazy} is that the other composite
+widgets convert their inferior widgets to internal form when the
+widget is instantiated in a buffer.  This conversion is recursive, so
+the inferior widgets will convert @emph{their} inferior widgets.  If
+the data structure is itself recursive, this conversion is an infinite
+recursion.  The @code{lazy} widget prevents the recursion: it convert
+its @code{:type} argument only when needed.
 
 @ignore
    arch-tag: d1b8fad3-f48c-4ce4-a402-f73b5ef19bd2
--- a/lispref/display.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/display.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -2817,43 +2817,6 @@
 specify only the foreground color.
 @end defun
 
-@defvar indicate-buffer-boundaries
-This buffer-local variable controls how the buffer boundaries and
-window scrolling are indicated in the window fringes.
-
-Emacs can indicate the buffer boundaries---that is, the first and last
-line in the buffer---with angle icons when they appear on the screen.
-In addition, Emacs can display an up-arrow in the fringe to show
-that there is text above the screen, and a down-arrow to show
-there is text below the screen.
-
-There are four kinds of basic values:
-
-@table @asis
-@item @code{nil}
-Don't display the icons.
-@item @code{left}
-Display them in the left fringe.
-@item @code{right}
-Display them in the right fringe.
-@item @var{anything-else}
-Display the icon at the top of the window top in the left fringe, and other
-in the right fringe.
-@end table
-
-If value is a cons @code{(@var{angles} . @var{arrows})}, @var{angles}
-controls the angle icons, and @var{arrows} controls the arrows.  Both
-@var{angles} and @var{arrows} work according to the table above.
-Thus, @code{(t .  right)} places the top angle icon in the left
-fringe, the bottom angle icon in the right fringe, and both arrows in
-the right fringe.
-@end defvar
-
-@defvar default-indicate-buffer-boundaries
-The value of this variable is the default value for
-@code{indicate-buffer-boundaries} in buffers that do not override it.
-@end defvar
-
 @node Scroll Bars
 @section Scroll Bars
 
@@ -2903,6 +2866,19 @@
 window take note of the new values by calling @code{set-window-buffer}
 specifying the same buffer that is already displayed.
 
+@defvar scroll-bar-mode
+This variable, always local in all buffers, controls whether and where
+to put scroll bars in windows displaying the buffer.  The possible values
+are @code{nil} for no scroll bar, @code{left} to put a scroll bar on
+the left, and @code{right} to put a scroll bar on the right.
+@end defvar
+
+@defvar scroll-bar-width
+This variable, always local in all buffers, specifies the width of the
+buffer's scroll bars, measured in pixels.  A value of @code{nil} means
+to use the value specified by the frame.
+@end defvar
+
 @node Pointer Shape
 @section Pointer Shape
 
@@ -4386,6 +4362,14 @@
 buffers that do not override it.  @xref{Default Value}.
 @end defvar
 
+@defopt tab-width
+The value of this variable is the spacing between tab stops used for
+displaying tab characters in Emacs buffers.  The value is in units of
+columns, and the default is 8.  Note that this feature is completely
+independent of the user-settable tab stops used by the command
+@code{tab-to-tab-stop}.  @xref{Indent Tabs}.
+@end defopt
+
 @defopt indicate-empty-lines
 @tindex indicate-empty-lines
 @cindex fringes, and empty line indication
@@ -4394,13 +4378,42 @@
 support it (window systems).  @xref{Fringes}.
 @end defopt
 
-@defopt tab-width
-The value of this variable is the spacing between tab stops used for
-displaying tab characters in Emacs buffers.  The value is in units of
-columns, and the default is 8.  Note that this feature is completely
-independent of the user-settable tab stops used by the command
-@code{tab-to-tab-stop}.  @xref{Indent Tabs}.
-@end defopt
+@defvar indicate-buffer-boundaries
+This buffer-local variable controls how the buffer boundaries and
+window scrolling are indicated in the window fringes.
+
+Emacs can indicate the buffer boundaries---that is, the first and last
+line in the buffer---with angle icons when they appear on the screen.
+In addition, Emacs can display an up-arrow in the fringe to show
+that there is text above the screen, and a down-arrow to show
+there is text below the screen.
+
+There are four kinds of basic values:
+
+@table @asis
+@item @code{nil}
+Don't display the icons.
+@item @code{left}
+Display them in the left fringe.
+@item @code{right}
+Display them in the right fringe.
+@item @var{anything-else}
+Display the icon at the top of the window top in the left fringe, and other
+in the right fringe.
+@end table
+
+If value is a cons @code{(@var{angles} . @var{arrows})}, @var{angles}
+controls the angle icons, and @var{arrows} controls the arrows.  Both
+@var{angles} and @var{arrows} work according to the table above.
+Thus, @code{(t .  right)} places the top angle icon in the left
+fringe, the bottom angle icon in the right fringe, and both arrows in
+the right fringe.
+@end defvar
+
+@defvar default-indicate-buffer-boundaries
+The value of this variable is the default value for
+@code{indicate-buffer-boundaries} in buffers that do not override it.
+@end defvar
 
 @node Display Tables
 @section Display Tables
--- a/lispref/intro.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/intro.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -269,7 +269,7 @@
 
 @example
 @group
-(progn (prin1 'foo) (princ "\n") (print 'bar))
+(progn (prin1 'foo) (princ "\n") (prin1 'bar))
      @print{} foo
      @print{} bar
      @result{} bar
--- a/lispref/locals.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/locals.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -36,6 +36,9 @@
 @item buffer-display-table
 @xref{Display Tables}.
 
+@item buffer-display-time
+@xref{Buffers and Windows}.
+
 @item buffer-file-coding-system
 @xref{Encoding and I/O}.
 
@@ -78,6 +81,9 @@
 @item ctl-arrow
 @xref{Usual Display}.
 
+@item cursor-type
+@xref{Window Frame Parameters}.
+
 @item comment-column
 @xref{Comments,,, emacs, The GNU Emacs Manual}.
 
@@ -90,27 +96,45 @@
 @item desktop-save-buffer
 @xref{Desktop Save Mode}.
 
+@ignore
+@item direction-reversed
+Does not work yet.
+@end ignore
+
 @item enable-multibyte-characters
 @ref{Non-ASCII Characters}.
 
 @item fill-column
 @xref{Auto Filling}.
 
+@item fringes-outside-margins
+@xref{Fringes}.
+
 @item goal-column
 @xref{Moving Point,,, emacs, The GNU Emacs Manual}.
 
 @item header-line-format
 @xref{Mode Line Data}.
 
+@item indicate-buffer-boundaries
+@xref{Usual Display}.
+
 @item indicate-empty-lines
 @xref{Usual Display}.
 
+@item left-fringe-width
+@xref{Fringes}.
+
 @item left-margin
 @xref{Indentation}.
 
 @item left-margin-width
 @xref{Display Margins}.
 
+@item line-spacing
+@c Cause an error so we will fix this.
+@xref{Yet to be written}.
+
 @item local-abbrev-table
 @xref{Abbrevs}.
 
@@ -123,9 +147,6 @@
 @item mark-ring
 @xref{The Mark}.
 
-@item minor-modes
-@xref{Minor Modes}.
-
 @item mode-line-buffer-identification
 @xref{Mode Line Variables}.
 
@@ -144,21 +165,18 @@
 @item overwrite-mode
 @xref{Insertion}.
 
-@item paragraph-separate
-@xref{Standard Regexps}.
-
-@item paragraph-start
-@xref{Standard Regexps}.
-
 @item point-before-scroll
 Used for communication between mouse commands and scroll-bar commands.
 
-@item require-final-newline
-@xref{Insertion}.
+@item right-fringe-width
+@xref{Fringes}.
 
 @item right-margin-width
 @xref{Display Margins}.
 
+@item scroll-bar-width
+@xref{Scroll Bars}.
+
 @item scroll-down-aggressively
 @xref{Textual Scrolling}.
 
@@ -179,6 +197,9 @@
 
 @item vc-mode
 @xref{Mode Line Variables}.
+
+@item vertical-scroll-bar
+@xref{Yet to be written}.
 @end table
 
 @ignore
--- a/lispref/numbers.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/numbers.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -308,6 +308,13 @@
 returns @code{t} if so, @code{nil} otherwise.
 @end defun
 
+@defun eql value1 value2
+This function compares two floating point numbers like @code{=}, and
+compares two integers like @code{=}, and acts like @code{eq} in all
+other cases.  Thus, @code{(eql 1.0 1)} returns @code{nil}, but
+@code{(eql 1.0 1.0)} and @code{(eql 1 1)} both return @code{t}.
+@end defun
+
 @defun /= number-or-marker1 number-or-marker2
 This function tests whether its arguments are numerically equal, and
 returns @code{t} if they are not, and @code{nil} if they are.
--- a/lispref/processes.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/processes.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -328,7 +328,7 @@
 
 Some file handlers may not support all combinations and forms of the
 arguments @var{infile}, @var{buffer}, and @var{display}.  For example,
-some file handlers might behave as if @var{display} was @code{nil},
+some file handlers might behave as if @var{display} were @code{nil},
 regardless of the value actually passed.  As another example, some
 file handlers might not support separating standard output and error
 output by way of the @var{buffer} argument.
--- a/lispref/syntax.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/syntax.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/syntax
@@ -505,12 +505,6 @@
 This function returns a description of the syntax of the character in
 the buffer after position @var{pos}, taking account of syntax
 properties as well as the syntax table.
-
-The value is usually a syntax class character; however, if the buffer
-character has parenthesis syntax, the value is a cons cell of the form
-@code{(@var{class} . @var{match})}, where @var{class} is the syntax
-class character and @var{match} is the buffer character's matching
-parenthesis.
 @end defun
 
 @defun set-syntax-table table
--- a/lispref/text.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/text.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -1244,6 +1244,12 @@
 undo individual replacements one by one.
 @end defun
 
+@defvar undo-in-progress
+This variable is normally @code{nil}, but the undo commands bind it to
+@code{t}.  This is so that various kinds of change hooks can tell when
+they're being called for the sake of undoing.
+@end defvar
+
 @defun primitive-undo count list
 This is the basic function for undoing elements of an undo list.
 It undoes the first @var{count} elements of @var{list}, returning
@@ -1256,6 +1262,8 @@
 undo operations use and update the saved value.  The new elements added
 by undoing are not part of this saved value, so they don't interfere with
 continuing to undo.
+
+This function does not bind @code{undo-in-progress}.
 @end defun
 
 @node Maintaining Undo
--- a/lispref/windows.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/lispref/windows.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -488,7 +488,9 @@
 
 The selected window can be the least recently used window if it is the
 only window.  A newly created window becomes the least recently used
-window until it is selected.  A minibuffer window is never a candidate.
+window until it is selected.  A minibuffer window is never a
+candidate.  Dedicated windows are never candidates, and if all
+existing windows are dedicated, the value is @code{nil}.
 
 The argument @var{frame} controls which windows are considered.
 
@@ -510,10 +512,12 @@
 This function returns the window with the largest area (height times
 width).  If there are no side-by-side windows, then this is the window
 with the most lines.  A minibuffer window is never a candidate.
+Dedicated windows are never candidates, and if all existing windows
+are dedicated, the value is @code{nil}.
 
-If there are two windows of the same size, then the function returns
-the window that is first in the cyclic ordering of windows (see
-following section), starting from the selected window.
+If there are two candidate windows of the same size, this function
+prefers the one that comes first in the cyclic ordering of windows
+(see following section), starting from the selected window.
 
 The argument @var{frame} controls which set of windows to
 consider.  See @code{get-lru-window}, above.
--- a/man/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,81 @@
+2004-12-06  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi (Using Calc): Remove paragraph about installation.
+
+2004-12-06  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi: Use more Texinfo macros and less TeX defs.
+	Remove @refill's.
+
+2004-12-06  Richard M. Stallman  <rms@gnu.org>
+
+	* org.texi: New file.
+
+2004-12-05  Richard M. Stallman  <rms@gnu.org>
+
+	* cmdargs.texi, doclicense.texi, xresources.texi, emacs.texi:
+	* entering.texi: Rename Command Line to Emacs Invocation.
+
+	* Makefile.in (org.dvi, ../info/org): New targets.
+	(INFO_TARGETS): Add ../info/org.
+	(DVI_TARGETS): Add org.dvi.
+	(maintainer-clean): Remove the info files in the info dir.
+
+	* misc.texi (Term Mode): Correcty describe C-c.
+
+	* custom.texi (Easy Customization): Move up to section level,
+	before Variables.  Avoid using the term "variable"; say "option".
+	New initial explanation.
+	(Variables): In initial explanation, connect "variable" to the
+	already-explained "user option".
+
+	* emacs.texi (Top): Fix ref to Command Line.
+	Move reference to Easy Customization.
+
+	* xresources.texi (X Resources): Fix From link.
+
+	* doclicense.texi (GNU Free Documentation License): Fix To link.
+
+	* entering.texi (Entering Emacs): Fix xref, now to Command Line.
+
+	* cmdargs.texi (Command Line): Node renamed from Command Arguments.
+
+2004-12-03  Richard M. Stallman  <rms@gnu.org>
+
+	* cmdargs.texi (Initial Options): Clarify batch mode i/o.
+
+2004-12-01  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* kmacro.texi: Several small changes in addition to the following.
+	(Keyboard Macro Ring): Describe behavior of `C-x C-k C-k' when
+	defining a keyboard macro.
+	Mention `kmacro-ring-max'.
+	(Keyboard Macro Counter): Clarify description of
+	`kmacro-insert-counter', `kmacro-set-counter',
+	`kmacro-add-counter' and `kmacro-set-format'.
+
+2004-11-29  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* custom.texi (File Variables): Add `unibyte' and make it more
+	clear that `unibyte' and `coding' are special.  Suggested by Simon
+	Krahnke <overlord@gmx.li>.
+
+	* mule.texi (Enabling Multibyte): Refer to File Variables.
+	Suggested by Simon Krahnke <overlord@gmx.li>.
+
+2004-11-26  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* frames.texi (Dialog Boxes): Rename use-old-gtk-file-dialog to
+	x-use-old-gtk-file-dialog.
+
+2004-11-26  Eli Zaretskii  <eliz@gnu.org>
+
+	* idlwave.texi: Fix the setfilename directive to put the produced
+	file in ../info.
+	(Continued Statement Indentation): Resurrect Jan D.'s change from
+	2004-11-03 that was lost when a newer version of idlwave.texi was
+	imported.
+
 2004-11-20  Richard M. Stallman  <rms@gnu.org>
 
 	* text.texi (Fill Prefix): M-q doesn't apply fill prefix to first line.
@@ -45,6 +123,7 @@
 	(Table Misc): New nodes, documenting the Table Mode.
 
 2004-10-21  Jay Belanger  <belanger@truman.edu>
+
 	* calc.texi (Algebraic-Style Calculations): Removed a comment.
 
 2004-10-19  Jason Rumney  <jasonr@gnu.org>
--- a/man/Makefile.in	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/Makefile.in	Wed Dec 08 22:20:27 2004 +0000
@@ -39,7 +39,7 @@
 		../info/sc ../info/vip ../info/viper ../info/widget \
 		../info/efaq ../info/ada-mode ../info/autotype ../info/calc \
 		../info/idlwave ../info/eudc ../info/ebrowse ../info/pcl-cvs \
-		../info/woman ../info/eshell \
+		../info/woman ../info/eshell ../info/org \
 		../info/speedbar ../info/tramp ../info/ses ../info/smtpmail \
 		../info/flymake
 DVI_TARGETS = 	emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
@@ -47,7 +47,7 @@
                  gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \
 		 reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
 		 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
-		 pcl-cvs.dvi woman.dvi eshell.dvi \
+		 pcl-cvs.dvi woman.dvi eshell.dvi org.el \
 		 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi \
                  emacs-xtra.dvi
 INFOSOURCES = info.texi
@@ -286,6 +286,11 @@
 woman.dvi: woman.texi
 	$(ENVADD) $(TEXI2DVI) ${srcdir}/woman.texi
 
+../info/org: org.texi
+	cd $(srcdir); $(MAKEINFO) org.texi
+org.dvi: org.texi
+	$(ENVADD) $(TEXI2DVI) ${srcdir}/org.texi
+
 ../info/speedbar: speedbar.texi
 	cd $(srcdir); $(MAKEINFO) speedbar.texi
 speedbar.dvi: speedbar.texi
@@ -321,8 +326,7 @@
 
 maintainer-clean: distclean
 	rm -f *.aux *.cps *.fns *.kys *.pgs *.vrs *.toc
-# Don't delete these, because they are outside the current directory.
-#	for file in $(INFO_TARGETS); do rm -f $${file}*; done
+	for file in $(INFO_TARGETS); do rm -f $${file}*; done
 
 
 # Formerly this directory had texindex.c and getopt.c in it
--- a/man/calc.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/calc.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -7,33 +7,60 @@
 @setchapternewpage odd
 @comment %**end of header (This is for running Texinfo on a region.)
 
-@tex
-% Some special kludges to make TeX formatting prettier.
-% Because makeinfo.c exists, we can't just define new commands.
-% So instead, we take over little-used existing commands.
-%
+@c The following macros are used for conditional output for single lines.
+@c @texline foo
+@c    `foo' will appear only in TeX output
+@c @infoline foo
+@c    `foo' will appear only in non-TeX output
+
+@c In TeX output, @tmath{expr} will typeset expr in  math mode.
+@c In any output, @expr{expr} will typeset an expression;
+@c $x$ in TeX, @samp{x} otherwise.
+
+@iftex
+@macro texline{stuff}
+\stuff\
+@end macro
+@macro tmath{stuff}
+@tex
+$\stuff\$
+@end tex
+@end macro
+@alias infoline=comment
+@c @alias expr=math
+@tex
+\gdef\expr#1{\tex 
+             \let\t\ttfont 
+             \turnoffactive 
+             $#1$
+             \endgroup}
+@end tex
+@macro cpi{}
+@math{@pi{}}
+@end macro
+@macro cpiover{den}
+@math{@pi/\den\}
+@end macro
+@end iftex
+
+@ifnottex
+@alias texline=comment
+@macro infoline{stuff}
+\stuff\
+@end macro
+@alias expr=samp
+@macro cpi{}
+@expr{pi}
+@end macro
+@macro cpiover{den}
+@expr{pi/\den\}
+@end macro
+@end ifnottex
+
+
+@tex
 % Suggested by Karl Berry <karl@@freefriends.org>
 \gdef\!{\mskip-\thinmuskip}
-% Redefine @cite{text} to act like $text$ in regular TeX.
-% Info will typeset this same as @samp{text}.
-\gdef\goodtex{\tex \let\rm\goodrm \let\t\ttfont \turnoffactive}
-\gdef\goodrm{\fam0\tenrm}
-\gdef\cite{\goodtex$\citexxx}
-\gdef\citexxx#1{#1$\Etex}
-\global\let\oldxrefX=\xrefX
-\gdef\xrefX[#1]{\begingroup\let\cite=\dfn\oldxrefX[#1]\endgroup}
-
-% Redefine @c{tex-stuff} \n @whatever{info-stuff}.
-\gdef\c{\futurelet\next\mycxxx}
-\gdef\mycxxx{%
-  \ifx\next\bgroup \goodtex\let\next\mycxxy
-  \else\ifx\next\mindex \let\next\relax
-  \else\ifx\next\kindex \let\next\relax
-  \else\ifx\next\starindex \let\next\relax \else \let\next\comment
-  \fi\fi\fi\fi \next
-}
-\gdef\mycxxy#1#2{#1\Etex\mycxxz}
-\gdef\mycxxz#1{}
 @end tex
 
 @c Fix some other things specifically for this manual.
@@ -513,8 +540,9 @@
 @cindex Marginal notes
 Every Calc keyboard command is listed in the Calc Summary, and also
 in the Key Index.  Algebraic functions, @kbd{M-x} commands, and
-variables also have their own indices.  @c{Each}
-@asis{In the printed manual, each}
+variables also have their own indices.  
+@texline Each
+@infoline In the printed manual, each
 paragraph that is referenced in the Key or Function Index is marked
 in the margin with its index entry.
 
@@ -570,7 +598,7 @@
 be @samp{cos(@var{x})}.
 
 A few commands don't have key equivalents:  @code{calc-sincos}
-[@code{sincos}].@refill
+[@code{sincos}].
 
 @node Demonstration of Calc, Using Calc, Notations Used in This Manual, Getting Started
 @section A Demonstration of Calc
@@ -595,12 +623,14 @@
 then the command to operate on the numbers.
 
 @noindent
-Type @kbd{2 @key{RET} 3 + Q} to compute @c{$\sqrt{2+3} = 2.2360679775$}
-@asis{the square root of 2+3, which is 2.2360679775}.
-
-@noindent
-Type @kbd{P 2 ^} to compute @c{$\pi^2 = 9.86960440109$}
-@asis{the value of `pi' squared, 9.86960440109}.
+Type @kbd{2 @key{RET} 3 + Q} to compute 
+@texline @tmath{\sqrt{2+3} = 2.2360679775}.
+@infoline the square root of 2+3, which is 2.2360679775.
+
+@noindent
+Type @kbd{P 2 ^} to compute 
+@texline @tmath{\pi^2 = 9.86960440109}.
+@infoline the value of `pi' squared, 9.86960440109.
 
 @noindent
 Type @key{TAB} to exchange the order of these two results.
@@ -617,13 +647,15 @@
 use the apostrophe key.
 
 @noindent
-Type @kbd{' sqrt(2+3) @key{RET}} to compute @c{$\sqrt{2+3}$}
-@asis{the square root of 2+3}.
-
-@noindent
-Type @kbd{' pi^2 @key{RET}} to enter @c{$\pi^2$}
-@asis{`pi' squared}.  To evaluate this symbolic
-formula as a number, type @kbd{=}.
+Type @kbd{' sqrt(2+3) @key{RET}} to compute 
+@texline @tmath{\sqrt{2+3}}.
+@infoline the square root of 2+3.
+
+@noindent
+Type @kbd{' pi^2 @key{RET}} to enter 
+@texline @tmath{\pi^2}.
+@infoline `pi' squared.  
+To evaluate this symbolic formula as a number, type @kbd{=}.
 
 @noindent
 Type @kbd{' arcsinh($ - $$) @key{RET}} to subtract the second-most-recent
@@ -680,12 +712,16 @@
 the lower-right @samp{8} and press @kbd{M-# r}.
 
 @noindent
-Type @kbd{v t} to transpose this @c{$3\times2$}
-@asis{3x2} matrix into a @c{$2\times3$}
-@asis{2x3} matrix.  Type
-@w{@kbd{v u}} to unpack the rows into two separate vectors.  Now type
-@w{@kbd{V R + @key{TAB} V R +}} to compute the sums of the two original columns.
-(There is also a special grab-and-sum-columns command, @kbd{M-# :}.)
+Type @kbd{v t} to transpose this 
+@texline @tmath{3\times2}
+@infoline 3x2 
+matrix into a 
+@texline @tmath{2\times3}
+@infoline 2x3
+matrix.  Type @w{@kbd{v u}} to unpack the rows into two separate
+vectors.  Now type @w{@kbd{V R + @key{TAB} V R +}} to compute the sums
+of the two original columns. (There is also a special
+grab-and-sum-columns command, @kbd{M-# :}.)
 
 @strong{Units conversion.}  Units are entered algebraically.
 Type @w{@kbd{' 43 mi/hr @key{RET}}} to enter the quantity 43 miles-per-hour.
@@ -701,7 +737,7 @@
 to enter a pair of equations involving three variables.
 (Note the leading apostrophe in this example; also, note that the space
 between @samp{x y} is required.)  Type @w{@kbd{a S x,y @key{RET}}} to solve
-these equations for the variables @cite{x} and @cite{y}.@refill
+these equations for the variables @expr{x} and @expr{y}.
 
 @noindent
 Type @kbd{d B} to view the solutions in more readable notation.
@@ -710,7 +746,7 @@
 Type @kbd{d N} to return to normal notation.
 
 @noindent
-Type @kbd{7.5}, then @kbd{s l a @key{RET}} to let @cite{a = 7.5} in these formulas.
+Type @kbd{7.5}, then @kbd{s l a @key{RET}} to let @expr{a = 7.5} in these formulas.
 (That's a letter @kbd{l}, not a numeral @kbd{1}.)
 
 @iftex
@@ -739,12 +775,6 @@
 different kinds of tasks.  As well as Calc's standard interface,
 there are Quick Mode, Keypad Mode, and Embedded Mode.
 
-@c [fix-ref Installation]
-Calc must be @dfn{installed} before it can be used.  @xref{Installation},
-for instructions on setting up and installing Calc.  We will assume
-you or someone on your system has already installed Calc as described
-there.
-
 @menu
 * Starting Calc::
 * The Standard Interface::
@@ -769,7 +799,7 @@
 @key{ESC} first, then @kbd{#}, to accomplish the same thing.  If you
 don't even have an @key{ESC} key, you can fake it by holding down
 Control or @key{CTRL} while typing a left square bracket
-(that's @kbd{C-[} in Emacs notation).@refill
+(that's @kbd{C-[} in Emacs notation).
 
 @kbd{M-#} is a @dfn{prefix key}; when you press it, Emacs waits for
 you to press a second key to complete the command.  In this case,
@@ -853,7 +883,7 @@
 Shifted (i.e., upper-case) letters are different from lowercase
 letters.  Some letters are @dfn{prefix} keys that begin two-letter
 commands.  For example, @kbd{e} means ``enter exponent'' and shifted
-@kbd{E} means @cite{e^x}.  With the @kbd{d} (``display modes'') prefix
+@kbd{E} means @expr{e^x}.  With the @kbd{d} (``display modes'') prefix
 the letter ``e'' takes on very different meanings:  @kbd{d e} means
 ``engineering notation'' and @kbd{d E} means ``@dfn{eqn} language mode.''
 
@@ -1317,13 +1347,15 @@
 @noindent
 Calc was originally started as a two-week project to occupy a lull
 in the author's schedule.  Basically, a friend asked if I remembered
-the value of @c{$2^{32}$}
-@cite{2^32}.  I didn't offhand, but I said, ``that's
-easy, just call up an @code{xcalc}.''  @code{Xcalc} duly reported
-that the answer to our question was @samp{4.294967e+09}---with no way to
-see the full ten digits even though we knew they were there in the
-program's memory!  I was so annoyed, I vowed to write a calculator
-of my own, once and for all.
+the value of 
+@texline @tmath{2^{32}}.
+@infoline @expr{2^32}.  
+I didn't offhand, but I said, ``that's easy, just call up an
+@code{xcalc}.''  @code{Xcalc} duly reported that the answer to our
+question was @samp{4.294967e+09}---with no way to see the full ten
+digits even though we knew they were there in the program's memory!  I
+was so annoyed, I vowed to write a calculator of my own, once and for
+all.
 
 I chose Emacs Lisp, a) because I had always been curious about it
 and b) because, being only a text editor extension language after
@@ -1373,18 +1405,19 @@
 Many people have contributed to Calc by reporting bugs and suggesting
 features, large and small.  A few deserve special mention:  Tim Peters,
 who helped develop the ideas that led to the selection commands, rewrite
-rules, and many other algebra features; @c{Fran\c cois}
-@asis{Francois} Pinard, who contributed
-an early prototype of the Calc Summary appendix as well as providing
-valuable suggestions in many other areas of Calc; Carl Witty, whose eagle
-eyes discovered many typographical and factual errors in the Calc manual;
-Tim Kay, who drove the development of Embedded mode; Ove Ewerlid, who
-made many suggestions relating to the algebra commands and contributed
-some code for polynomial operations; Randal Schwartz, who suggested the
-@code{calc-eval} function; Robert J. Chassell, who suggested the Calc
-Tutorial and exercises; and Juha Sarlin, who first worked out how to split
-Calc into quickly-loading parts.  Bob Weiner helped immensely with the
-Lucid Emacs port.
+rules, and many other algebra features; 
+@texline Fran\c cois
+@infoline Francois
+Pinard, who contributed an early prototype of the Calc Summary appendix
+as well as providing valuable suggestions in many other areas of Calc;
+Carl Witty, whose eagle eyes discovered many typographical and factual
+errors in the Calc manual; Tim Kay, who drove the development of
+Embedded mode; Ove Ewerlid, who made many suggestions relating to the
+algebra commands and contributed some code for polynomial operations;
+Randal Schwartz, who suggested the @code{calc-eval} function; Robert
+J. Chassell, who suggested the Calc Tutorial and exercises; and Juha
+Sarlin, who first worked out how to split Calc into quickly-loading
+parts.  Bob Weiner helped immensely with the Lucid Emacs port.
 
 @cindex Bibliography
 @cindex Knuth, Art of Computer Programming
@@ -1545,8 +1578,8 @@
 
 @cindex Operators
 @cindex Operands
-In an operation like @cite{2+3}, the 2 and 3 are called the @dfn{operands}
-and the @cite{+} is the @dfn{operator}.  In an RPN calculator you always
+In an operation like @expr{2+3}, the 2 and 3 are called the @dfn{operands}
+and the @expr{+} is the @dfn{operator}.  In an RPN calculator you always
 enter the operands first, then the operator.  Each time you type a
 number, Calc adds or @dfn{pushes} it onto the top of the Stack.
 When you press an operator key like @kbd{+}, Calc @dfn{pops} the appropriate
@@ -1560,7 +1593,7 @@
 The first four keystrokes ``push'' the numbers 2 and 3 onto the stack.
 The @kbd{+} key ``pops'' the top two numbers from the stack, adds them,
 and pushes the result (5) back onto the stack.  Here's how the stack
-will look at various points throughout the calculation:@refill
+will look at various points throughout the calculation:
 
 @smallexample
 @group
@@ -1581,11 +1614,11 @@
 @cindex Levels of stack
 The numbers @samp{1:} and @samp{2:} on the left are @dfn{stack level
 numbers}.  Old RPN calculators always had four stack levels called
-@cite{x}, @cite{y}, @cite{z}, and @cite{t}.  Calc's stack can grow
+@expr{x}, @expr{y}, @expr{z}, and @expr{t}.  Calc's stack can grow
 as large as you like, so it uses numbers instead of letters.  Some
 stack-manipulation commands accept a numeric argument that says
 which stack level to work on.  Normal commands like @kbd{+} always
-work on the top few levels of the stack.@refill
+work on the top few levels of the stack.
 
 @c [fix-ref Truncating the Stack]
 The Stack buffer is just an Emacs buffer, and you can move around in
@@ -1602,7 +1635,7 @@
 @key{RET} +}.  That's because if you type any operator name or
 other non-numeric key when you are entering a number, the Calculator
 automatically enters that number and then does the requested command.
-Thus @kbd{2 @key{RET} 3 +} will work just as well.@refill
+Thus @kbd{2 @key{RET} 3 +} will work just as well.
 
 Examples in this tutorial will often omit @key{RET} even when the
 stack displays shown would only happen if you did press @key{RET}:
@@ -1636,9 +1669,10 @@
 multiplication.)  Figure it out by hand, then try it with Calc to see
 if you're right.  @xref{RPN Answer 1, 1}. (@bullet{})
 
-(@bullet{}) @strong{Exercise 2.}  Compute @c{$(2\times4) + (7\times9.4) + {5\over4}$}
-@cite{2*4 + 7*9.5 + 5/4} using the
-stack.  @xref{RPN Answer 2, 2}. (@bullet{})
+(@bullet{}) @strong{Exercise 2.}  Compute 
+@texline @tmath{(2\times4) + (7\times9.4) + {5\over4}}
+@infoline @expr{2*4 + 7*9.5 + 5/4} 
+using the stack.  @xref{RPN Answer 2, 2}. (@bullet{})
 
 The @key{DEL} key is called Backspace on some keyboards.  It is
 whatever key you would use to correct a simple typing error when
@@ -1690,7 +1724,7 @@
 Another stack manipulation key is @key{TAB}.  This exchanges the top
 two stack entries.  Suppose you have computed @kbd{2 @key{RET} 3 +}
 to get 5, and then you realize what you really wanted to compute
-was @cite{20 / (2+3)}.
+was @expr{20 / (2+3)}.
 
 @smallexample
 @group
@@ -1798,11 +1832,10 @@
 @end smallexample
 
 @noindent
-The notation @cite{(a, b)} represents a complex number.
-Complex numbers are more traditionally written @c{$a + b i$}
-@cite{a + b i};
+The notation @expr{(a, b)} represents a complex number.
+Complex numbers are more traditionally written @expr{a + b i};
 Calc can display in this format, too, but for now we'll stick to the
-@cite{(a, b)} notation.
+@expr{(a, b)} notation.
 
 If you don't know how complex numbers work, you can safely ignore this
 feature.  Complex numbers only arise from operations that would be
@@ -1861,7 +1894,7 @@
 entry and the top are collected, so there's never really a reason
 to use the comma.  It's up to you.
 
-(@bullet{}) @strong{Exercise 4.}  To enter the complex number @cite{(2, 3)},
+(@bullet{}) @strong{Exercise 4.}  To enter the complex number @expr{(2, 3)},
 your friend Joe typed @kbd{( 2 , @key{SPC} 3 )}.  What happened?
 (Joe thought of a clever way to correct his mistake in only two
 keystrokes, but it didn't quite work.  Try it to find out why.)
@@ -1921,7 +1954,7 @@
 If you are not used to RPN notation, you may prefer to operate the
 Calculator in ``algebraic mode,'' which is closer to the way
 non-RPN calculators work.  In algebraic mode, you enter formulas
-in traditional @cite{2+3} notation.
+in traditional @expr{2+3} notation.
 
 You don't really need any special ``mode'' to enter algebraic formulas.
 You can enter a formula at any time by pressing the apostrophe (@kbd{'})
@@ -2004,7 +2037,7 @@
 the notation @samp{sqrt(@var{x})}.
 
 Press the apostrophe, then type @kbd{sqrt(5*2) - 3}.  The result should
-be @cite{0.16227766017}.
+be @expr{0.16227766017}.
 
 Note that if the formula begins with a function name, you need to use
 the apostrophe even if you are in algebraic mode.  If you type @kbd{arcsin}
@@ -2030,7 +2063,7 @@
 
 Algebraic mode allows us to enter complex numbers without pressing
 an apostrophe first, but it also means we need to press @key{RET}
-after every entry, even for a simple number like @cite{1}.
+after every entry, even for a simple number like @expr{1}.
 
 (You can type @kbd{C-u m a} to enable a special ``incomplete algebraic
 mode'' in which the @kbd{(} and @kbd{[} keys use algebraic entry even
@@ -2050,8 +2083,9 @@
 accomplish this in Calc by performing your calculation as a series
 of algebraic entries, using the @kbd{$} sign to tie them together.
 In an algebraic formula, @kbd{$} represents the number on the top
-of the stack.  Here, we perform the calculation @c{$\sqrt{2\times4+1}$}
-@cite{sqrt(2*4+1)},
+of the stack.  Here, we perform the calculation 
+@texline @tmath{\sqrt{2\times4+1}},
+@infoline @expr{sqrt(2*4+1)},
 which on a traditional calculator would be done by pressing
 @kbd{2 * 4 + 1 =} and then the square-root key.
 
@@ -2190,7 +2224,7 @@
 
 @noindent
 Notice that the instant we stored a new value in @code{a}, all
-@samp{=>} operators already on the stack that referred to @cite{a}
+@samp{=>} operators already on the stack that referred to @expr{a}
 were updated to use the new value.  With @samp{=>}, you can push a
 set of formulas on the stack, then change the variables experimentally
 to see the effects on the formulas' values.
@@ -2257,7 +2291,7 @@
 @end smallexample
 
 @noindent
-It was not possible to redo past the @cite{6}, since that was placed there
+It was not possible to redo past the @expr{6}, since that was placed there
 by something other than an undo command.
 
 @cindex Time travel
@@ -2265,7 +2299,7 @@
 @kbd{U} to go backward in time, @kbd{D} to go forward.  If you go
 backward and do something (like @kbd{*}) then, as any science fiction
 reader knows, you have changed your future and you cannot go forward
-again.  Thus, the inability to redo past the @cite{6} even though there
+again.  Thus, the inability to redo past the @expr{6} even though there
 was an earlier undo command.
 
 You can always recall an earlier result using the Trail.  We've ignored
@@ -2273,13 +2307,13 @@
 did since we loaded the Calculator.  If the Trail is not displayed,
 press @kbd{t d} now to turn it on.
 
-Let's try grabbing an earlier result.  The @cite{8} we computed was
+Let's try grabbing an earlier result.  The @expr{8} we computed was
 undone by a @kbd{U} command, and was lost even to Redo when we pressed
 @kbd{*}, but it's still there in the trail.  There should be a little
 @samp{>} arrow (the @dfn{trail pointer}) resting on the last trail
 entry.  If there isn't, press @kbd{t ]} to reset the trail pointer.
 Now, press @w{@kbd{t p}} to move the arrow onto the line containing
-@cite{8}, and press @w{@kbd{t y}} to ``yank'' that number back onto the
+@expr{8}, and press @w{@kbd{t y}} to ``yank'' that number back onto the
 stack.
 
 If you press @kbd{t ]} again, you will see that even our Yank command
@@ -2340,8 +2374,7 @@
 to edit a stack entry.
 
 Try entering @samp{3.141439} now.  If this is supposed to represent
-@c{$\pi$}
-@cite{pi}, it's got several errors.  Press @kbd{`} to edit this number.
+@cpi{}, it's got several errors.  Press @kbd{`} to edit this number.
 Now use the normal Emacs cursor motion and editing keys to change
 the second 4 to a 5, and to transpose the 3 and the 9.  When you
 press @key{RET}, the number on the stack will be replaced by your
@@ -2370,7 +2403,7 @@
 about, but the @samp{12} and the @samp{Deg} are mode indicators.
 The @samp{12} means that calculations should always be carried to
 12 significant figures.  That is why, when we type @kbd{1 @key{RET} 7 /},
-we get @cite{0.142857142857} with exactly 12 digits, not counting
+we get @expr{0.142857142857} with exactly 12 digits, not counting
 leading and trailing zeros.
 
 You can set the precision to anything you like by pressing @kbd{p},
@@ -2387,14 +2420,14 @@
 
 Although the precision can be set arbitrarily high, Calc always
 has to have @emph{some} value for the current precision.  After
-all, the true value @cite{1/7} is an infinitely repeating decimal;
+all, the true value @expr{1/7} is an infinitely repeating decimal;
 Calc has to stop somewhere.
 
 Of course, calculations are slower the more digits you request.
 Press @w{@kbd{p 12}} now to set the precision back down to the default.
 
 Calculations always use the current precision.  For example, even
-though we have a 30-digit value for @cite{1/7} on the stack, if
+though we have a 30-digit value for @expr{1/7} on the stack, if
 we use it in a calculation in 12-digit mode it will be rounded
 down to 12 digits before it is used.  Try it; press @key{RET} to
 duplicate the number, then @w{@kbd{1 +}}.  Notice that the @key{RET}
@@ -2412,7 +2445,7 @@
 
 @noindent
 In fact, since we added a digit on the left, we had to lose one
-digit on the right from even the 12-digit value of @cite{1/7}.
+digit on the right from even the 12-digit value of @expr{1/7}.
 
 How did we get more than 12 digits when we computed @samp{2^3^4}?  The
 answer is that Calc makes a distinction between @dfn{integers} and
@@ -2463,7 +2496,7 @@
 @noindent
 Hey, the answer is different!  Look closely at the middle columns
 of the two examples.  In the first, the stack contained the
-exact integer @cite{10000}, but in the second it contained
+exact integer @expr{10000}, but in the second it contained
 a floating-point value with a decimal point.  When you raise a
 number to an integer power, Calc uses repeated squaring and
 multiplication to get the answer.  When you use a floating-point
@@ -2564,7 +2597,7 @@
 format; since it doesn't have an @kbd{H} prefix, it also updates all
 the stack entries to be in @kbd{d n} format.
 
-Notice that the integer @cite{12345} was not affected by any
+Notice that the integer @expr{12345} was not affected by any
 of the float formats.  Integers are integers, and are always
 displayed exactly.
 
@@ -2712,13 +2745,15 @@
 
 @noindent
 The shift-@kbd{S} command computes the sine of an angle.  The sine
-of 45 degrees is @c{$\sqrt{2}/2$}
-@cite{sqrt(2)/2}; squaring this yields @cite{2/4 = 0.5}.
-However, there has been a slight roundoff error because the
-representation of @c{$\sqrt{2}/2$}
-@cite{sqrt(2)/2} wasn't exact.  The @kbd{c 1}
-command is a handy way to clean up numbers in this case; it
-temporarily reduces the precision by one digit while it
+of 45 degrees is 
+@texline @tmath{\sqrt{2}/2};
+@infoline @expr{sqrt(2)/2}; 
+squaring this yields @expr{2/4 = 0.5}.  However, there has been a slight
+roundoff error because the representation of 
+@texline @tmath{\sqrt{2}/2}
+@infoline @expr{sqrt(2)/2} 
+wasn't exact.  The @kbd{c 1} command is a handy way to clean up numbers
+in this case; it temporarily reduces the precision by one digit while it
 re-rounds the number on the top of the stack.
 
 @cindex Roundoff errors, examples
@@ -2729,9 +2764,7 @@
 
 To do this calculation in radians, we would type @kbd{m r} first.
 (The indicator changes to @samp{Rad}.)  45 degrees corresponds to
-@c{$\pi\over4$}
-@cite{pi/4} radians.  To get @c{$\pi$}
-@cite{pi}, press the @kbd{P} key.  (Once
+@cpiover{4} radians.  To get @cpi{}, press the @kbd{P} key.  (Once
 again, this is a shifted capital @kbd{P}.  Remember, unshifted
 @kbd{p} sets the precision.)
 
@@ -2757,9 +2790,10 @@
 @end smallexample
 
 @noindent
-Here we compute the Inverse Sine of @c{$\sqrt{0.5}$}
-@cite{sqrt(0.5)}, first in
-radians, then in degrees.
+Here we compute the Inverse Sine of 
+@texline @tmath{\sqrt{0.5}},
+@infoline @expr{sqrt(0.5)}, 
+first in radians, then in degrees.
 
 Use @kbd{c d} and @kbd{c r} to convert a number from radians to degrees
 and vice-versa.
@@ -2939,15 +2973,16 @@
 
 We've already seen the @kbd{Q} (square root) and @kbd{S} (sine)
 commands.  Other commands along those lines are @kbd{C} (cosine),
-@kbd{T} (tangent), @kbd{E} (@cite{e^x}) and @kbd{L} (natural
+@kbd{T} (tangent), @kbd{E} (@expr{e^x}) and @kbd{L} (natural
 logarithm).  These can be modified by the @kbd{I} (inverse) and
 @kbd{H} (hyperbolic) prefix keys.
 
 Let's compute the sine and cosine of an angle, and verify the
-identity @c{$\sin^2x + \cos^2x = 1$}
-@cite{sin(x)^2 + cos(x)^2 = 1}.  We'll
-arbitrarily pick @i{-64} degrees as a good value for @cite{x}.  With
-the angular mode set to degrees (type @w{@kbd{m d}}), do:
+identity 
+@texline @tmath{\sin^2x + \cos^2x = 1}.
+@infoline @expr{sin(x)^2 + cos(x)^2 = 1}.  
+We'll arbitrarily pick @i{-64} degrees as a good value for @expr{x}.
+With the angular mode set to degrees (type @w{@kbd{m d}}), do:
 
 @smallexample
 @group
@@ -2966,8 +3001,9 @@
 Remember, @kbd{f h} is the @code{calc-hypot}, or square-root of sum
 of squares, command.
 
-Another identity is @c{$\displaystyle\tan x = {\sin x \over \cos x}$}
-@cite{tan(x) = sin(x) / cos(x)}.
+Another identity is 
+@texline @tmath{\displaystyle\tan x = {\sin x \over \cos x}}.
+@infoline @expr{tan(x) = sin(x) / cos(x)}.
 @smallexample
 @group
 
@@ -2980,7 +3016,7 @@
 @end smallexample
 
 A physical interpretation of this calculation is that if you move
-@cite{0.89879} units downward and @cite{0.43837} units to the right,
+@expr{0.89879} units downward and @expr{0.43837} units to the right,
 your direction of motion is @i{-64} degrees from horizontal.  Suppose
 we move in the opposite direction, up and to the left:
 
@@ -3029,9 +3065,9 @@
 
 A similar identity is supposed to hold for hyperbolic sines and cosines,
 except that it is the @emph{difference}
-@c{$\cosh^2x - \sinh^2x$}
-@cite{cosh(x)^2 - sinh(x)^2} that always equals one.
-Let's try to verify this identity.@refill
+@texline @tmath{\cosh^2x - \sinh^2x}
+@infoline @expr{cosh(x)^2 - sinh(x)^2} 
+that always equals one.  Let's try to verify this identity.
 
 @smallexample
 @group
@@ -3057,12 +3093,12 @@
 0.99999, reasonably close to 1.
 
 Of course, a more reasonable way to verify the identity is to use
-a more reasonable value for @cite{x}!
+a more reasonable value for @expr{x}!
 
 @cindex Common logarithm
 Some Calculator commands use the Hyperbolic prefix for other purposes.
 The logarithm and exponential functions, for example, work to the base
-@cite{e} normally but use base-10 instead if you use the Hyperbolic
+@expr{e} normally but use base-10 instead if you use the Hyperbolic
 prefix.
 
 @smallexample
@@ -3095,7 +3131,7 @@
 Here we first use @kbd{B} to compute the base-10 logarithm, then use
 the ``hyperbolic'' exponential as a cheap hack to recover the number
 1000, then use @kbd{B} again to compute the natural logarithm.  Note
-that @kbd{P} with the hyperbolic prefix pushes the constant @cite{e}
+that @kbd{P} with the hyperbolic prefix pushes the constant @expr{e}
 onto the stack.
 
 You may have noticed that both times we took the base-10 logarithm
@@ -3136,8 +3172,8 @@
 
 If you take the factorial of a non-integer, Calc uses a generalized
 factorial function defined in terms of Euler's Gamma function
-@c{$\Gamma(n)$}
-@cite{gamma(n)}
+@texline @tmath{\Gamma(n)}
+@infoline @expr{gamma(n)}
 (which is itself available as the @kbd{f g} command).
 
 @smallexample
@@ -3152,17 +3188,19 @@
 @end smallexample
 
 @noindent
-Here we verify the identity @c{$n! = \Gamma(n+1)$}
-@cite{@var{n}!@: = gamma(@var{n}+1)}.
-
-The binomial coefficient @var{n}-choose-@var{m}@c{ or $\displaystyle {n \choose m}$}
-@asis{} is defined by
-@c{$\displaystyle {n! \over m! \, (n-m)!}$}
-@cite{n!@: / m!@: (n-m)!} for all reals @cite{n} and
-@cite{m}.  The intermediate results in this formula can become quite
-large even if the final result is small; the @kbd{k c} command computes
-a binomial coefficient in a way that avoids large intermediate
-values.
+Here we verify the identity 
+@texline @tmath{n! = \Gamma(n+1)}.
+@infoline @expr{@var{n}!@: = gamma(@var{n}+1)}.
+
+The binomial coefficient @var{n}-choose-@var{m}
+@texline or @tmath{\displaystyle {n \choose m}}
+is defined by
+@texline @tmath{\displaystyle {n! \over m! \, (n-m)!}}
+@infoline @expr{n!@: / m!@: (n-m)!}
+for all reals @expr{n} and @expr{m}.  The intermediate results in this
+formula can become quite large even if the final result is small; the
+@kbd{k c} command computes a binomial coefficient in a way that avoids
+large intermediate values.
 
 The @kbd{k} prefix key defines several common functions out of
 combinatorics and number theory.  Here we compute the binomial
@@ -3266,7 +3304,7 @@
 @cindex Dot product
 The dot product of two vectors is equal to the product of their
 lengths times the cosine of the angle between them.  (Here the vector
-is interpreted as a line from the origin @cite{(0,0,0)} to the
+is interpreted as a line from the origin @expr{(0,0,0)} to the
 specified point in three-dimensional space.)  The @kbd{A}
 (absolute value) command can be used to compute the length of a
 vector.
@@ -3379,8 +3417,8 @@
 
 When two matrices are multiplied, the lefthand matrix must have
 the same number of columns as the righthand matrix has rows.
-Row @cite{i}, column @cite{j} of the result is effectively the
-dot product of row @cite{i} of the left matrix by column @cite{j}
+Row @expr{i}, column @expr{j} of the result is effectively the
+dot product of row @expr{i} of the left matrix by column @expr{j}
 of the right matrix.
 
 If we try to duplicate this matrix and multiply it by itself,
@@ -3441,9 +3479,11 @@
 vector.
 
 (@bullet{}) @strong{Exercise 1.}  Use @samp{*} to sum along the rows
-of the above @c{$2\times3$}
-@asis{2x3} matrix to get @cite{[6, 15]}.  Now use @samp{*} to
-sum along the columns to get @cite{[5, 7, 9]}.
+of the above 
+@texline @tmath{2\times3}
+@infoline 2x3 
+matrix to get @expr{[6, 15]}.  Now use @samp{*} to sum along the columns
+to get @expr{[5, 7, 9]}. 
 @xref{Matrix Answer 1, 1}. (@bullet{})
 
 @cindex Identity matrix
@@ -3566,7 +3606,7 @@
 @end smallexample
 
 @noindent
-The result is the @cite{[a, b, c]} vector that solves the equations.
+The result is the @expr{[a, b, c]} vector that solves the equations.
 (Dividing by a square matrix is equivalent to multiplying by its
 inverse.)
 
@@ -3590,16 +3630,19 @@
 assume the vector was a row vector in order to make the dimensions
 come out right, and the answer would be incorrect.  If you
 don't feel safe letting Calc take either interpretation of your
-vectors, use explicit @c{$N\times1$}
-@asis{Nx1} or @c{$1\times N$}
-@asis{1xN} matrices instead.
-In this case, you would enter the original column vector as
-@samp{[[6], [2], [3]]} or @samp{[6; 2; 3]}.
+vectors, use explicit 
+@texline @tmath{N\times1}
+@infoline Nx1
+or
+@texline @tmath{1\times N}
+@infoline 1xN
+matrices instead.  In this case, you would enter the original column
+vector as @samp{[[6], [2], [3]]} or @samp{[6; 2; 3]}.
 
 (@bullet{}) @strong{Exercise 2.}  Algebraic entry allows you to make
 vectors and matrices that include variables.  Solve the following
-system of equations to get expressions for @cite{x} and @cite{y}
-in terms of @cite{a} and @cite{b}.
+system of equations to get expressions for @expr{x} and @expr{y}
+in terms of @expr{a} and @expr{b}.
 
 @ifinfo
 @group
@@ -3628,10 +3671,10 @@
 there are no values for the variables that will satisfy all the
 equations at once, but it is still useful to find a set of values
 which ``nearly'' satisfy all the equations.  In terms of matrix equations,
-you can't solve @cite{A X = B} directly because the matrix @cite{A}
+you can't solve @expr{A X = B} directly because the matrix @expr{A}
 is not square for an over-determined system.  Matrix inversion works
 only for square matrices.  One common trick is to multiply both sides
-on the left by the transpose of @cite{A}:
+on the left by the transpose of @expr{A}:
 @ifinfo
 @samp{trn(A)*A*X = trn(A)*B}.
 @end ifinfo
@@ -3639,12 +3682,14 @@
 \turnoffactive
 $A^T A \, X = A^T B$, where $A^T$ is the transpose \samp{trn(A)}.
 @end tex
-Now @c{$A^T A$}
-@cite{trn(A)*A} is a square matrix so a solution is possible.  It
-turns out that the @cite{X} vector you compute in this way will be a
-``least-squares'' solution, which can be regarded as the ``closest''
-solution to the set of equations.  Use Calc to solve the following
-over-determined system:@refill
+Now 
+@texline @tmath{A^T A}
+@infoline @expr{trn(A)*A} 
+is a square matrix so a solution is possible.  It turns out that the
+@expr{X} vector you compute in this way will be a ``least-squares''
+solution, which can be regarded as the ``closest'' solution to the set
+of equations.  Use Calc to solve the following over-determined
+system:
 
 @ifinfo
 @group
@@ -3733,8 +3778,10 @@
 of each element.
 
 (@bullet{}) @strong{Exercise 1.}  Compute a vector of powers of two
-from @c{$2^{-4}$}
-@cite{2^-4} to @cite{2^4}.  @xref{List Answer 1, 1}. (@bullet{})
+from 
+@texline @tmath{2^{-4}}
+@infoline @expr{2^-4} 
+to @expr{2^4}.  @xref{List Answer 1, 1}. (@bullet{})
 
 You can also @dfn{reduce} a binary operator across a vector.
 For example, reducing @samp{*} computes the product of all the
@@ -3868,13 +3915,13 @@
 @kbd{List Tutorial}, to jump straight to this section.)
 
 Position the cursor at the upper-left corner of this table, just
-to the left of the @cite{1.34}.  Press @kbd{C-@@} to set the mark.
+to the left of the @expr{1.34}.  Press @kbd{C-@@} to set the mark.
 (On your system this may be @kbd{C-2}, @kbd{C-@key{SPC}}, or @kbd{NUL}.)
-Now position the cursor to the lower-right, just after the @cite{1.354}.
+Now position the cursor to the lower-right, just after the @expr{1.354}.
 You have now defined this region as an Emacs ``rectangle.''  Still
 in the Info buffer, type @kbd{M-# r}.  This command
 (@code{calc-grab-rectangle}) will pop you back into the Calculator, with
-the contents of the rectangle you specified in the form of a matrix.@refill
+the contents of the rectangle you specified in the form of a matrix.
 
 @smallexample
 @group
@@ -3919,7 +3966,7 @@
 (Recall that @kbd{t 2} is a variant of @kbd{s 2} that removes the
 stored value from the stack.)
 
-In a least squares fit, the slope @cite{m} is given by the formula
+In a least squares fit, the slope @expr{m} is given by the formula
 
 @ifinfo
 @example
@@ -3935,11 +3982,13 @@
 @end tex
 
 @noindent
-where @c{$\sum x$}
-@cite{sum(x)} represents the sum of all the values of @cite{x}.
-While there is an actual @code{sum} function in Calc, it's easier to
-sum a vector using a simple reduction.  First, let's compute the four
-different sums that this formula uses.
+where 
+@texline @tmath{\sum x}
+@infoline @expr{sum(x)} 
+represents the sum of all the values of @expr{x}.  While there is an
+actual @code{sum} function in Calc, it's easier to sum a vector using a
+simple reduction.  First, let's compute the four different sums that
+this formula uses.
 
 @smallexample
 @group
@@ -3973,7 +4022,7 @@
 $\sum x y$.)
 @end tex
 
-Finally, we also need @cite{N}, the number of data points.  This is just
+Finally, we also need @expr{N}, the number of data points.  This is just
 the length of either of our lists.
 
 @smallexample
@@ -4012,7 +4061,7 @@
 @end group
 @end smallexample
 
-That gives us the slope @cite{m}.  The y-intercept @cite{b} can now
+That gives us the slope @expr{m}.  The y-intercept @expr{b} can now
 be found with the simple formula,
 
 @ifinfo
@@ -4038,8 +4087,10 @@
 @end group
 @end smallexample
 
-Let's ``plot'' this straight line approximation, @c{$y \approx m x + b$}
-@cite{m x + b}, and compare it with the original data.@refill
+Let's ``plot'' this straight line approximation, 
+@texline @tmath{y \approx m x + b},
+@infoline @expr{m x + b}, 
+and compare it with the original data.
 
 @smallexample
 @group
@@ -4056,7 +4107,7 @@
 common operations from vector algebra.  As far as Calc is concerned,
 we've just been doing geometry in 19-dimensional space!
 
-We can subtract this vector from our original @cite{y} vector to get
+We can subtract this vector from our original @expr{y} vector to get
 a feel for the error of our fit.  Let's find the maximum error:
 
 @smallexample
@@ -4131,9 +4182,9 @@
 
 (@bullet{}) @strong{Exercise 2.}  An earlier exercise showed how to do
 least squares fitting to a general system of equations.  Our 19 data
-points are really 19 equations of the form @cite{y_i = m x_i + b} for
-different pairs of @cite{(x_i,y_i)}.  Use the matrix-transpose method
-to solve for @cite{m} and @cite{b}, duplicating the above result.
+points are really 19 equations of the form @expr{y_i = m x_i + b} for
+different pairs of @expr{(x_i,y_i)}.  Use the matrix-transpose method
+to solve for @expr{m} and @expr{b}, duplicating the above result.
 @xref{List Answer 2, 2}. (@bullet{})
 
 @cindex Geometric mean
@@ -4161,7 +4212,7 @@
 @var{n}-choose-0 minus @var{n}-choose-1 plus @var{n}-choose-2, and so
 on up to @var{n}-choose-@var{n},
 always comes out to zero.  Let's verify this
-for @cite{n=6}.@refill
+for @expr{n=6}.
 @end ifinfo
 @tex
 As another example, a theorem about binomial coefficients tells
@@ -4232,13 +4283,13 @@
 and @kbd{v c} instead delete one row, column, or vector element.
 
 @cindex Divisor functions
-(@bullet{}) @strong{Exercise 4.}  The @cite{k}th @dfn{divisor function}
+(@bullet{}) @strong{Exercise 4.}  The @expr{k}th @dfn{divisor function}
 @tex
 $\sigma_k(n)$
 @end tex
-is the sum of the @cite{k}th powers of all the divisors of an
-integer @cite{n}.  Figure out a method for computing the divisor
-function for reasonably small values of @cite{n}.  As a test,
+is the sum of the @expr{k}th powers of all the divisors of an
+integer @expr{n}.  Figure out a method for computing the divisor
+function for reasonably small values of @expr{n}.  As a test,
 the 0th and 1st divisor functions of 30 are 8 and 72, respectively.
 @xref{List Answer 4, 4}. (@bullet{})
 
@@ -4290,23 +4341,24 @@
 @cindex Maximizing a function over a list of values
 @c [fix-ref Numerical Solutions]
 (@bullet{}) @strong{Exercise 8.}  Compute a list of values of Bessel's
-@c{$J_1(x)$}
-@cite{J1} function @samp{besJ(1,x)} for @cite{x} from 0 to 5
-in steps of 0.25.
-Find the value of @cite{x} (from among the above set of values) for
+@texline @tmath{J_1(x)}
+@infoline @expr{J1} 
+function @samp{besJ(1,x)} for @expr{x} from 0 to 5 in steps of 0.25.
+Find the value of @expr{x} (from among the above set of values) for
 which @samp{besJ(1,x)} is a maximum.  Use an ``automatic'' method,
 i.e., just reading along the list by hand to find the largest value
 is not allowed!  (There is an @kbd{a X} command which does this kind
 of thing automatically; @pxref{Numerical Solutions}.)
-@xref{List Answer 8, 8}. (@bullet{})@refill
+@xref{List Answer 8, 8}. (@bullet{})
 
 @cindex Digits, vectors of
 (@bullet{}) @strong{Exercise 9.}  You are given an integer in the range
-@c{$0 \le N < 10^m$}
-@cite{0 <= N < 10^m} for @cite{m=12} (i.e., an integer of less than
-twelve digits).  Convert this integer into a vector of @cite{m}
+@texline @tmath{0 \le N < 10^m}
+@infoline @expr{0 <= N < 10^m} 
+for @expr{m=12} (i.e., an integer of less than
+twelve digits).  Convert this integer into a vector of @expr{m}
 digits, each in the range from 0 to 9.  In vector-of-digits notation,
-add one to this integer to produce a vector of @cite{m+1} digits
+add one to this integer to produce a vector of @expr{m+1} digits
 (since there could be a carry out of the most significant digit).
 Convert this vector back into a regular integer.  A good integer
 to try is 25129925999.  @xref{List Answer 9, 9}. (@bullet{})
@@ -4316,40 +4368,39 @@
 happened?  How would you do this test?  @xref{List Answer 10, 10}. (@bullet{})
 
 (@bullet{}) @strong{Exercise 11.}  The area of a circle of radius one
-is @c{$\pi$}
-@cite{pi}.  The area of the @c{$2\times2$}
-@asis{2x2} square that encloses that
-circle is 4.  So if we throw @var{n} darts at random points in the square,
-about @c{$\pi/4$}
-@cite{pi/4} of them will land inside the circle.  This gives us
-an entertaining way to estimate the value of @c{$\pi$}
-@cite{pi}.  The @w{@kbd{k r}}
+is @cpi{}.  The area of the 
+@texline @tmath{2\times2}
+@infoline 2x2
+square that encloses that circle is 4.  So if we throw @var{n} darts at
+random points in the square, about @cpiover{4} of them will land inside
+the circle.  This gives us an entertaining way to estimate the value of 
+@cpi{}.  The @w{@kbd{k r}}
 command picks a random number between zero and the value on the stack.
 We could get a random floating-point number between @i{-1} and 1 by typing
-@w{@kbd{2.0 k r 1 -}}.  Build a vector of 100 random @cite{(x,y)} points in
+@w{@kbd{2.0 k r 1 -}}.  Build a vector of 100 random @expr{(x,y)} points in
 this square, then use vector mapping and reduction to count how many
 points lie inside the unit circle.  Hint:  Use the @kbd{v b} command.
 @xref{List Answer 11, 11}. (@bullet{})
 
 @cindex Matchstick problem
 (@bullet{}) @strong{Exercise 12.}  The @dfn{matchstick problem} provides
-another way to calculate @c{$\pi$}
-@cite{pi}.  Say you have an infinite field
+another way to calculate @cpi{}.  Say you have an infinite field
 of vertical lines with a spacing of one inch.  Toss a one-inch matchstick
 onto the field.  The probability that the matchstick will land crossing
-a line turns out to be @c{$2/\pi$}
-@cite{2/pi}.  Toss 100 matchsticks to estimate
-@c{$\pi$}
-@cite{pi}.  (If you want still more fun, the probability that the GCD
-(@w{@kbd{k g}}) of two large integers is one turns out to be @c{$6/\pi^2$}
-@cite{6/pi^2}.
-That provides yet another way to estimate @c{$\pi$}
-@cite{pi}.)
+a line turns out to be 
+@texline @tmath{2/\pi}.
+@infoline @expr{2/pi}.  
+Toss 100 matchsticks to estimate @cpi{}.  (If you want still more fun,
+the probability that the GCD (@w{@kbd{k g}}) of two large integers is
+one turns out to be 
+@texline @tmath{6/\pi^2}.
+@infoline @expr{6/pi^2}.
+That provides yet another way to estimate @cpi{}.)
 @xref{List Answer 12, 12}. (@bullet{})
 
 (@bullet{}) @strong{Exercise 13.}  An algebraic entry of a string in
 double-quote marks, @samp{"hello"}, creates a vector of the numerical
-(ASCII) codes of the characters (here, @cite{[104, 101, 108, 108, 111]}).
+(ASCII) codes of the characters (here, @expr{[104, 101, 108, 108, 111]}).
 Sometimes it is convenient to compute a @dfn{hash code} of a string,
 which is just an integer that represents the value of that string.
 Two equal strings have the same hash code; two different strings
@@ -4358,9 +4409,9 @@
 any given name because it has sorted the functions into ``buckets'' by
 their hash codes.  Sometimes a few names will hash into the same bucket,
 but it is easier to search among a few names than among all the names.)
-One popular hash function is computed as follows:  First set @cite{h = 0}.
-Then, for each character from the string in turn, set @cite{h = 3h + c_i}
-where @cite{c_i} is the character's ASCII code.  If we have 511 buckets,
+One popular hash function is computed as follows:  First set @expr{h = 0}.
+Then, for each character from the string in turn, set @expr{h = 3h + c_i}
+where @expr{c_i} is the character's ASCII code.  If we have 511 buckets,
 we then take the hash code modulo 511 to get the bucket number.  Develop a
 simple command or commands for converting string vectors into hash codes.
 The hash code for @samp{"Testing, 1, 2, 3"} is 1960915098, which modulo
@@ -4372,8 +4423,8 @@
 function you give to the starting value 0, 1, 2, up to @var{n} times
 and returns a vector of the results.  Use this command to create a
 ``random walk'' of 50 steps.  Start with the two-dimensional point
-@cite{(0,0)}; then take one step a random distance between @i{-1} and 1
-in both @cite{x} and @cite{y}; then take another step, and so on.  Use the
+@expr{(0,0)}; then take one step a random distance between @i{-1} and 1
+in both @expr{x} and @expr{y}; then take another step, and so on.  Use the
 @kbd{g f} command to display this random walk.  Now modify your random
 walk to walk a unit distance, but in a random direction, at each step.
 (Hint:  The @code{sincos} function returns a vector of the cosine and
@@ -4436,8 +4487,7 @@
 
 (@bullet{}) @strong{Exercise 1.}  A calculation has produced the
 result 1.26508260337.  You suspect it is the square root of the
-product of @c{$\pi$}
-@cite{pi} and some rational number.  Is it?  (Be sure
+product of @cpi{} and some rational number.  Is it?  (Be sure
 to allow for roundoff error!)  @xref{Types Answer 1, 1}. (@bullet{})
 
 @dfn{Complex numbers} can be stored in both rectangular and polar form.
@@ -4453,7 +4503,7 @@
 
 @noindent
 The square root of @i{-9} is by default rendered in rectangular form
-(@w{@cite{0 + 3i}}), but we can convert it to polar form (3 with a
+(@w{@expr{0 + 3i}}), but we can convert it to polar form (3 with a
 phase angle of 90 degrees).  All the usual arithmetic and scientific
 operations are defined on both types of complex numbers.
 
@@ -4509,9 +4559,9 @@
 Dividing by zero normally is left unevaluated, but after @kbd{m i}
 it instead gives an infinite result.  The answer is actually
 @code{uinf}, ``undirected infinity.''  If you look at a graph of
-@cite{1 / x} around @w{@cite{x = 0}}, you'll see that it goes toward
+@expr{1 / x} around @w{@expr{x = 0}}, you'll see that it goes toward
 plus infinity as you approach zero from above, but toward minus
-infinity as you approach from below.  Since we said only @cite{1 / 0},
+infinity as you approach from below.  Since we said only @expr{1 / 0},
 Calc knows that the answer is infinite but not in which direction.
 That's what @code{uinf} means.  Notice that multiplying @code{uinf}
 by a negative number still leaves plain @code{uinf}; there's no
@@ -4641,10 +4691,11 @@
 
 @cindex Torus, volume of
 (@bullet{}) @strong{Exercise 7.}  The volume of a torus (a donut shape) is
-@c{$2 \pi^2 R r^2$}
-@w{@cite{2 pi^2 R r^2}} where @cite{R} is the radius of the circle that
-defines the center of the tube and @cite{r} is the radius of the tube
-itself.  Suppose @cite{R} is 20 cm and @cite{r} is 4 cm, each known to
+@texline @tmath{2 \pi^2 R r^2}
+@infoline @w{@expr{2 pi^2 R r^2}} 
+where @expr{R} is the radius of the circle that
+defines the center of the tube and @expr{r} is the radius of the tube
+itself.  Suppose @expr{R} is 20 cm and @expr{r} is 4 cm, each known to
 within 5 percent.  What is the volume and the relative uncertainty of
 the volume?  @xref{Types Answer 7, 7}. (@bullet{})
 
@@ -4739,14 +4790,15 @@
 
 @cindex Fermat, primality test of
 (@bullet{}) @strong{Exercise 10.}  A theorem of Pierre de Fermat
-says that @c{\w{$x^{n-1} \bmod n = 1$}}
-@cite{x^(n-1) mod n = 1} if @cite{n} is a prime number
-and @cite{x} is an integer less than @cite{n}.  If @cite{n} is
-@emph{not} a prime number, this will @emph{not} be true for most
-values of @cite{x}.  Thus we can test informally if a number is
-prime by trying this formula for several values of @cite{x}.
-Use this test to tell whether the following numbers are prime:
-811749613, 15485863.  @xref{Types Answer 10, 10}. (@bullet{})
+says that 
+@texline @w{@tmath{x^{n-1} \bmod n = 1}}
+@infoline @expr{x^(n-1) mod n = 1}
+if @expr{n} is a prime number and @expr{x} is an integer less than
+@expr{n}.  If @expr{n} is @emph{not} a prime number, this will
+@emph{not} be true for most values of @expr{x}.  Thus we can test
+informally if a number is prime by trying this formula for several
+values of @expr{x}.  Use this test to tell whether the following numbers
+are prime: 811749613, 15485863.  @xref{Types Answer 10, 10}. (@bullet{})
 
 It is possible to use HMS forms as parts of error forms, intervals,
 modulo forms, or as the phase part of a polar complex number.
@@ -4766,9 +4818,11 @@
 This calculation tells me it is six hours and 22 minutes until midnight.
 
 (@bullet{}) @strong{Exercise 11.}  A rule of thumb is that one year
-is about @c{$\pi \times 10^7$}
-@w{@cite{pi * 10^7}} seconds.  What time will it be that
-many seconds from right now?  @xref{Types Answer 11, 11}. (@bullet{})
+is about 
+@texline @tmath{\pi \times 10^7}
+@infoline @w{@expr{pi * 10^7}} 
+seconds.  What time will it be that many seconds from right now?
+@xref{Types Answer 11, 11}. (@bullet{})
 
 (@bullet{}) @strong{Exercise 12.}  You are preparing to order packaging
 for the CD release of the Extended Disco Version of @emph{Abbey Road}.
@@ -4949,9 +5003,9 @@
 
 @noindent
 First we ``expand'' using the distributive law, then we ``collect''
-terms involving like powers of @cite{x}.
-
-Let's find the value of this expression when @cite{x} is 2 and @cite{y}
+terms involving like powers of @expr{x}.
+
+Let's find the value of this expression when @expr{x} is 2 and @expr{y}
 is one-half.
 
 @smallexample
@@ -4976,11 +5030,11 @@
 properly.)
 
 @cindex Maximum of a function using Calculus
-Let's find the maximum value of our original expression when @cite{y}
-is one-half and @cite{x} ranges over all possible values.  We can
-do this by taking the derivative with respect to @cite{x} and examining
-values of @cite{x} for which the derivative is zero.  If the second
-derivative of the function at that value of @cite{x} is negative,
+Let's find the maximum value of our original expression when @expr{y}
+is one-half and @expr{x} ranges over all possible values.  We can
+do this by taking the derivative with respect to @expr{x} and examining
+values of @expr{x} for which the derivative is zero.  If the second
+derivative of the function at that value of @expr{x} is negative,
 the function has a local maximum there.
 
 @smallexample
@@ -4993,8 +5047,8 @@
 @end smallexample
 
 @noindent
-Well, the derivative is clearly zero when @cite{x} is zero.  To find
-the other root(s), let's divide through by @cite{x} and then solve:
+Well, the derivative is clearly zero when @expr{x} is zero.  To find
+the other root(s), let's divide through by @expr{x} and then solve:
 
 @smallexample
 @group
@@ -5020,7 +5074,7 @@
 default algebraic simplifications don't do enough, you can use
 @kbd{a s} to tell Calc to spend more time on the job.
 
-Now we compute the second derivative and plug in our values of @cite{x}:
+Now we compute the second derivative and plug in our values of @expr{x}:
 
 @smallexample
 @group
@@ -5050,14 +5104,14 @@
 
 @noindent
 The first of these second derivatives is negative, so we know the function
-has a maximum value at @cite{x = 1.19023}.  (The function also has a
-local @emph{minimum} at @cite{x = 0}.)
-
-When we solved for @cite{x}, we got only one value even though
-@cite{34 - 24 x^2 = 0} is a quadratic equation that ought to have
+has a maximum value at @expr{x = 1.19023}.  (The function also has a
+local @emph{minimum} at @expr{x = 0}.)
+
+When we solved for @expr{x}, we got only one value even though
+@expr{34 - 24 x^2 = 0} is a quadratic equation that ought to have
 two solutions.  The reason is that @w{@kbd{a S}} normally returns a
 single ``principal'' solution.  If it needs to come up with an
-arbitrary sign (as occurs in the quadratic formula) it picks @cite{+}.
+arbitrary sign (as occurs in the quadratic formula) it picks @expr{+}.
 If it needs an arbitrary integer, it picks zero.  We can get a full
 solution by pressing @kbd{H} (the Hyperbolic flag) before @kbd{a S}.
 
@@ -5075,9 +5129,9 @@
 it is supposed to be either @i{+1} or @i{-1}.  Here we have used
 the ``let'' command to evaluate the expression when the sign is negative.
 If we plugged this into our second derivative we would get the same,
-negative, answer, so @cite{x = -1.19023} is also a maximum.
-
-To find the actual maximum value, we must plug our two values of @cite{x}
+negative, answer, so @expr{x = -1.19023} is also a maximum.
+
+To find the actual maximum value, we must plug our two values of @expr{x}
 into the original formula.
 
 @smallexample
@@ -5127,7 +5181,7 @@
 @w{@kbd{H a S}} and returns a vector of all the solutions.  It simply
 automates the job we just did by hand.  Applied to our original
 cubic polynomial, it would produce the vector of solutions
-@cite{[1.19023, -1.19023, 0]}.  (There is also an @kbd{a X} command
+@expr{[1.19023, -1.19023, 0]}.  (There is also an @kbd{a X} command
 which finds a local maximum of a function.  It uses a numerical search
 method rather than examining the derivatives, and thus requires you
 to provide some kind of initial guess to show it where to look.)
@@ -5215,7 +5269,7 @@
 are shown in normal mode.)
 
 @cindex Area under a curve
-What is the area under the portion of this curve from @cite{x = 1} to @cite{2}?
+What is the area under the portion of this curve from @expr{x = 1} to @expr{2}?
 This is simply the integral of the function:
 
 @smallexample
@@ -5228,7 +5282,7 @@
 @end smallexample
 
 @noindent
-We want to evaluate this at our two values for @cite{x} and subtract.
+We want to evaluate this at our two values for @expr{x} and subtract.
 One way to do it is again with vector mapping and reduction:
 
 @smallexample
@@ -5240,20 +5294,23 @@
 @end group
 @end smallexample
 
-(@bullet{}) @strong{Exercise 3.}  Find the integral from 1 to @cite{y}
-of @c{$x \sin \pi x$}
-@w{@cite{x sin(pi x)}} (where the sine is calculated in radians).
-Find the values of the integral for integers @cite{y} from 1 to 5.
-@xref{Algebra Answer 3, 3}. (@bullet{})
+(@bullet{}) @strong{Exercise 3.}  Find the integral from 1 to @expr{y}
+of 
+@texline @tmath{x \sin \pi x}
+@infoline @w{@expr{x sin(pi x)}} 
+(where the sine is calculated in radians).  Find the values of the
+integral for integers @expr{y} from 1 to 5.  @xref{Algebra Answer 3,
+3}. (@bullet{})
 
 Calc's integrator can do many simple integrals symbolically, but many
 others are beyond its capabilities.  Suppose we wish to find the area
-under the curve @c{$\sin x \ln x$}
-@cite{sin(x) ln(x)} over the same range of @cite{x}.  If
-you entered this formula and typed @kbd{a i x @key{RET}} (don't bother to try
-this), Calc would work for a long time but would be unable to find a
-solution.  In fact, there is no closed-form solution to this integral.
-Now what do we do?
+under the curve 
+@texline @tmath{\sin x \ln x}
+@infoline @expr{sin(x) ln(x)} 
+over the same range of @expr{x}.  If you entered this formula and typed
+@kbd{a i x @key{RET}} (don't bother to try this), Calc would work for a
+long time but would be unable to find a solution.  In fact, there is no
+closed-form solution to this integral.  Now what do we do?
 
 @cindex Integration, numerical
 @cindex Numerical integration
@@ -5322,7 +5379,7 @@
 
 @noindent
 Here we have computed the Taylor series expansion of the function
-about the point @cite{x=1}.  We can now integrate this polynomial
+about the point @expr{x=1}.  We can now integrate this polynomial
 approximation, since polynomials are easy to integrate.
 
 @smallexample
@@ -5339,8 +5396,8 @@
 in the Taylor series, we can get a result as accurate as we like.
 (Taylor series converge better away from singularities in the
 function such as the one at @code{ln(0)}, so it would also help to
-expand the series about the points @cite{x=2} or @cite{x=1.5} instead
-of @cite{x=1}.)
+expand the series about the points @expr{x=2} or @expr{x=1.5} instead
+of @expr{x=1}.)
 
 @cindex Simpson's rule
 @cindex Integration by Simpson's rule
@@ -5370,7 +5427,7 @@
 @end tex
 
 @noindent
-where @cite{n} (which must be even) is the number of slices and @cite{h}
+where @expr{n} (which must be even) is the number of slices and @expr{h}
 is the width of each slice.  These are 10 and 0.1 in our example.
 For reference, here is the corresponding formula for the stairstep
 method:
@@ -5389,9 +5446,11 @@
 \afterdisplay
 @end tex
 
-Compute the integral from 1 to 2 of @c{$\sin x \ln x$}
-@cite{sin(x) ln(x)} using
-Simpson's rule with 10 slices.  @xref{Algebra Answer 4, 4}. (@bullet{})
+Compute the integral from 1 to 2 of 
+@texline @tmath{\sin x \ln x}
+@infoline @expr{sin(x) ln(x)} 
+using Simpson's rule with 10 slices.  
+@xref{Algebra Answer 4, 4}. (@bullet{})
 
 Calc has a built-in @kbd{a I} command for doing numerical integration.
 It uses @dfn{Romberg's method}, which is a more sophisticated cousin
@@ -5639,7 +5698,7 @@
 A common error with rewrite
 rules is to write, say, @samp{f(a,b,c,d,e) := g(a+b+c+d+e)}, expecting
 to match any @samp{f} with five arguments but in fact matching
-only when the fifth argument is literally @samp{e}!@refill
+only when the fifth argument is literally @samp{e}!
 
 @cindex Fibonacci numbers
 @ignore
@@ -5789,10 +5848,10 @@
 @samp{opt(a) + opt(b) x := f(a, b, x)}.  What happened?
 @xref{Rewrites Answer 3, 3}. (@bullet{})
 
-(@bullet{}) @strong{Exercise 4.}  Starting with a positive integer @cite{a},
-divide @cite{a} by two if it is even, otherwise compute @cite{3 a + 1}.
+(@bullet{}) @strong{Exercise 4.}  Starting with a positive integer @expr{a},
+divide @expr{a} by two if it is even, otherwise compute @expr{3 a + 1}.
 Now repeat this step over and over.  A famous unproved conjecture
-is that for any starting @cite{a}, the sequence always eventually
+is that for any starting @expr{a}, the sequence always eventually
 reaches 1.  Given the formula @samp{seq(@var{a}, 0)}, write a set of
 rules that convert this into @samp{seq(1, @var{n})} where @var{n}
 is the number of steps it took the sequence to reach the value 1.
@@ -5801,27 +5860,27 @@
 Now make the result be a vector of values in the sequence, from @var{a}
 to 1.  (The formula @samp{@var{x}|@var{y}} appends the vectors @var{x}
 and @var{y}.)  For example, rewriting @samp{seq(6)} should yield the
-vector @cite{[6, 3, 10, 5, 16, 8, 4, 2, 1]}.
+vector @expr{[6, 3, 10, 5, 16, 8, 4, 2, 1]}.
 @xref{Rewrites Answer 4, 4}. (@bullet{})
 
 (@bullet{}) @strong{Exercise 5.}  Define, using rewrite rules, a function
 @samp{nterms(@var{x})} that returns the number of terms in the sum
 @var{x}, or 1 if @var{x} is not a sum.  (A @dfn{sum} for our purposes
 is one or more non-sum terms separated by @samp{+} or @samp{-} signs,
-so that @cite{2 - 3 (x + y) + x y} is a sum of three terms.)
+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 @cite{0^0}
+(@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 @cite{0^0 = 1},
-so that the identity @cite{x^0 = 1} can safely be used for all @cite{x}.
+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
 infinite series that exactly equals the value of that function at
-values of @cite{x} near zero.
+values of @expr{x} near zero.
 
 @ifinfo
 @example
@@ -5829,15 +5888,15 @@
 @end example
 @end ifinfo
 @tex
-\turnoffactive \let\rm\goodrm
+\turnoffactive
 \beforedisplay
 $$ \cos x = 1 - {x^2 \over 2!} + {x^4 \over 4!} - {x^6 \over 6!} + \cdots $$
 \afterdisplay
 @end tex
 
 The @kbd{a t} command produces a @dfn{truncated Taylor series} which
-is obtained by dropping all the terms higher than, say, @cite{x^2}.
-Calc represents the truncated Taylor series as a polynomial in @cite{x}.
+is obtained by dropping all the terms higher than, say, @expr{x^2}.
+Calc represents the truncated Taylor series as a polynomial in @expr{x}.
 Mathematicians often write a truncated series using a ``big-O'' notation
 that records what was the lowest term that was truncated.
 
@@ -5847,15 +5906,15 @@
 @end example
 @end ifinfo
 @tex
-\turnoffactive \let\rm\goodrm
+\turnoffactive
 \beforedisplay
 $$ \cos x = 1 - {x^2 \over 2!} + O(x^3) $$
 \afterdisplay
 @end tex
 
 @noindent
-The meaning of @cite{O(x^3)} is ``a quantity which is negligibly small
-if @cite{x^3} is considered negligibly small as @cite{x} goes to zero.''
+The meaning of @expr{O(x^3)} is ``a quantity which is negligibly small
+if @expr{x^3} is considered negligibly small as @expr{x} goes to zero.''
 
 The exercise is to create rewrite rules that simplify sums and products of
 power series represented as @samp{@var{polynomial} + O(@var{var}^@var{n})}.
@@ -5934,9 +5993,10 @@
 @end ignore
 @tindex Si
 (@bullet{}) @strong{Exercise 1.}  The ``sine integral'' function
-@c{${\rm Si}(x)$}
-@cite{Si(x)} is defined as the integral of @samp{sin(t)/t} for
-@cite{t = 0} to @cite{x} in radians.  (It was invented because this
+@texline @tmath{{\rm Si}(x)}
+@infoline @expr{Si(x)} 
+is defined as the integral of @samp{sin(t)/t} for
+@expr{t = 0} to @expr{x} in radians.  (It was invented because this
 integral has no solution in terms of basic functions; if you give it
 to Calc's @kbd{a i} command, it will ponder it for a long time and then
 give up.)  We can use the numerical integration command, however,
@@ -6010,12 +6070,13 @@
 
 @enumerate
 @item
-Compute @c{$\displaystyle{\sin x \over x}$}
-@cite{sin(x) / x}, where @cite{x} is the number on the
-top of the stack.
-
-@item
-Compute the base-@cite{b} logarithm, just like the @kbd{B} key except
+Compute 
+@texline @tmath{\displaystyle{\sin x \over x}},
+@infoline @expr{sin(x) / x}, 
+where @expr{x} is the number on the top of the stack.
+
+@item
+Compute the base-@expr{b} logarithm, just like the @kbd{B} key except
 the arguments are taken in the opposite order.
 
 @item
@@ -6044,7 +6105,7 @@
 @end smallexample
 
 @noindent
-Here we have computed the fourth derivative of @cite{x^6} by
+Here we have computed the fourth derivative of @expr{x^6} by
 enclosing a derivative command in a ``repeat loop'' structure.
 This structure pops a repeat count from the stack, then
 executes the body of the loop that many times.
@@ -6074,14 +6135,18 @@
 
 @cindex Golden ratio
 @cindex Phi, golden ratio
-A fascinating property of the Fibonacci numbers is that the @cite{n}th
-Fibonacci number can be found directly by computing @c{$\phi^n / \sqrt{5}$}
-@cite{phi^n / sqrt(5)}
-and then rounding to the nearest integer, where @c{$\phi$ (``phi'')}
-@cite{phi}, the
-``golden ratio,'' is @c{$(1 + \sqrt{5}) / 2$}
-@cite{(1 + sqrt(5)) / 2}.  (For convenience, this constant is available
-from the @code{phi} variable, or the @kbd{I H P} command.)
+A fascinating property of the Fibonacci numbers is that the @expr{n}th
+Fibonacci number can be found directly by computing 
+@texline @tmath{\phi^n / \sqrt{5}}
+@infoline @expr{phi^n / sqrt(5)}
+and then rounding to the nearest integer, where 
+@texline @tmath{\phi} (``phi''),
+@infoline @expr{phi}, 
+the ``golden ratio,'' is 
+@texline @tmath{(1 + \sqrt{5}) / 2}.
+@infoline @expr{(1 + sqrt(5)) / 2}. 
+(For convenience, this constant is available from the @code{phi}
+variable, or the @kbd{I H P} command.)
 
 @smallexample
 @group
@@ -6094,22 +6159,28 @@
 
 @cindex Continued fractions
 (@bullet{}) @strong{Exercise 5.}  The @dfn{continued fraction}
-representation of @c{$\phi$}
-@cite{phi} is @c{$1 + 1/(1 + 1/(1 + 1/( \ldots )))$}
-@cite{1 + 1/(1 + 1/(1 + 1/( ...@: )))}.
+representation of 
+@texline @tmath{\phi}
+@infoline @expr{phi} 
+is 
+@texline @tmath{1 + 1/(1 + 1/(1 + 1/( \ldots )))}.
+@infoline @expr{1 + 1/(1 + 1/(1 + 1/( ...@: )))}.
 We can compute an approximate value by carrying this however far
-and then replacing the innermost @c{$1/( \ldots )$}
-@cite{1/( ...@: )} by 1.  Approximate
-@c{$\phi$}
-@cite{phi} using a twenty-term continued fraction.
+and then replacing the innermost 
+@texline @tmath{1/( \ldots )}
+@infoline @expr{1/( ...@: )} 
+by 1.  Approximate
+@texline @tmath{\phi}
+@infoline @expr{phi} 
+using a twenty-term continued fraction.
 @xref{Programming Answer 5, 5}. (@bullet{})
 
 (@bullet{}) @strong{Exercise 6.}  Linear recurrences like the one for
 Fibonacci numbers can be expressed in terms of matrices.  Given a
-vector @w{@cite{[a, b]}} determine a matrix which, when multiplied by this
-vector, produces the vector @cite{[b, c]}, where @cite{a}, @cite{b} and
-@cite{c} are three successive Fibonacci numbers.  Now write a program
-that, given an integer @cite{n}, computes the @cite{n}th Fibonacci number
+vector @w{@expr{[a, b]}} determine a matrix which, when multiplied by this
+vector, produces the vector @expr{[b, c]}, where @expr{a}, @expr{b} and
+@expr{c} are three successive Fibonacci numbers.  Now write a program
+that, given an integer @expr{n}, computes the @expr{n}th Fibonacci number
 using matrix arithmetic.  @xref{Programming Answer 6, 6}. (@bullet{})
 
 @cindex Harmonic numbers
@@ -6198,12 +6269,13 @@
 The @dfn{Bernoulli numbers} are a sequence with the interesting
 property that all of the odd Bernoulli numbers are zero, and the
 even ones, while difficult to compute, can be roughly approximated
-by the formula @c{$\displaystyle{2 n! \over (2 \pi)^n}$}
-@cite{2 n!@: / (2 pi)^n}.  Let's write a keyboard
-macro to compute (approximate) Bernoulli numbers.  (Calc has a
-command, @kbd{k b}, to compute exact Bernoulli numbers, but
-this command is very slow for large @cite{n} since the higher
-Bernoulli numbers are very large fractions.)
+by the formula 
+@texline @tmath{\displaystyle{2 n! \over (2 \pi)^n}}.
+@infoline @expr{2 n!@: / (2 pi)^n}.  
+Let's write a keyboard macro to compute (approximate) Bernoulli numbers.
+(Calc has a command, @kbd{k b}, to compute exact Bernoulli numbers, but
+this command is very slow for large @expr{n} since the higher Bernoulli
+numbers are very large fractions.)
 
 @smallexample
 @group
@@ -6223,7 +6295,7 @@
 Here we take our integer argument modulo 2; this will be nonzero
 if we're asking for an odd Bernoulli number.
 
-The actual tenth Bernoulli number is @cite{5/66}.
+The actual tenth Bernoulli number is @expr{5/66}.
 
 @smallexample
 @group
@@ -6354,8 +6426,8 @@
 
 (@bullet{}) @strong{Exercise 8.}  A general algorithm for solving
 equations numerically is @dfn{Newton's Method}.  Given the equation
-@cite{f(x) = 0} for any function @cite{f}, and an initial guess
-@cite{x_0} which is reasonably close to the desired solution, apply
+@expr{f(x) = 0} for any function @expr{f}, and an initial guess
+@expr{x_0} which is reasonably close to the desired solution, apply
 this formula over and over:
 
 @ifinfo
@@ -6365,32 +6437,36 @@
 @end ifinfo
 @tex
 \beforedisplay
-$$ x_{\goodrm new} = x - {f(x) \over f'(x)} $$
+$$ x_{\rm new} = x - {f(x) \over f'(x)} $$
 \afterdisplay
 @end tex
 
 @noindent
-where @cite{f'(x)} is the derivative of @cite{f}.  The @cite{x}
+where @expr{f'(x)} is the derivative of @expr{f}.  The @expr{x}
 values will quickly converge to a solution, i.e., eventually
-@c{$x_{\rm new}$}
-@cite{new_x} and @cite{x} will be equal to within the limits
+@texline @tmath{x_{\rm new}}
+@infoline @expr{new_x} 
+and @expr{x} will be equal to within the limits
 of the current precision.  Write a program which takes a formula
-involving the variable @cite{x}, and an initial guess @cite{x_0},
-on the stack, and produces a value of @cite{x} for which the formula
-is zero.  Use it to find a solution of @c{$\sin(\cos x) = 0.5$}
-@cite{sin(cos(x)) = 0.5}
-near @cite{x = 4.5}.  (Use angles measured in radians.)  Note that
+involving the variable @expr{x}, and an initial guess @expr{x_0},
+on the stack, and produces a value of @expr{x} for which the formula
+is zero.  Use it to find a solution of 
+@texline @tmath{\sin(\cos x) = 0.5}
+@infoline @expr{sin(cos(x)) = 0.5}
+near @expr{x = 4.5}.  (Use angles measured in radians.)  Note that
 the built-in @w{@kbd{a R}} (@code{calc-find-root}) command uses Newton's
 method when it is able.  @xref{Programming Answer 8, 8}. (@bullet{})
 
 @cindex Digamma function
 @cindex Gamma constant, Euler's
 @cindex Euler's gamma constant
-(@bullet{}) @strong{Exercise 9.}  The @dfn{digamma} function @c{$\psi(z)$ (``psi'')}
-@cite{psi(z)}
-is defined as the derivative of @c{$\ln \Gamma(z)$}
-@cite{ln(gamma(z))}.  For large
-values of @cite{z}, it can be approximated by the infinite sum
+(@bullet{}) @strong{Exercise 9.}  The @dfn{digamma} function 
+@texline @tmath{\psi(z) (``psi'')}
+@infoline @expr{psi(z)}
+is defined as the derivative of 
+@texline @tmath{\ln \Gamma(z)}.
+@infoline @expr{ln(gamma(z))}.  
+For large values of @expr{z}, it can be approximated by the infinite sum
 
 @ifinfo
 @example
@@ -6398,7 +6474,6 @@
 @end example
 @end ifinfo
 @tex
-\let\rm\goodrm
 \beforedisplay
 $$ \psi(z) \approx \ln z - {1\over2z} -
    \sum_{n=1}^\infty {\code{bern}(2 n) \over 2 n z^{2n}}
@@ -6407,37 +6482,48 @@
 @end tex
 
 @noindent
-where @c{$\sum$}
-@cite{sum} represents the sum over @cite{n} from 1 to infinity
+where 
+@texline @tmath{\sum}
+@infoline @expr{sum} 
+represents the sum over @expr{n} from 1 to infinity
 (or to some limit high enough to give the desired accuracy), and
 the @code{bern} function produces (exact) Bernoulli numbers.
 While this sum is not guaranteed to converge, in practice it is safe.
 An interesting mathematical constant is Euler's gamma, which is equal
 to about 0.5772.  One way to compute it is by the formula,
-@c{$\gamma = -\psi(1)$}
-@cite{gamma = -psi(1)}.  Unfortunately, 1 isn't a large enough argument
-for the above formula to work (5 is a much safer value for @cite{z}).
-Fortunately, we can compute @c{$\psi(1)$}
-@cite{psi(1)} from @c{$\psi(5)$}
-@cite{psi(5)} using
-the recurrence @c{$\psi(z+1) = \psi(z) + {1 \over z}$}
-@cite{psi(z+1) = psi(z) + 1/z}.  Your task:  Develop
-a program to compute @c{$\psi(z)$}
-@cite{psi(z)}; it should ``pump up'' @cite{z}
+@texline @tmath{\gamma = -\psi(1)}.
+@infoline @expr{gamma = -psi(1)}.  
+Unfortunately, 1 isn't a large enough argument
+for the above formula to work (5 is a much safer value for @expr{z}).
+Fortunately, we can compute 
+@texline @tmath{\psi(1)}
+@infoline @expr{psi(1)} 
+from 
+@texline @tmath{\psi(5)}
+@infoline @expr{psi(5)} 
+using the recurrence 
+@texline @tmath{\psi(z+1) = \psi(z) + {1 \over z}}.
+@infoline @expr{psi(z+1) = psi(z) + 1/z}.  
+Your task:  Develop a program to compute 
+@texline @tmath{\psi(z)};
+@infoline @expr{psi(z)}; 
+it should ``pump up'' @expr{z}
 if necessary to be greater than 5, then use the above summation
 formula.  Use looping commands to compute the sum.  Use your function
-to compute @c{$\gamma$}
-@cite{gamma} to twelve decimal places.  (Calc has a built-in command
+to compute 
+@texline @tmath{\gamma}
+@infoline @expr{gamma} 
+to twelve decimal places.  (Calc has a built-in command
 for Euler's constant, @kbd{I P}, which you can use to check your answer.)
 @xref{Programming Answer 9, 9}. (@bullet{})
 
 @cindex Polynomial, list of coefficients
-(@bullet{}) @strong{Exercise 10.}  Given a polynomial in @cite{x} and
-a number @cite{m} on the stack, where the polynomial is of degree
-@cite{m} or less (i.e., does not have any terms higher than @cite{x^m}),
+(@bullet{}) @strong{Exercise 10.}  Given a polynomial in @expr{x} and
+a number @expr{m} on the stack, where the polynomial is of degree
+@expr{m} or less (i.e., does not have any terms higher than @expr{x^m}),
 write a program to convert the polynomial into a list-of-coefficients
-notation.  For example, @cite{5 x^4 + (x + 1)^2} with @cite{m = 6}
-should produce the list @cite{[1, 2, 1, 0, 5, 0, 0]}.  Also develop
+notation.  For example, @expr{5 x^4 + (x + 1)^2} with @expr{m = 6}
+should produce the list @expr{[1, 2, 1, 0, 5, 0, 0]}.  Also develop
 a way to convert from this form back to the standard algebraic form.
 @xref{Programming Answer 10, 10}. (@bullet{})
 
@@ -6478,9 +6564,9 @@
 the complete recursive program.  (Another way is to use @w{@kbd{Z E}}
 or @kbd{M-# m} (@code{read-kbd-macro}) to read the whole macro at once,
 thus avoiding the ``training'' phase.)  The task:  Write a program
-that computes Stirling numbers of the first kind, given @cite{n} and
-@cite{m} on the stack.  Test it with @emph{small} inputs like
-@cite{s(4,2)}.  (There is a built-in command for Stirling numbers,
+that computes Stirling numbers of the first kind, given @expr{n} and
+@expr{m} on the stack.  Test it with @emph{small} inputs like
+@expr{s(4,2)}.  (There is a built-in command for Stirling numbers,
 @kbd{k s}, which you can use to check your answers.)
 @xref{Programming Answer 11, 11}. (@bullet{})
 
@@ -6492,7 +6578,7 @@
 
 (@bullet{}) @strong{Exercise 12.}  Write another program for
 computing Stirling numbers of the first kind, this time using
-rewrite rules.  Once again, @cite{n} and @cite{m} should be taken
+rewrite rules.  Once again, @expr{n} and @expr{m} should be taken
 from the stack.  @xref{Programming Answer 12, 12}. (@bullet{})
 
 @example
@@ -6601,21 +6687,23 @@
 @noindent
 @kbd{1 @key{RET} 2 @key{RET} 3 @key{RET} 4 + * -}
 
-The result is @c{$1 - (2 \times (3 + 4)) = -13$}
-@cite{1 - (2 * (3 + 4)) = -13}.
+The result is 
+@texline @tmath{1 - (2 \times (3 + 4)) = -13}.
+@infoline @expr{1 - (2 * (3 + 4)) = -13}.
 
 @node RPN Answer 2, RPN Answer 3, RPN Answer 1, Answers to Exercises
 @subsection RPN Tutorial Exercise 2
 
 @noindent
-@c{$2\times4 + 7\times9.5 + {5\over4} = 75.75$}
-@cite{2*4 + 7*9.5 + 5/4 = 75.75}
-
-After computing the intermediate term @c{$2\times4 = 8$}
-@cite{2*4 = 8}, you can leave
-that result on the stack while you compute the second term.  With
-both of these results waiting on the stack you can then compute the
-final term, then press @kbd{+ +} to add everything up.
+@texline @tmath{2\times4 + 7\times9.5 + {5\over4} = 75.75}
+@infoline @expr{2*4 + 7*9.5 + 5/4 = 75.75}
+
+After computing the intermediate term 
+@texline @tmath{2\times4 = 8},
+@infoline @expr{2*4 = 8}, 
+you can leave that result on the stack while you compute the second
+term.  With both of these results waiting on the stack you can then
+compute the final term, then press @kbd{+ +} to add everything up.
 
 @smallexample
 @group
@@ -6739,8 +6827,8 @@
 Or, RPN style, @kbd{0.5 ^}.
 
 (Actually, @samp{$^1:2}, using the fraction one-half as the power, is
-a closer equivalent, since @samp{9^0.5} yields @cite{3.0} whereas
-@samp{sqrt(9)} and @samp{9^1:2} yield the exact integer @cite{3}.)
+a closer equivalent, since @samp{9^0.5} yields @expr{3.0} whereas
+@samp{sqrt(9)} and @samp{9^1:2} yield the exact integer @expr{3}.)
 
 @node Algebraic Answer 2, Algebraic Answer 3, Algebraic Answer 1, Answers to Exercises
 @subsection Algebraic Entry Tutorial Exercise 2
@@ -6755,14 +6843,14 @@
 @subsection Algebraic Entry Tutorial Exercise 3
 
 @noindent
-The result from @kbd{1 @key{RET} 0 /} will be the formula @cite{1 / 0}.
+The result from @kbd{1 @key{RET} 0 /} will be the formula @expr{1 / 0}.
 The ``function'' @samp{/} cannot be evaluated when its second argument
 is zero, so it is left in symbolic form.  When you now type @kbd{0 *},
 the result will be zero because Calc uses the general rule that ``zero
 times anything is zero.''
 
 @c [fix-ref Infinities]
-The @kbd{m i} command enables an @dfn{infinite mode} in which @cite{1 / 0}
+The @kbd{m i} command enables an @dfn{infinite mode} in which @expr{1 / 0}
 results in a special symbol that represents ``infinity.''  If you
 multiply infinity by zero, Calc uses another special new symbol to
 show that the answer is ``indeterminate.''  @xref{Infinities}, for
@@ -6852,7 +6940,7 @@
 @subsection Modes Tutorial Exercise 3
 
 @noindent
-The answer he got was @cite{0.5000000000006399}.
+The answer he got was @expr{0.5000000000006399}.
 
 The problem is not that the square operation is inexact, but that the
 sine of 45 that was already on the stack was accurate to only 12 places.
@@ -6917,16 +7005,17 @@
 @noindent
 Dividing two integers that are larger than the current precision may
 give a floating-point result that is inaccurate even when rounded
-down to an integer.  Consider @cite{123456789 / 2} when the current
-precision is 6 digits.  The true answer is @cite{61728394.5}, but
-with a precision of 6 this will be rounded to @c{$12345700.0/2.0 = 61728500.0$}
-@cite{12345700.@: / 2.@: = 61728500.}.
+down to an integer.  Consider @expr{123456789 / 2} when the current
+precision is 6 digits.  The true answer is @expr{61728394.5}, but
+with a precision of 6 this will be rounded to 
+@texline @tmath{12345700.0/2.0 = 61728500.0}.
+@infoline @expr{12345700.@: / 2.@: = 61728500.}.
 The result, when converted to an integer, will be off by 106.
 
 Here are two solutions:  Raise the precision enough that the
 floating-point round-off error is strictly to the right of the
-decimal point.  Or, convert to fraction mode so that @cite{123456789 / 2}
-produces the exact fraction @cite{123456789:2}, which can be rounded
+decimal point.  Or, convert to fraction mode so that @expr{123456789 / 2}
+produces the exact fraction @expr{123456789:2}, which can be rounded
 down by the @kbd{F} command without ever switching to floating-point
 format.
 
@@ -6934,8 +7023,8 @@
 @subsection Arithmetic Tutorial Exercise 2
 
 @noindent
-@kbd{27 @key{RET} 9 B} could give the exact result @cite{3:2}, but it
-does a floating-point calculation instead and produces @cite{1.5}.
+@kbd{27 @key{RET} 9 B} could give the exact result @expr{3:2}, but it
+does a floating-point calculation instead and produces @expr{1.5}.
 
 Calc will find an exact result for a logarithm if the result is an integer
 or the reciprocal of an integer.  But there is no efficient way to search
@@ -7029,14 +7118,19 @@
 @subsection Matrix Tutorial Exercise 3
 
 @noindent
-To solve @c{$A^T A \, X = A^T B$}
-@cite{trn(A) * A * X = trn(A) * B}, first we compute
-@c{$A' = A^T A$}
-@cite{A2 = trn(A) * A} and @c{$B' = A^T B$}
-@cite{B2 = trn(A) * B}; now, we have a
-system @c{$A' X = B'$}
-@cite{A2 * X = B2} which we can solve using Calc's @samp{/}
-command.
+To solve 
+@texline @tmath{A^T A \, X = A^T B},
+@infoline @expr{trn(A) * A * X = trn(A) * B}, 
+first we compute
+@texline @tmath{A' = A^T A}
+@infoline @expr{A2 = trn(A) * A} 
+and 
+@texline @tmath{B' = A^T B};
+@infoline @expr{B2 = trn(A) * B}; 
+now, we have a system 
+@texline @tmath{A' X = B'}
+@infoline @expr{A2 * X = B2} 
+which we can solve using Calc's @samp{/} command.
 
 @ifinfo
 @example
@@ -7066,8 +7160,9 @@
 
 The first step is to enter the coefficient matrix.  We'll store it in
 quick variable number 7 for later reference.  Next, we compute the
-@c{$B'$}
-@cite{B2} vector.
+@texline @tmath{B'}
+@infoline @expr{B2} 
+vector.
 
 @smallexample
 @group
@@ -7082,8 +7177,10 @@
 @end smallexample
 
 @noindent
-Now we compute the matrix @c{$A'$}
-@cite{A2} and divide.
+Now we compute the matrix 
+@texline @tmath{A'}
+@infoline @expr{A2} 
+and divide.
 
 @smallexample
 @group
@@ -7101,14 +7198,18 @@
 (The actual computed answer will be slightly inexact due to
 round-off error.)
 
-Notice that the answers are similar to those for the @c{$3\times3$}
-@asis{3x3} system
-solved in the text.  That's because the fourth equation that was
+Notice that the answers are similar to those for the 
+@texline @tmath{3\times3}
+@infoline 3x3
+system solved in the text.  That's because the fourth equation that was 
 added to the system is almost identical to the first one multiplied
 by two.  (If it were identical, we would have gotten the exact same
-answer since the @c{$4\times3$}
-@asis{4x3} system would be equivalent to the original @c{$3\times3$}
-@asis{3x3}
+answer since the 
+@texline @tmath{4\times3}
+@infoline 4x3
+system would be equivalent to the original 
+@texline @tmath{3\times3}
+@infoline 3x3
 system.)
 
 Since the first and fourth equations aren't quite equivalent, they
@@ -7129,8 +7230,8 @@
 @end smallexample
 
 @noindent
-This is reasonably close to our original @cite{B} vector,
-@cite{[6, 2, 3, 11]}.
+This is reasonably close to our original @expr{B} vector,
+@expr{[6, 2, 3, 11]}.
 
 @node List Answer 1, List Answer 2, Matrix Answer 3, Answers to Exercises
 @subsection List Tutorial Exercise 1
@@ -7168,7 +7269,7 @@
 @subsection List Tutorial Exercise 2
 
 @noindent
-Given @cite{x} and @cite{y} vectors in quick variables 1 and 2 as before,
+Given @expr{x} and @expr{y} vectors in quick variables 1 and 2 as before,
 the first job is to form the matrix that describes the problem.
 
 @ifinfo
@@ -7183,10 +7284,12 @@
 \afterdisplay
 @end tex
 
-Thus we want a @c{$19\times2$}
-@asis{19x2} matrix with our @cite{x} vector as one column and
+Thus we want a 
+@texline @tmath{19\times2}
+@infoline 19x2
+matrix with our @expr{x} vector as one column and
 ones as the other column.  So, first we build the column of ones, then
-we combine the two columns to form our @cite{A} matrix.
+we combine the two columns to form our @expr{A} matrix.
 
 @smallexample
 @group
@@ -7200,9 +7303,13 @@
 @end smallexample
 
 @noindent
-Now we compute @c{$A^T y$}
-@cite{trn(A) * y} and @c{$A^T A$}
-@cite{trn(A) * A} and divide.
+Now we compute 
+@texline @tmath{A^T y}
+@infoline @expr{trn(A) * y} 
+and 
+@texline @tmath{A^T A}
+@infoline @expr{trn(A) * A} 
+and divide.
 
 @smallexample
 @group
@@ -7227,10 +7334,12 @@
 @end group
 @end smallexample
 
-Since we were solving equations of the form @c{$m \times x + b \times 1 = y$}
-@cite{m*x + b*1 = y}, these
-numbers should be @cite{m} and @cite{b}, respectively.  Sure enough, they
-agree exactly with the result computed using @kbd{V M} and @kbd{V R}!
+Since we were solving equations of the form 
+@texline @tmath{m \times x + b \times 1 = y},
+@infoline @expr{m*x + b*1 = y}, 
+these numbers should be @expr{m} and @expr{b}, respectively.  Sure
+enough, they agree exactly with the result computed using @kbd{V M} and
+@kbd{V R}!
 
 The moral of this story:  @kbd{V M} and @kbd{V R} will probably solve
 your problem, but there is often an easier way using the higher-level
@@ -7288,9 +7397,10 @@
 @subsection List Tutorial Exercise 4
 
 @noindent
-A number @cite{j} is a divisor of @cite{n} if @c{$n \mathbin{\hbox{\code{\%}}} j = 0$}
-@samp{n % j = 0}.  The first
-step is to get a vector that identifies the divisors.
+A number @expr{j} is a divisor of @expr{n} if 
+@texline @tmath{n \mathbin{\hbox{\code{\%}}} j = 0}.
+@infoline @samp{n % j = 0}.  
+The first step is to get a vector that identifies the divisors.
 
 @smallexample
 @group
@@ -7358,10 +7468,11 @@
 zero, so adding zeros on the left and right is safe.  From then on
 the job is pretty straightforward.
 
-Incidentally, Calc provides the @c{\dfn{M\"obius} $\mu$}
-@dfn{Moebius mu} function which is
-zero if and only if its argument is square-free.  It would be a much
-more convenient way to do the above test in practice.
+Incidentally, Calc provides the 
+@texline @dfn{M@"obius} @tmath{\mu}
+@infoline @dfn{Moebius mu} 
+function which is zero if and only if its argument is square-free.  It
+would be a much more convenient way to do the above test in practice.
 
 @node List Answer 6, List Answer 7, List Answer 5, Answers to Exercises
 @subsection List Tutorial Exercise 6
@@ -7389,10 +7500,11 @@
 @end smallexample
 
 The numbers down the lefthand edge of the list we desire are called
-the ``triangular numbers'' (now you know why!).  The @cite{n}th
-triangular number is the sum of the integers from 1 to @cite{n}, and
-can be computed directly by the formula @c{$n (n+1) \over 2$}
-@cite{n * (n+1) / 2}.
+the ``triangular numbers'' (now you know why!).  The @expr{n}th
+triangular number is the sum of the integers from 1 to @expr{n}, and
+can be computed directly by the formula 
+@texline @tmath{n (n+1) \over 2}.
+@infoline @expr{n * (n+1) / 2}.
 
 @smallexample
 @group
@@ -7446,7 +7558,7 @@
 @subsection List Tutorial Exercise 8
 
 @noindent
-The first step is to build a list of values of @cite{x}.
+The first step is to build a list of values of @expr{x}.
 
 @smallexample
 @group
@@ -7486,12 +7598,13 @@
 
 @noindent
 It's a good idea to verify, as in the last step above, that only
-one value is equal to the maximum.  (After all, a plot of @c{$\sin x$}
-@cite{sin(x)}
+one value is equal to the maximum.  (After all, a plot of 
+@texline @tmath{\sin x}
+@infoline @expr{sin(x)}
 might have many points all equal to the maximum value, 1.)
 
 The vector we have now has a single 1 in the position that indicates
-the maximum value of @cite{x}.  Now it is a simple matter to convert
+the maximum value of @expr{x}.  Now it is a simple matter to convert
 this back into the corresponding value itself.
 
 @smallexample
@@ -7504,12 +7617,12 @@
 @end group
 @end smallexample
 
-If @kbd{a =} had produced more than one @cite{1} value, this method
-would have given the sum of all maximum @cite{x} values; not very
+If @kbd{a =} had produced more than one @expr{1} value, this method
+would have given the sum of all maximum @expr{x} values; not very
 useful!  In this case we could have used @kbd{v m} (@code{calc-mask-vector})
 instead.  This command deletes all elements of a ``data'' vector that
 correspond to zeros in a ``mask'' vector, leaving us with, in this
-example, a vector of maximum @cite{x} values.
+example, a vector of maximum @expr{x} values.
 
 The built-in @kbd{a X} command maximizes a function using more
 efficient methods.  Just for illustration, let's use @kbd{a X}
@@ -7526,7 +7639,7 @@
 @end smallexample
 
 @noindent
-The output from @kbd{a X} is a vector containing the value of @cite{x}
+The output from @kbd{a X} is a vector containing the value of @expr{x}
 that maximizes the function, and the function's value at that maximum.
 As you can see, our simple search got quite close to the right answer.
 
@@ -7656,10 +7769,10 @@
 @subsection List Tutorial Exercise 10
 
 @noindent
-For the list @cite{[a, b, c, d]}, the result is @cite{((a = b) = c) = d},
-which will compare @cite{a} and @cite{b} to produce a 1 or 0, which is
-then compared with @cite{c} to produce another 1 or 0, which is then
-compared with @cite{d}.  This is not at all what Joe wanted.
+For the list @expr{[a, b, c, d]}, the result is @expr{((a = b) = c) = d},
+which will compare @expr{a} and @expr{b} to produce a 1 or 0, which is
+then compared with @expr{c} to produce another 1 or 0, which is then
+compared with @expr{d}.  This is not at all what Joe wanted.
 
 Here's a more correct method:
 
@@ -7687,9 +7800,9 @@
 @subsection List Tutorial Exercise 11
 
 @noindent
-The circle of unit radius consists of those points @cite{(x,y)} for which
-@cite{x^2 + y^2 < 1}.  We start by generating a vector of @cite{x^2}
-and a vector of @cite{y^2}.
+The circle of unit radius consists of those points @expr{(x,y)} for which
+@expr{x^2 + y^2 < 1}.  We start by generating a vector of @expr{x^2}
+and a vector of @expr{y^2}.
 
 We can make this go a bit faster by using the @kbd{v .} and @kbd{t .}
 commands.
@@ -7715,7 +7828,7 @@
 @end group
 @end smallexample
 
-Now we sum the @cite{x^2} and @cite{y^2} values, compare with 1 to
+Now we sum the @expr{x^2} and @expr{y^2} values, compare with 1 to
 get a vector of 1/0 truth values, then sum the truth values.
 
 @smallexample
@@ -7728,8 +7841,7 @@
 @end smallexample
 
 @noindent
-The ratio @cite{84/100} should approximate the ratio @c{$\pi/4$}
-@cite{pi/4}.
+The ratio @expr{84/100} should approximate the ratio @cpiover{4}.
 
 @smallexample
 @group
@@ -7757,30 +7869,33 @@
 @noindent
 This problem can be made a lot easier by taking advantage of some
 symmetries.  First of all, after some thought it's clear that the
-@cite{y} axis can be ignored altogether.  Just pick a random @cite{x}
-component for one end of the match, pick a random direction @c{$\theta$}
-@cite{theta},
-and see if @cite{x} and @c{$x + \cos \theta$}
-@cite{x + cos(theta)} (which is the @cite{x}
-coordinate of the other endpoint) cross a line.  The lines are at
-integer coordinates, so this happens when the two numbers surround
-an integer.
+@expr{y} axis can be ignored altogether.  Just pick a random @expr{x}
+component for one end of the match, pick a random direction 
+@texline @tmath{\theta},
+@infoline @expr{theta},
+and see if @expr{x} and 
+@texline @tmath{x + \cos \theta}
+@infoline @expr{x + cos(theta)} 
+(which is the @expr{x} coordinate of the other endpoint) cross a line.
+The lines are at integer coordinates, so this happens when the two
+numbers surround an integer.
 
 Since the two endpoints are equivalent, we may as well choose the leftmost
-of the two endpoints as @cite{x}.  Then @cite{theta} is an angle pointing
+of the two endpoints as @expr{x}.  Then @expr{theta} is an angle pointing
 to the right, in the range -90 to 90 degrees.  (We could use radians, but
-it would feel like cheating to refer to @c{$\pi/2$}
-@cite{pi/2} radians while trying
-to estimate @c{$\pi$}
-@cite{pi}!)
+it would feel like cheating to refer to @cpiover{2} radians while trying
+to estimate @cpi{}!)
 
 In fact, since the field of lines is infinite we can choose the
 coordinates 0 and 1 for the lines on either side of the leftmost
 endpoint.  The rightmost endpoint will be between 0 and 1 if the
 match does not cross a line, or between 1 and 2 if it does.  So:
-Pick random @cite{x} and @c{$\theta$}
-@cite{theta}, compute @c{$x + \cos \theta$}
-@cite{x + cos(theta)},
+Pick random @expr{x} and 
+@texline @tmath{\theta},
+@infoline @expr{theta}, 
+compute
+@texline @tmath{x + \cos \theta},
+@infoline @expr{x + cos(theta)},
 and count how many of the results are greater than one.  Simple!
 
 We can make this go a bit faster by using the @kbd{v .} and @kbd{t .}
@@ -7881,8 +7996,8 @@
 like @kbd{)} and @kbd{]} at the end of a formula.
 
 We'll show two different approaches here.  In the first, we note that
-if the input vector is @cite{[a, b, c, d]}, then the hash code is
-@cite{3 (3 (3a + b) + c) + d = 27a + 9b + 3c + d}.  In other words,
+if the input vector is @expr{[a, b, c, d]}, then the hash code is
+@expr{3 (3 (3a + b) + c) + d = 27a + 9b + 3c + d}.  In other words,
 it's a sum of descending powers of three times the ASCII codes.
 
 @smallexample
@@ -7944,7 +8059,7 @@
 @end smallexample
 
 Why does this work?  Think about a two-step computation:
-@w{@cite{3 (3a + b) + c}}.  Taking a result modulo 511 basically means
+@w{@expr{3 (3a + b) + c}}.  Taking a result modulo 511 basically means
 subtracting off enough 511's to put the result in the desired range.
 So the result when we take the modulo after every step is,
 
@@ -7961,7 +8076,7 @@
 @end tex
 
 @noindent
-for some suitable integers @cite{m} and @cite{n}.  Expanding out by
+for some suitable integers @expr{m} and @expr{n}.  Expanding out by
 the distributive law yields
 
 @ifinfo
@@ -7977,10 +8092,10 @@
 @end tex
 
 @noindent
-The @cite{m} term in the latter formula is redundant because any
-contribution it makes could just as easily be made by the @cite{n}
+The @expr{m} term in the latter formula is redundant because any
+contribution it makes could just as easily be made by the @expr{n}
 term.  So we can take it out to get an equivalent formula with
-@cite{n' = 3m + n},
+@expr{n' = 3m + n},
 
 @ifinfo
 @example
@@ -8006,7 +8121,7 @@
 @subsection List Tutorial Exercise 14
 
 We want to use @kbd{H V U} to nest a function which adds a random
-step to an @cite{(x,y)} coordinate.  The function is a bit long, but
+step to an @expr{(x,y)} coordinate.  The function is a bit long, but
 otherwise the problem is quite straightforward.
 
 @smallexample
@@ -8024,9 +8139,9 @@
 notation to keep the two @code{random} calls from being evaluated
 before nesting even begins.
 
-We now have a vector of @cite{[x, y]} sub-vectors, which by Calc's
+We now have a vector of @expr{[x, y]} sub-vectors, which by Calc's
 rules acts like a matrix.  We can transpose this matrix and unpack
-to get a pair of vectors, @cite{x} and @cite{y}, suitable for graphing.
+to get a pair of vectors, @expr{x} and @expr{y}, suitable for graphing.
 
 @smallexample
 @group
@@ -8038,12 +8153,12 @@
 @end group
 @end smallexample
 
-Incidentally, because the @cite{x} and @cite{y} are completely
+Incidentally, because the @expr{x} and @expr{y} are completely
 independent in this case, we could have done two separate commands
-to create our @cite{x} and @cite{y} vectors of numbers directly.
+to create our @expr{x} and @expr{y} vectors of numbers directly.
 
 To make a random walk of unit steps, we note that @code{sincos} of
-a random direction exactly gives us an @cite{[x, y]} step of unit
+a random direction exactly gives us an @expr{[x, y]} step of unit
 length; in fact, the new nesting function is even briefer, though
 we might want to lower the precision a bit for it.
 
@@ -8071,10 +8186,8 @@
 @subsection Types Tutorial Exercise 1
 
 @noindent
-If the number is the square root of @c{$\pi$}
-@cite{pi} times a rational number,
-then its square, divided by @c{$\pi$}
-@cite{pi}, should be a rational number.
+If the number is the square root of @cpi{} times a rational number,
+then its square, divided by @cpi{}, should be a rational number.
 
 @smallexample
 @group
@@ -8106,8 +8219,8 @@
 @noindent
 Aha!  It's unlikely that an irrational number would equal a fraction
 this simple to within ten digits, so our original number was probably
-@c{$\sqrt{27 \pi / 53}$}
-@cite{sqrt(27 pi / 53)}.
+@texline @tmath{\sqrt{27 \pi / 53}}.
+@infoline @expr{sqrt(27 pi / 53)}.
 
 Notice that we didn't need to re-round the number when we reduced the
 precision.  Remember, arithmetic operations always round their inputs
@@ -8123,17 +8236,17 @@
 @samp{exp(inf) = inf}.  It's tempting to say that the exponential
 of infinity must be ``bigger'' than ``regular'' infinity, but as
 far as Calc is concerned all infinities are as just as big.
-In other words, as @cite{x} goes to infinity, @cite{e^x} also goes
-to infinity, but the fact the @cite{e^x} grows much faster than
-@cite{x} is not relevant here.
+In other words, as @expr{x} goes to infinity, @expr{e^x} also goes
+to infinity, but the fact the @expr{e^x} grows much faster than
+@expr{x} is not relevant here.
 
 @samp{exp(-inf) = 0}.  Here we have a finite answer even though
 the input is infinite.
 
-@samp{sqrt(-inf) = (0, 1) inf}.  Remember that @cite{(0, 1)}
-represents the imaginary number @cite{i}.  Here's a derivation:
+@samp{sqrt(-inf) = (0, 1) inf}.  Remember that @expr{(0, 1)}
+represents the imaginary number @expr{i}.  Here's a derivation:
 @samp{sqrt(-inf) = @w{sqrt((-1) * inf)} = sqrt(-1) * sqrt(inf)}.
-The first part is, by definition, @cite{i}; the second is @code{inf}
+The first part is, by definition, @expr{i}; the second is @code{inf}
 because, once again, all infinities are the same size.
 
 @samp{sqrt(uinf) = uinf}.  In fact, we do know something about the
@@ -8141,11 +8254,11 @@
 right half of the complex plane.  But Calc has no notation for this,
 so it settles for the conservative answer @code{uinf}.
 
-@samp{abs(uinf) = inf}.  No matter which direction @cite{x} points,
+@samp{abs(uinf) = inf}.  No matter which direction @expr{x} points,
 @samp{abs(x)} always points along the positive real axis.
 
 @samp{ln(0) = -inf}.  Here we have an infinite answer to a finite
-input.  As in the @cite{1 / 0} case, Calc will only use infinities
+input.  As in the @expr{1 / 0} case, Calc will only use infinities
 here if you have turned on ``infinite'' mode.  Otherwise, it will
 treat @samp{ln(0)} as an error.
 
@@ -8154,9 +8267,9 @@
 
 @noindent
 We can make @samp{inf - inf} be any real number we like, say,
-@cite{a}, just by claiming that we added @cite{a} to the first
+@expr{a}, just by claiming that we added @expr{a} to the first
 infinity but not to the second.  This is just as true for complex
-values of @cite{a}, so @code{nan} can stand for a complex number.
+values of @expr{a}, so @code{nan} can stand for a complex number.
 (And, similarly, @code{uinf} can stand for an infinity that points
 in any direction in the complex plane, such as @samp{(0, 1) inf}).
 
@@ -8403,7 +8516,7 @@
 @subsection Types Tutorial Exercise 10
 
 @noindent
-Testing the first number, we might arbitrarily choose 17 for @cite{x}.
+Testing the first number, we might arbitrarily choose 17 for @expr{x}.
 
 @smallexample
 @group
@@ -8435,7 +8548,7 @@
 @end smallexample
 
 @noindent
-The result is three ones (modulo @cite{n}), so it's very probable that
+The result is three ones (modulo @expr{n}), so it's very probable that
 15485863 is prime.  (In fact, this number is the millionth prime.)
 
 Note that the functions @samp{($$^($-1)) mod $} or @samp{$$^($-1) % $}
@@ -8604,20 +8717,20 @@
 
 @noindent
 @c [fix-ref Declarations]
-The result @samp{sqrt(x)^2} is simplified back to @cite{x} by the
+The result @samp{sqrt(x)^2} is simplified back to @expr{x} by the
 Calculator, but @samp{sqrt(x^2)} is not.  (Consider what happens
-if @w{@cite{x = -4}}.)  If @cite{x} is real, this formula could be
+if @w{@expr{x = -4}}.)  If @expr{x} is real, this formula could be
 simplified to @samp{abs(x)}, but for general complex arguments even
 that is not safe.  (@xref{Declarations}, for a way to tell Calc
-that @cite{x} is known to be real.)
+that @expr{x} is known to be real.)
 
 @node Algebra Answer 2, Algebra Answer 3, Algebra Answer 1, Answers to Exercises
 @subsection Algebra Tutorial Exercise 2
 
 @noindent
-Suppose our roots are @cite{[a, b, c]}.  We want a polynomial which
-is zero when @cite{x} is any of these values.  The trivial polynomial
-@cite{x-a} is zero when @cite{x=a}, so the product @cite{(x-a)(x-b)(x-c)}
+Suppose our roots are @expr{[a, b, c]}.  We want a polynomial which
+is zero when @expr{x} is any of these values.  The trivial polynomial
+@expr{x-a} is zero when @expr{x=a}, so the product @expr{(x-a)(x-b)(x-c)}
 will do the job.  We can use @kbd{a c x} to write this in a more
 familiar form.
 
@@ -8808,7 +8921,7 @@
 @end smallexample
 
 @noindent
-Multiplying by the conjugate helps because @cite{(a+b) (a-b) = a^2 - b^2}.
+Multiplying by the conjugate helps because @expr{(a+b) (a-b) = a^2 - b^2}.
 
 @smallexample
 @group
@@ -8858,11 +8971,11 @@
 into a three-argument @code{fib} that makes computation easier.  The
 second rule converts back from three-argument form once the computation
 is done.  The third rule does the computation itself.  It basically
-says that if @cite{x} and @cite{y} are two consecutive Fibonacci numbers,
-then @cite{y} and @cite{x+y} are the next (overlapping) pair of Fibonacci
+says that if @expr{x} and @expr{y} are two consecutive Fibonacci numbers,
+then @expr{y} and @expr{x+y} are the next (overlapping) pair of Fibonacci
 numbers.
 
-Notice that because the number @cite{n} was ``validated'' by the
+Notice that because the number @expr{n} was ``validated'' by the
 conditions on the first rule, there is no need to put conditions on
 the other rules because the rule set would never get that far unless
 the input were valid.  That further speeds computation, since no
@@ -8959,8 +9072,8 @@
 @noindent
 Given @samp{seq(6)}, the result is @samp{[6, 3, 10, 5, 16, 8, 4, 2, 1]}.
 
-Notice that the @cite{n > 1} guard is no longer necessary on the last
-rule since the @cite{n = 1} case is now detected by another rule.
+Notice that the @expr{n > 1} guard is no longer necessary on the last
+rule since the @expr{n = 1} case is now detected by another rule.
 But a guard has been added to the initial rule to make sure the
 initial value is suitable before the computation begins.
 
@@ -8978,8 +9091,8 @@
 @starindex
 @end ignore
 @tindex nterms
-If @cite{x} is the sum @cite{a + b}, then `@t{nterms(}@var{x}@t{)}' must
-be `@t{nterms(}@var{a}@t{)}' plus `@t{nterms(}@var{b}@t{)}'.  If @cite{x}
+If @expr{x} is the sum @expr{a + b}, then `@t{nterms(}@var{x}@t{)}' must
+be `@t{nterms(}@var{a}@t{)}' plus `@t{nterms(}@var{b}@t{)}'.  If @expr{x}
 is not a sum, then `@t{nterms(}@var{x}@t{)}' = 1.
 
 @smallexample
@@ -9026,7 +9139,7 @@
 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 @cite{0^0} to
+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}.
@@ -9085,7 +9198,7 @@
 Another way to solve this problem would be to create a new ``data type''
 that represents truncated power series.  We might represent these as
 function calls @samp{series(@var{coefs}, @var{x})} where @var{coefs} is
-a vector of coefficients for @cite{x^0}, @cite{x^1}, @cite{x^2}, and so
+a vector of coefficients for @expr{x^0}, @expr{x^1}, @expr{x^2}, and so
 on.  Rules would exist for sums and products of such @code{series}
 objects, and as an optional convenience could also know how to combine a
 @code{series} object with a normal polynomial.  (With this, and with a
@@ -9115,7 +9228,7 @@
 Just enter the formula @samp{ninteg(sin(t)/t, t, 0, x)}, type
 @kbd{Z F}, and answer the questions.  Since this formula contains two
 variables, the default argument list will be @samp{(t x)}.  We want to
-change this to @samp{(x)} since @cite{t} is really a dummy variable
+change this to @samp{(x)} since @expr{t} is really a dummy variable
 to be used within @code{ninteg}.
 
 The exact keystrokes are @kbd{Z F s Si @key{RET} @key{RET} C-b C-b @key{DEL} @key{DEL} @key{RET} y}.
@@ -9146,8 +9259,9 @@
 algebraic entry, whichever way you prefer:
 
 @noindent
-Computing @c{$\displaystyle{\sin x \over x}$}
-@cite{sin(x) / x}:
+Computing 
+@texline @tmath{\displaystyle{\sin x \over x}}:
+@infoline @expr{sin(x) / x}:
 
 Using the stack:  @kbd{C-x (  @key{RET} S @key{TAB} /  C-x )}.
 
@@ -9207,8 +9321,8 @@
 @end example
 
 @noindent
-Thus @samp{[0, 1; 1, 1]^n * [1, 1]} computes Fibonacci numbers @cite{n+1}
-and @cite{n+2}.  Here's one program that does the job:
+Thus @samp{[0, 1; 1, 1]^n * [1, 1]} computes Fibonacci numbers @expr{n+1}
+and @expr{n+2}.  Here's one program that does the job:
 
 @example
 C-x ( ' [0, 1; 1, 1] ^ ($-1) * [1, 1] @key{RET} v u @key{DEL} C-x )
@@ -9216,8 +9330,9 @@
 
 @noindent
 This program is quite efficient because Calc knows how to raise a
-matrix (or other value) to the power @cite{n} in only @c{$\log_2 n$}
-@cite{log(n,2)}
+matrix (or other value) to the power @expr{n} in only 
+@texline @tmath{\log_2 n}
+@infoline @expr{log(n,2)}
 steps.  For example, this program can compute the 1000th Fibonacci
 number (a 209-digit integer!) in about 10 steps; even though the
 @kbd{Z < ... Z >} solution had much simpler steps, it would have
@@ -9268,9 +9383,10 @@
 @subsection Programming Tutorial Exercise 8
 
 @noindent
-The first step is to compute the derivative @cite{f'(x)} and thus
-the formula @c{$\displaystyle{x - {f(x) \over f'(x)}}$}
-@cite{x - f(x)/f'(x)}.
+The first step is to compute the derivative @expr{f'(x)} and thus
+the formula 
+@texline @tmath{\displaystyle{x - {f(x) \over f'(x)}}}.
+@infoline @expr{x - f(x)/f'(x)}.
 
 (Because this definition is long, it will be repeated in concise form
 below.  You can use @w{@kbd{M-# m}} to load it from there.  While you are
@@ -9317,7 +9433,7 @@
 @end group
 @end smallexample
 
-This is the new guess for @cite{x}.  Now we compare it with the
+This is the new guess for @expr{x}.  Now we compare it with the
 old one to see if we've converged.
 
 @smallexample
@@ -9383,13 +9499,16 @@
 @subsection Programming Tutorial Exercise 9
 
 @noindent
-The first step is to adjust @cite{z} to be greater than 5.  A simple
-``for'' loop will do the job here.  If @cite{z} is less than 5, we
-reduce the problem using @c{$\psi(z) = \psi(z+1) - 1/z$}
-@cite{psi(z) = psi(z+1) - 1/z}.  We go
-on to compute @c{$\psi(z+1)$}
-@cite{psi(z+1)}, and remember to add back a factor of
-@cite{-1/z} when we're done.  This step is repeated until @cite{z > 5}.
+The first step is to adjust @expr{z} to be greater than 5.  A simple
+``for'' loop will do the job here.  If @expr{z} is less than 5, we
+reduce the problem using 
+@texline @tmath{\psi(z) = \psi(z+1) - 1/z}.
+@infoline @expr{psi(z) = psi(z+1) - 1/z}.  We go
+on to compute 
+@texline @tmath{\psi(z+1)},
+@infoline @expr{psi(z+1)}, 
+and remember to add back a factor of @expr{-1/z} when we're done.  This
+step is repeated until @expr{z > 5}.
 
 (Because this definition is long, it will be repeated in concise form
 below.  You can use @w{@kbd{M-# m}} to load it from there.  While you are
@@ -9407,8 +9526,8 @@
 @end group
 @end smallexample
 
-Here, variable 1 holds @cite{z} and variable 2 holds the adjustment
-factor.  If @cite{z < 5}, we use a loop to increase it.
+Here, variable 1 holds @expr{z} and variable 2 holds the adjustment
+factor.  If @expr{z < 5}, we use a loop to increase it.
 
 (By the way, we started with @samp{1.0} instead of the integer 1 because
 otherwise the calculation below will try to do exact fractional arithmetic,
@@ -9426,8 +9545,9 @@
 @end group
 @end smallexample
 
-Now we compute the initial part of the sum:  @c{$\ln z - {1 \over 2z}$}
-@cite{ln(z) - 1/2z}
+Now we compute the initial part of the sum:  
+@texline @tmath{\ln z - {1 \over 2z}}
+@infoline @expr{ln(z) - 1/2z}
 minus the adjustment factor.
 
 @smallexample
@@ -9441,7 +9561,7 @@
 @end smallexample
 
 Now we evaluate the series.  We'll use another ``for'' loop counting
-up the value of @cite{2 n}.  (Calc does have a summation command,
+up the value of @expr{2 n}.  (Calc does have a summation command,
 @kbd{a +}, but we'll use loops just to get more practice with them.)
 
 @smallexample
@@ -9468,9 +9588,11 @@
 @end group
 @end smallexample
 
-This is the value of @c{$-\gamma$}
-@cite{- gamma}, with a slight bit of roundoff error.
-To get a full 12 digits, let's use a higher precision:
+This is the value of 
+@texline @tmath{-\gamma},
+@infoline @expr{- gamma}, 
+with a slight bit of roundoff error.  To get a full 12 digits, let's use
+a higher precision:
 
 @smallexample
 @group
@@ -9500,12 +9622,14 @@
 @subsection Programming Tutorial Exercise 10
 
 @noindent
-Taking the derivative of a term of the form @cite{x^n} will produce
-a term like @c{$n x^{n-1}$}
-@cite{n x^(n-1)}.  Taking the derivative of a constant
-produces zero.  From this it is easy to see that the @cite{n}th
-derivative of a polynomial, evaluated at @cite{x = 0}, will equal the
-coefficient on the @cite{x^n} term times @cite{n!}.
+Taking the derivative of a term of the form @expr{x^n} will produce
+a term like 
+@texline @tmath{n x^{n-1}}.
+@infoline @expr{n x^(n-1)}.  
+Taking the derivative of a constant
+produces zero.  From this it is easy to see that the @expr{n}th
+derivative of a polynomial, evaluated at @expr{x = 0}, will equal the
+coefficient on the @expr{x^n} term times @expr{n!}.
 
 (Because this definition is long, it will be repeated in concise form
 below.  You can use @w{@kbd{M-# m}} to load it from there.  While you are
@@ -9554,7 +9678,7 @@
 @end smallexample
 
 To convert back, a simple method is just to map the coefficients
-against a table of powers of @cite{x}.
+against a table of powers of @expr{x}.
 
 @smallexample
 @group
@@ -9614,7 +9738,7 @@
 The last step replaces the 2 that was eaten during the creation
 of the dummy @kbd{z s} command.  Now we move on to the real
 definition.  The recurrence needs to be rewritten slightly,
-to the form @cite{s(n,m) = s(n-1,m-1) - (n-1) s(n-1,m)}.
+to the form @expr{s(n,m) = s(n-1,m-1) - (n-1) s(n-1,m)}.
 
 (Because this definition is long, it will be repeated in concise form
 below.  You can use @kbd{M-# m} to load it from there.)
@@ -9783,7 +9907,7 @@
 Calc Trail buffer uses a variant of Calc Mode, so Calculator commands
 still work when the trail buffer's window is selected.  It is possible
 to turn the trail window off, but the @samp{*Calc Trail*} buffer itself
-still exists and is updated silently.  @xref{Trail Commands}.@refill
+still exists and is updated silently.  @xref{Trail Commands}.
 
 @kindex M-# c
 @kindex M-# M-#
@@ -9805,7 +9929,7 @@
 key (@code{calc-execute-extended-command})
 is like @kbd{M-x} except that it enters the initial string @samp{calc-}
 for you.  For example, the following key sequences are equivalent:
-@kbd{S}, @kbd{M-x calc-sin @key{RET}}, @kbd{x sin @key{RET}}.@refill
+@kbd{S}, @kbd{M-x calc-sin @key{RET}}, @kbd{x sin @key{RET}}.
 
 @cindex Extensions module
 @cindex @file{calc-ext} module
@@ -9818,14 +9942,14 @@
 little arithmetic.  If for some reason the Calculator fails to load an
 extension module automatically, you can force it to load all the
 extensions by using the @kbd{M-# L} (@code{calc-load-everything})
-command.  @xref{Mode Settings}.@refill
+command.  @xref{Mode Settings}.
 
 If you type @kbd{M-x calc} or @kbd{M-# c} with any numeric prefix argument,
 the Calculator is loaded if necessary, but it is not actually started.
 If the argument is positive, the @file{calc-ext} extensions are also
 loaded if necessary.  User-written Lisp code that wishes to make use
 of Calc's arithmetic routines can use @samp{(calc 0)} or @samp{(calc 1)}
-to auto-load the Calculator.@refill
+to auto-load the Calculator.
 
 @kindex M-# b
 @pindex full-calc
@@ -9872,7 +9996,7 @@
 contents of the stack intact.  Typing @kbd{M-# c} or @kbd{M-# M-#}
 again from inside the Calculator buffer is equivalent to executing
 @code{calc-quit}; you can think of @kbd{M-# M-#} as toggling the
-Calculator on and off.@refill
+Calculator on and off.
 
 @kindex M-# x
 The @kbd{M-# x} command also turns the Calculator off, no matter which
@@ -9904,7 +10028,7 @@
 @code{calc-scroll-right}.  These are just like the normal horizontal
 scrolling commands except that they scroll one half-screen at a time by
 default.  (Calc formats its output to fit within the bounds of the
-window whenever it can.)@refill
+window whenever it can.)
 
 @kindex @{
 @kindex @}
@@ -9913,7 +10037,7 @@
 @cindex Vertical scrolling
 The @kbd{@{} and @kbd{@}} keys are bound to @code{calc-scroll-down}
 and @code{calc-scroll-up}.  They scroll up or down by one-half the
-height of the Calc window.@refill
+height of the Calc window.
 
 @kindex M-# 0
 @pindex calc-reset
@@ -10017,7 +10141,7 @@
 
 @noindent
 which means the command @kbd{H a S} or @kbd{H M-x calc-solve-for}
-takes a value @cite{a} from the stack, prompts for a value @cite{v},
+takes a value @expr{a} from the stack, prompts for a value @expr{v},
 then applies the algebraic function @code{fsolve} to these values.
 The @samp{?=notes} message means you can now type @kbd{?} to see
 additional notes from the summary that apply to this command.
@@ -10074,7 +10198,7 @@
 @kbd{+} key always ``pops'' the top two numbers from the stack, adds them,
 and pushes the result (3) back onto the stack.  This number is ready for
 further calculations:  @kbd{5 -} pushes 5 onto the stack, then pops the
-3 and 5, subtracts them, and pushes the result (@i{-2}).@refill
+3 and 5, subtracts them, and pushes the result (@i{-2}).
 
 Note that the ``top'' of the stack actually appears at the @emph{bottom}
 of the buffer.  A line containing a single @samp{.} character signifies
@@ -10103,12 +10227,12 @@
 (After all, if you typed @kbd{1 2} by themselves the Calculator
 would enter the number 12.)  If you press @key{RET} or @key{SPC} @emph{not}
 right after typing a number, the key duplicates the number on the top of
-the stack.  @kbd{@key{RET} *} is thus a handy way to square a number.@refill
+the stack.  @kbd{@key{RET} *} is thus a handy way to square a number.
 
 The @key{DEL} key pops and throws away the top number on the stack.
 The @key{TAB} key swaps the top two objects on the stack.
 @xref{Stack and Trail}, for descriptions of these and other stack-related
-commands.@refill
+commands.
 
 @node Numeric Entry, Algebraic Entry, Stack Basics, Introduction
 @section Numeric Entry
@@ -10129,8 +10253,8 @@
 @cindex Negative numbers, entering
 @kindex _
 There are three different concepts corresponding to the word ``minus,''
-typified by @cite{a-b} (subtraction), @cite{-x}
-(change-sign), and @cite{-5} (negative number).  Calc uses three
+typified by @expr{a-b} (subtraction), @expr{-x}
+(change-sign), and @expr{-5} (negative number).  Calc uses three
 different keys for these operations, respectively:
 @kbd{-}, @kbd{n}, and @kbd{_} (the underscore).  The @kbd{-} key subtracts
 the two numbers on the top of the stack.  The @kbd{n} key changes the sign
@@ -10138,7 +10262,7 @@
 The @kbd{_} key begins entry of a negative number or changes the sign of
 the number currently being entered.  The following sequences all enter the
 number @i{-5} onto the stack:  @kbd{0 @key{RET} 5 -}, @kbd{5 n @key{RET}},
-@kbd{5 @key{RET} n}, @kbd{_ 5 @key{RET}}, @kbd{5 _ @key{RET}}.@refill
+@kbd{5 @key{RET} n}, @kbd{_ 5 @key{RET}}, @kbd{5 _ @key{RET}}.
 
 Some other keys are active during numeric entry, such as @kbd{#} for
 non-decimal numbers, @kbd{:} for fractions, and @kbd{@@} for HMS forms.
@@ -10158,11 +10282,12 @@
 Calculations can also be entered in algebraic form.  This is accomplished
 by typing the apostrophe key, @kbd{'}, followed by the expression in
 standard format:  @kbd{@key{'} 2+3*4 @key{RET}} computes
-@c{$2+(3\times4) = 14$}
-@cite{2+(3*4) = 14} and pushes that on the stack.  If you wish you can
+@texline @tmath{2+(3\times4) = 14}
+@infoline @expr{2+(3*4) = 14} 
+and pushes that on the stack.  If you wish you can
 ignore the RPN aspect of Calc altogether and simply enter algebraic
 expressions in this way.  You may want to use @key{DEL} every so often to
-clear previous results off the stack.@refill
+clear previous results off the stack.
 
 You can press the apostrophe key during normal numeric entry to switch
 the half-entered number into algebraic entry mode.  One reason to do this
@@ -10185,7 +10310,7 @@
 begin algebraic entry.  You can still do RPN calculations in this mode,
 but you will have to press @key{RET} to terminate every number:
 @kbd{2 @key{RET} 3 @key{RET} * 4 @key{RET} +} would accomplish the same
-thing as @kbd{2*3+4 @key{RET}}.@refill
+thing as @kbd{2*3+4 @key{RET}}.
 
 @cindex Incomplete algebraic mode
 If you give a numeric prefix argument like @kbd{C-u} to the @kbd{m a}
@@ -10221,7 +10346,7 @@
 stack.  Thus, @kbd{' 1+2 @key{RET}} pushes 3 on the stack, and @kbd{$*2
 @key{RET}} replaces it with 6.  Note that the @kbd{$} key always
 initiates algebraic entry; the @kbd{'} is unnecessary if @kbd{$} is the
-first character in the new formula.@refill
+first character in the new formula.
 
 Higher stack elements can be accessed from an entered formula with the
 symbols @kbd{$$}, @kbd{$$$}, and so on.  The number of stack elements
@@ -10229,7 +10354,7 @@
 signs in the longest such symbol in the formula.  For example, @samp{$$+$$$}
 adds the second and third stack elements, replacing the top three elements
 with the answer.  (All information about the top stack element is thus lost
-since no single @samp{$} appears in this formula.)@refill
+since no single @samp{$} appears in this formula.)
 
 A slightly different way to refer to stack elements is with a dollar
 sign followed by a number:  @samp{$1}, @samp{$2}, and so on are much
@@ -10254,7 +10379,7 @@
 instead of @key{RET}, Calc disables the default simplifications
 (as if by @kbd{m O}; @pxref{Simplification Modes}) while the entry
 is being pushed on the stack.  Thus @kbd{' 1+2 @key{RET}} pushes 3
-on the stack, but @kbd{' 1+2 @key{LFD}} pushes the formula @cite{1+2};
+on the stack, but @kbd{' 1+2 @key{LFD}} pushes the formula @expr{1+2};
 you might then press @kbd{=} when it is time to evaluate this formula.
 
 @node Quick Calculator, Prefix Arguments, Algebraic Entry, Introduction
@@ -10333,7 +10458,7 @@
 @kbd{d s} (@code{calc-sci-notation}), set a parameter to the value of
 the prefix argument or use a default if you don't use a prefix.
 Others (like @kbd{d f} (@code{calc-fix-notation})) require an argument
-and prompt for a number if you don't give one as a prefix.@refill
+and prompt for a number if you don't give one as a prefix.
 
 As a rule, stack-manipulation commands accept a numeric prefix argument
 which is interpreted as an index into the stack.  A positive argument
@@ -10360,7 +10485,7 @@
 Numeric prefixes are specified the same way as always in Emacs:  Press
 a sequence of @key{META}-digits, or press @key{ESC} followed by digits,
 or press @kbd{C-u} followed by digits.  Some commands treat plain
-@kbd{C-u} (without any actual digits) specially.@refill
+@kbd{C-u} (without any actual digits) specially.
 
 @kindex ~
 @pindex calc-num-prefix
@@ -10368,7 +10493,7 @@
 top of the stack and enter it as the numeric prefix for the next command.
 For example, @kbd{C-u 16 p} sets the precision to 16 digits; an alternate
 (silly) way to do this would be @kbd{2 @key{RET} 4 ^ ~ p}, i.e., compute 2
-to the fourth power and set the precision to that value.@refill
+to the fourth power and set the precision to that value.
 
 Conversely, if you have typed a numeric prefix argument the @kbd{~} key
 pushes it onto the stack in the form of an integer.
@@ -10416,7 +10541,7 @@
 The @kbd{M-@key{RET}} key (@code{calc-last-args}) is like undo in that
 it restores the arguments of the most recent command onto the stack;
 however, it does not remove the result of that command.  Given a numeric
-prefix argument, this command applies to the @cite{n}th most recent
+prefix argument, this command applies to the @expr{n}th most recent
 command which removed items from the stack; it pushes those items back
 onto the stack.
 
@@ -10438,7 +10563,7 @@
 @cindex Why did an error occur?
 Many situations that would produce an error message in other calculators
 simply create unsimplified formulas in the Emacs Calculator.  For example,
-@kbd{1 @key{RET} 0 /} pushes the formula @cite{1 / 0}; @w{@kbd{0 L}} pushes
+@kbd{1 @key{RET} 0 /} pushes the formula @expr{1 / 0}; @w{@kbd{0 L}} pushes
 the formula @samp{ln(0)}.  Floating-point overflow and underflow are also
 reasons for this to happen.
 
@@ -10543,7 +10668,7 @@
 ever halts incorrectly with the message ``Computation got stuck or
 ran too long,'' use the @kbd{M} command (@code{calc-more-recursion-depth})
 to increase this limit.  (Of course, this will not help if the
-calculation really did get stuck due to some problem inside Calc.)@refill
+calculation really did get stuck due to some problem inside Calc.)
 
 The limit is always increased (multiplied) by a factor of two.  There
 is also an @kbd{I M} (@code{calc-less-recursion-depth}) command which
@@ -10561,16 +10686,15 @@
 @cindex Flushing caches
 Calc saves certain values after they have been computed once.  For
 example, the @kbd{P} (@code{calc-pi}) command initially ``knows'' the
-constant @c{$\pi$}
-@cite{pi} to about 20 decimal places; if the current precision
-is greater than this, it will recompute @c{$\pi$}
-@cite{pi} using a series
+constant @cpi{} to about 20 decimal places; if the current precision
+is greater than this, it will recompute @cpi{} using a series
 approximation.  This value will not need to be recomputed ever again
 unless you raise the precision still further.  Many operations such as
 logarithms and sines make use of similarly cached values such as
-@c{$\pi \over 4$}
-@cite{pi/4} and @c{$\ln 2$}
-@cite{ln(2)}.  The visible effect of caching is that
+@cpiover{4} and 
+@texline @tmath{\ln 2}.
+@infoline @expr{ln(2)}.  
+The visible effect of caching is that
 high-precision computations may seem to do extra work the first time.
 Other things cached include powers of two (for the binary arithmetic
 functions), matrix inverses and determinants, symbolic integrals, and
@@ -10643,7 +10767,7 @@
 This chapter discusses the various types of objects that can be placed
 on the Calculator stack, how they are displayed, and how they are
 entered.  (@xref{Data Type Formats}, for information on how these data
-types are represented as underlying Lisp objects.)@refill
+types are represented as underlying Lisp objects.)
 
 Integers, fractions, and floats are various ways of describing real
 numbers.  HMS forms also for many purposes act as real numbers.  These
@@ -10686,7 +10810,7 @@
 A decimal integer is represented as an optional sign followed by a
 sequence of digits.  Grouping (@pxref{Grouping Digits}) can be used to
 insert a comma at every third digit for display purposes, but you
-must not type commas during the entry of numbers.@refill
+must not type commas during the entry of numbers.
 
 @kindex #
 A non-decimal integer is represented as an optional sign, a radix
@@ -10695,7 +10819,7 @@
 digits and do not terminate numeric entry mode.  @xref{Radix Modes}, for how
 to set the default radix for display of integers.  Numbers of any radix
 may be entered at any time.  If you press @kbd{#} at the beginning of a
-number, the current display radix is used.@refill
+number, the current display radix is used.
 
 @node Fractions, Floats, Integers, Data Types
 @section Fractions
@@ -10708,15 +10832,15 @@
 @samp{2:3} on the stack:  @kbd{2 :@: 3 @key{RET}}, or @kbd{2 @key{RET} 3 /}
 assuming Fraction Mode has been enabled.)
 When the Calculator produces a fractional result it always reduces it to
-simplest form, which may in fact be an integer.@refill
+simplest form, which may in fact be an integer.
 
 Fractions may also be entered in a three-part form, where @samp{2:3:4}
 represents two-and-three-quarters.  @xref{Fraction Formats}, for fraction
-display formats.@refill
+display formats.
 
 Non-decimal fractions are entered and displayed as
 @samp{@var{radix}#@var{num}:@var{denom}} (or in the analogous three-part
-form).  The numerator and denominator always use the same radix.@refill
+form).  The numerator and denominator always use the same radix.
 
 @node Floats, Complex Numbers, Fractions, Data Types
 @section Floats
@@ -10726,12 +10850,13 @@
 A floating-point number or @dfn{float} is a number stored in scientific
 notation.  The number of significant digits in the fractional part is
 governed by the current floating precision (@pxref{Precision}).  The
-range of acceptable values is from @c{$10^{-3999999}$}
-@cite{10^-3999999} (inclusive)
-to @c{$10^{4000000}$}
-@cite{10^4000000}
-(exclusive), plus the corresponding negative
-values and zero.
+range of acceptable values is from 
+@texline @tmath{10^{-3999999}}
+@infoline @expr{10^-3999999} 
+(inclusive) to 
+@texline @tmath{10^{4000000}}
+@infoline @expr{10^4000000}
+(exclusive), plus the corresponding negative values and zero.
 
 Calculations that would exceed the allowable range of values (such
 as @samp{exp(exp(20))}) are left in symbolic form by Calc.  The
@@ -10772,7 +10897,7 @@
 accuracy is not rigorously guaranteed.  If you suspect the validity of a
 result, try doing the same calculation in a higher precision.  The
 Calculator's arithmetic is not intended to be IEEE-conformant in any
-way.@refill
+way.
 
 While floats are always @emph{stored} in decimal, they can be entered
 and displayed in any radix just like integers and fractions.  The
@@ -10798,16 +10923,20 @@
 @samp{(@var{real},@var{imag})} where @var{real} is the real part and
 @var{imag} is the imaginary part, each of which may be any real number.
 Rectangular complex numbers can also be displayed in @samp{@var{a}+@var{b}i}
-notation; @pxref{Complex Formats}.@refill
-
-Polar complex numbers are displayed in the form `@t{(}@var{r}@t{;}@c{$\theta$}
-@var{theta}@t{)}'
-where @var{r} is the nonnegative magnitude and @c{$\theta$}
-@var{theta} is the argument
-or phase angle.  The range of @c{$\theta$}
-@var{theta} depends on the current angular
-mode (@pxref{Angular Modes}); it is generally between @i{-180} and
-@i{+180} degrees or the equivalent range in radians.@refill
+notation; @pxref{Complex Formats}.
+
+Polar complex numbers are displayed in the form 
+@texline `@t{(}@var{r}@t{;}@tmath{\theta}@t{)}'
+@infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}'
+where @var{r} is the nonnegative magnitude and 
+@texline @tmath{\theta}
+@infoline @var{theta} 
+is the argument or phase angle.  The range of 
+@texline @tmath{\theta}
+@infoline @var{theta} 
+depends on the current angular mode (@pxref{Angular Modes}); it is
+generally between @i{-180} and @i{+180} degrees or the equivalent range
+in radians. 
 
 Complex numbers are entered in stages using incomplete objects.
 @xref{Incomplete Objects}.
@@ -10819,8 +10948,7 @@
 type.  @xref{Polar Mode}.
 
 A complex result in which the imaginary part is zero (or the phase angle
-is 0 or 180 degrees or @c{$\pi$}
-@cite{pi} radians) is automatically converted to a real
+is 0 or 180 degrees or @cpi{} radians) is automatically converted to a real
 number.
 
 @node Infinities, Vectors and Matrices, Complex Numbers, Data Types
@@ -10845,24 +10973,25 @@
 Mathematically speaking, it is not rigorously correct to treat
 ``infinity'' as if it were a number, but mathematicians often do
 so informally.  When they say that @samp{1 / inf = 0}, what they
-really mean is that @cite{1 / x}, as @cite{x} becomes larger and
+really mean is that @expr{1 / x}, as @expr{x} becomes larger and
 larger, becomes arbitrarily close to zero.  So you can imagine
-that if @cite{x} got ``all the way to infinity,'' then @cite{1 / x}
+that if @expr{x} got ``all the way to infinity,'' then @expr{1 / x}
 would go all the way to zero.  Similarly, when they say that
-@samp{exp(inf) = inf}, they mean that @c{$e^x$}
-@cite{exp(x)} grows without
-bound as @cite{x} grows.  The symbol @samp{-inf} likewise stands
-for an infinitely negative real value; for example, we say that
+@samp{exp(inf) = inf}, they mean that 
+@texline @tmath{e^x}
+@infoline @expr{exp(x)} 
+grows without bound as @expr{x} grows.  The symbol @samp{-inf} likewise
+stands for an infinitely negative real value; for example, we say that
 @samp{exp(-inf) = 0}.  You can have an infinity pointing in any
 direction on the complex plane:  @samp{sqrt(-inf) = i inf}.
 
-The same concept of limits can be used to define @cite{1 / 0}.  We
-really want the value that @cite{1 / x} approaches as @cite{x}
-approaches zero.  But if all we have is @cite{1 / 0}, we can't
-tell which direction @cite{x} was coming from.  If @cite{x} was
+The same concept of limits can be used to define @expr{1 / 0}.  We
+really want the value that @expr{1 / x} approaches as @expr{x}
+approaches zero.  But if all we have is @expr{1 / 0}, we can't
+tell which direction @expr{x} was coming from.  If @expr{x} was
 positive and decreasing toward zero, then we should say that
-@samp{1 / 0 = inf}.  But if @cite{x} was negative and increasing
-toward zero, the answer is @samp{1 / 0 = -inf}.  In fact, @cite{x}
+@samp{1 / 0 = inf}.  But if @expr{x} was negative and increasing
+toward zero, the answer is @samp{1 / 0 = -inf}.  In fact, @expr{x}
 could be an imaginary number, giving the answer @samp{i inf} or
 @samp{-i inf}.  Calc uses the special symbol @samp{uinf} to mean
 @dfn{undirected infinity}, i.e., a value which is infinitely
@@ -10870,10 +10999,10 @@
 
 Calc actually has three modes that say how infinities are handled.
 Normally, infinities never arise from calculations that didn't
-already have them.  Thus, @cite{1 / 0} is treated simply as an
+already have them.  Thus, @expr{1 / 0} is treated simply as an
 error and left unevaluated.  The @kbd{m i} (@code{calc-infinite-mode})
 command (@pxref{Infinite Mode}) enables a mode in which
-@cite{1 / 0} evaluates to @code{uinf} instead.  There is also
+@expr{1 / 0} evaluates to @code{uinf} instead.  There is also
 an alternative type of infinite mode which says to treat zeros
 as if they were positive, so that @samp{1 / 0 = inf}.  While this
 is less mathematically correct, it may be the answer you want in
@@ -10892,9 +11021,9 @@
 It's not so easy to define certain formulas like @samp{0 * inf} and
 @samp{inf / inf}.  Depending on where these zeros and infinities
 came from, the answer could be literally anything.  The latter
-formula could be the limit of @cite{x / x} (giving a result of one),
-or @cite{2 x / x} (giving two), or @cite{x^2 / x} (giving @code{inf}),
-or @cite{x / x^2} (giving zero).  Calc uses the symbol @code{nan}
+formula could be the limit of @expr{x / x} (giving a result of one),
+or @expr{2 x / x} (giving two), or @expr{x^2 / x} (giving @code{inf}),
+or @expr{x / x^2} (giving zero).  Calc uses the symbol @code{nan}
 to represent such an @dfn{indeterminate} value.  (The name ``nan''
 comes from analogy with the ``NAN'' concept of IEEE standard
 arithmetic; it stands for ``Not A Number.''  This is somewhat of a
@@ -10938,15 +11067,16 @@
 @pxref{Basic Arithmetic} and @pxref{Matrix Functions}.
 Many other operations are applied to vectors element-wise.  For example,
 the complex conjugate of a vector is a vector of the complex conjugates
-of its elements.@refill
+of its elements.
 
 @ignore
 @starindex
 @end ignore
 @tindex vec
 Algebraic functions for building vectors include @samp{vec(a, b, c)}
-to build @samp{[a, b, c]}, @samp{cvec(a, n, m)} to build an @c{$n\times m$}
-@asis{@var{n}x@var{m}}
+to build @samp{[a, b, c]}, @samp{cvec(a, n, m)} to build an 
+@texline @tmath{n\times m}
+@infoline @var{n}x@var{m}
 matrix of @samp{a}s, and @samp{index(n)} to build a vector of integers
 from 1 to @samp{n}.
 
@@ -11077,7 +11207,7 @@
 (exclusive).  A positive HMS form is interpreted as @var{hours} +
 @var{mins}/60 + @var{secs}/3600.  A negative HMS form is interpreted
 as @i{- @var{hours}} @i{-} @var{mins}/60 @i{-} @var{secs}/3600.
-Display format for HMS forms is quite flexible.  @xref{HMS Formats}.@refill
+Display format for HMS forms is quite flexible.  @xref{HMS Formats}.
 
 HMS forms can be added and subtracted.  When they are added to numbers,
 the numbers are interpreted according to the current angular mode.  HMS
@@ -11216,10 +11346,10 @@
 often arises in number theory.  Modulo forms are written
 `@var{a} @t{mod} @var{M}',
 where @var{a} and @var{M} are real numbers or HMS forms, and
-@c{$0 \le a < M$}
-@cite{0 <= a < @var{M}}.
-In many applications @cite{a} and @cite{M} will be
-integers but this is not required.@refill
+@texline @tmath{0 \le a < M}.
+@infoline @expr{0 <= a < @var{M}}.
+In many applications @expr{a} and @expr{M} will be
+integers but this is not required.
 
 Modulo forms are not to be confused with the modulo operator @samp{%}.
 The expression @samp{27 % 10} means to compute 27 modulo 10 to produce
@@ -11228,28 +11358,30 @@
 further computations with this value are again reduced modulo 10 so that
 the result always lies in the desired range.
 
-When two modulo forms with identical @cite{M}'s are added or multiplied,
+When two modulo forms with identical @expr{M}'s are added or multiplied,
 the Calculator simply adds or multiplies the values, then reduces modulo
-@cite{M}.  If one argument is a modulo form and the other a plain number,
+@expr{M}.  If one argument is a modulo form and the other a plain number,
 the plain number is treated like a compatible modulo form.  It is also
 possible to raise modulo forms to powers; the result is the value raised
-to the power, then reduced modulo @cite{M}.  (When all values involved
+to the power, then reduced modulo @expr{M}.  (When all values involved
 are integers, this calculation is done much more efficiently than
 actually computing the power and then reducing.)
 
 @cindex Modulo division
 Two modulo forms `@var{a} @t{mod} @var{M}' and `@var{b} @t{mod} @var{M}'
-can be divided if @cite{a}, @cite{b}, and @cite{M} are all
+can be divided if @expr{a}, @expr{b}, and @expr{M} are all
 integers.  The result is the modulo form which, when multiplied by
 `@var{b} @t{mod} @var{M}', produces `@var{a} @t{mod} @var{M}'.  If
 there is no solution to this equation (which can happen only when
-@cite{M} is non-prime), or if any of the arguments are non-integers, the
+@expr{M} is non-prime), or if any of the arguments are non-integers, the
 division is left in symbolic form.  Other operations, such as square
 roots, are not yet supported for modulo forms.  (Note that, although
 @w{`@t{(}@var{a} @t{mod} @var{M}@t{)^.5}'} will compute a ``modulo square root''
-in the sense of reducing @c{$\sqrt a$}
-@cite{sqrt(a)} modulo @cite{M}, this is not a
-useful definition from the number-theoretical point of view.)@refill
+in the sense of reducing 
+@texline @tmath{\sqrt a}
+@infoline @expr{sqrt(a)} 
+modulo @expr{M}, this is not a useful definition from the
+number-theoretical point of view.)
 
 @ignore
 @mindex M
@@ -11261,17 +11393,17 @@
 @tindex mod (operator)
 To create a modulo form during numeric entry, press the shift-@kbd{M}
 key to enter the word @samp{mod}.  As a special convenience, pressing
-shift-@kbd{M} a second time automatically enters the value of @cite{M}
+shift-@kbd{M} a second time automatically enters the value of @expr{M}
 that was most recently used before.  During algebraic entry, either
 type @samp{mod} by hand or press @kbd{M-m} (that's @kbd{@key{META}-m}).
-Once again, pressing this a second time enters the current modulo.@refill
+Once again, pressing this a second time enters the current modulo.
 
 You can also use @kbd{v p} and @kbd{%} to modify modulo forms.
 @xref{Building Vectors}.  @xref{Basic Arithmetic}.
 
 It is possible to mix HMS forms and modulo forms.  For example, an
 HMS form modulo 24 could be used to manipulate clock times; an HMS
-form modulo 360 would be suitable for angles.  Making the modulo @cite{M}
+form modulo 360 would be suitable for angles.  Making the modulo @expr{M}
 also be an HMS form eliminates troubles that would arise if the angular
 mode were inadvertently set to Radians, in which case
 @w{@samp{2@@ 0' 0" mod 24}} would be interpreted as two degrees modulo
@@ -11296,24 +11428,28 @@
 @cindex Standard deviations
 An @dfn{error form} is a number with an associated standard
 deviation, as in @samp{2.3 +/- 0.12}.  The notation
-`@var{x} @t{+/-} @c{$\sigma$}
-@asis{sigma}' stands for an uncertain value which follows a normal or
-Gaussian distribution of mean @cite{x} and standard deviation or
-``error'' @c{$\sigma$}
-@cite{sigma}.  Both the mean and the error can be either numbers or
+@texline `@var{x} @t{+/-} @tmath{\sigma}' 
+@infoline `@var{x} @t{+/-} sigma' 
+stands for an uncertain value which follows
+a normal or Gaussian distribution of mean @expr{x} and standard
+deviation or ``error'' 
+@texline @tmath{\sigma}.
+@infoline @expr{sigma}.
+Both the mean and the error can be either numbers or
 formulas.  Generally these are real numbers but the mean may also be
 complex.  If the error is negative or complex, it is changed to its
 absolute value.  An error form with zero error is converted to a
-regular number by the Calculator.@refill
+regular number by the Calculator.
 
 All arithmetic and transcendental functions accept error forms as input.
 Operations on the mean-value part work just like operations on regular
-numbers.  The error part for any function @cite{f(x)} (such as @c{$\sin x$}
-@cite{sin(x)})
-is defined by the error of @cite{x} times the derivative of @cite{f}
-evaluated at the mean value of @cite{x}.  For a two-argument function
-@cite{f(x,y)} (such as addition) the error is the square root of the sum
-of the squares of the errors due to @cite{x} and @cite{y}.
+numbers.  The error part for any function @expr{f(x)} (such as 
+@texline @tmath{\sin x}
+@infoline @expr{sin(x)})
+is defined by the error of @expr{x} times the derivative of @expr{f}
+evaluated at the mean value of @expr{x}.  For a two-argument function
+@expr{f(x,y)} (such as addition) the error is the square root of the sum
+of the squares of the errors due to @expr{x} and @expr{y}.
 @tex
 $$ \eqalign{
   f(x \hbox{\code{ +/- }} \sigma)
@@ -11327,38 +11463,48 @@
 } $$
 @end tex
 Note that this
-definition assumes the errors in @cite{x} and @cite{y} are uncorrelated.
+definition assumes the errors in @expr{x} and @expr{y} are uncorrelated.
 A side effect of this definition is that @samp{(2 +/- 1) * (2 +/- 1)}
 is not the same as @samp{(2 +/- 1)^2}; the former represents the product
 of two independent values which happen to have the same probability
 distributions, and the latter is the product of one random value with itself.
 The former will produce an answer with less error, since on the average
-the two independent errors can be expected to cancel out.@refill
+the two independent errors can be expected to cancel out.
 
 Consult a good text on error analysis for a discussion of the proper use
 of standard deviations.  Actual errors often are neither Gaussian-distributed
 nor uncorrelated, and the above formulas are valid only when errors
 are small.  As an example, the error arising from
-`@t{sin(}@var{x} @t{+/-} @c{$\sigma$}
-@var{sigma}@t{)}' is
-`@c{$\sigma$\nobreak}
-@var{sigma} @t{abs(cos(}@var{x}@t{))}'.  When @cite{x} is close to zero,
-@c{$\cos x$}
-@cite{cos(x)} is
-close to one so the error in the sine is close to @c{$\sigma$}
-@cite{sigma}; this makes sense, since @c{$\sin x$}
-@cite{sin(x)} is approximately @cite{x} near zero, so a given
-error in @cite{x} will produce about the same error in the sine.  Likewise,
-near 90 degrees @c{$\cos x$}
-@cite{cos(x)} is nearly zero and so the computed error is
-small:  The sine curve is nearly flat in that region, so an error in @cite{x}
-has relatively little effect on the value of @c{$\sin x$}
-@cite{sin(x)}.  However, consider
-@samp{sin(90 +/- 1000)}.  The cosine of 90 is zero, so Calc will report
-zero error!  We get an obviously wrong result because we have violated
-the small-error approximation underlying the error analysis.  If the error
-in @cite{x} had been small, the error in @c{$\sin x$}
-@cite{sin(x)} would indeed have been negligible.@refill
+@texline `@t{sin(}@var{x} @t{+/-} @tmath{\sigma}@t{)}' 
+@infoline `@t{sin(}@var{x} @t{+/-} @var{sigma}@t{)}' 
+is 
+@texline `@tmath{\sigma} @t{abs(cos(}@var{x}@t{))}'.  
+@infoline `@var{sigma} @t{abs(cos(}@var{x}@t{))}'.  
+When @expr{x} is close to zero,
+@texline @tmath{\cos x}
+@infoline @expr{cos(x)} 
+is close to one so the error in the sine is close to 
+@texline @tmath{\sigma};
+@infoline @expr{sigma};
+this makes sense, since 
+@texline @tmath{\sin x}
+@infoline @expr{sin(x)} 
+is approximately @expr{x} near zero, so a given error in @expr{x} will
+produce about the same error in the sine.  Likewise, near 90 degrees
+@texline @tmath{\cos x}
+@infoline @expr{cos(x)} 
+is nearly zero and so the computed error is
+small:  The sine curve is nearly flat in that region, so an error in @expr{x}
+has relatively little effect on the value of 
+@texline @tmath{\sin x}.
+@infoline @expr{sin(x)}.  
+However, consider @samp{sin(90 +/- 1000)}.  The cosine of 90 is zero, so
+Calc will report zero error!  We get an obviously wrong result because
+we have violated the small-error approximation underlying the error
+analysis.  If the error in @expr{x} had been small, the error in
+@texline @tmath{\sin x}
+@infoline @expr{sin(x)} 
+would indeed have been negligible.
 
 @ignore
 @mindex p
@@ -11411,10 +11557,10 @@
 @emph{exclusive}, and @dfn{semi-open} intervals in which one end
 uses a round parenthesis and the other a square bracket.  In mathematical
 terms,
-@samp{[2 ..@: 4]} means @cite{2 <= x <= 4}, whereas
-@samp{[2 ..@: 4)} represents @cite{2 <= x < 4},
-@samp{(2 ..@: 4]} represents @cite{2 < x <= 4}, and
-@samp{(2 ..@: 4)} represents @cite{2 < x < 4}.@refill
+@samp{[2 ..@: 4]} means @expr{2 <= x <= 4}, whereas
+@samp{[2 ..@: 4)} represents @expr{2 <= x < 4},
+@samp{(2 ..@: 4]} represents @expr{2 < x <= 4}, and
+@samp{(2 ..@: 4)} represents @expr{2 < x < 4}.
 @end ifinfo
 @tex
 Calc supports several varieties of intervals, including \dfn{closed}
@@ -11464,14 +11610,19 @@
 
 While it may seem that intervals and error forms are similar, they are
 based on entirely different concepts of inexact quantities.  An error
-form `@var{x} @t{+/-} @c{$\sigma$}
-@var{sigma}' means a variable is random, and its value could
-be anything but is ``probably'' within one @c{$\sigma$}
-@var{sigma} of the mean value @cite{x}.
-An interval `@t{[}@var{a} @t{..@:} @var{b}@t{]}' means a variable's value
-is unknown, but guaranteed to lie in the specified range.  Error forms
-are statistical or ``average case'' approximations; interval arithmetic
-tends to produce ``worst case'' bounds on an answer.@refill
+form 
+@texline `@var{x} @t{+/-} @tmath{\sigma}' 
+@infoline `@var{x} @t{+/-} @var{sigma}' 
+means a variable is random, and its value could
+be anything but is ``probably'' within one 
+@texline @tmath{\sigma} 
+@infoline @var{sigma} 
+of the mean value @expr{x}. An interval 
+`@t{[}@var{a} @t{..@:} @var{b}@t{]}' means a
+variable's value is unknown, but guaranteed to lie in the specified
+range.  Error forms are statistical or ``average case'' approximations;
+interval arithmetic tends to produce ``worst case'' bounds on an
+answer.
 
 Intervals may not contain complex numbers, but they may contain
 HMS forms or date forms.
@@ -11537,7 +11688,7 @@
 If several values lie on the stack in front of the incomplete object,
 all are collected and appended to the object.  Thus the @kbd{,} key
 is redundant:  @kbd{[ 2 @key{RET} 3 @key{RET} 2 * 9 ]}.  Some people
-prefer the equivalent @key{SPC} key to @key{RET}.@refill
+prefer the equivalent @key{SPC} key to @key{RET}.
 
 As a special case, typing @kbd{,} immediately after @kbd{(}, @kbd{[}, or
 @kbd{,} adds a zero or duplicates the preceding value in the list being
@@ -11575,14 +11726,14 @@
 The Calc variable @code{foo} corresponds to the Emacs Lisp variable
 @code{var-foo}.  Commands like @kbd{s s} (@code{calc-store}) that operate
 on variables can be made to use any arbitrary Lisp variable simply by
-backspacing over the @samp{var-} prefix in the minibuffer.@refill
+backspacing over the @samp{var-} prefix in the minibuffer.
 
 In a command that takes a variable name, you can either type the full
 name of a variable, or type a single digit to use one of the special
 convenience variables @code{var-q0} through @code{var-q9}.  For example,
 @kbd{3 s s 2} stores the number 3 in variable @code{var-q2}, and
 @w{@kbd{3 s s foo @key{RET}}} stores that number in variable
-@code{var-foo}.@refill
+@code{var-foo}.
 
 To push a variable itself (as opposed to the variable's value) on the
 stack, enter its name as an algebraic expression using the apostrophe
@@ -11623,7 +11774,7 @@
 (@xref{Scientific Functions}.)  When they are evaluated with @kbd{=},
 their values are calculated if necessary according to the current precision
 or complex polar mode.  If you wish to use these symbols for other purposes,
-simply undefine or redefine them using @code{calc-store}.@refill
+simply undefine or redefine them using @code{calc-store}.
 
 The variables @samp{inf}, @samp{uinf}, and @samp{nan} stand for
 infinite or indeterminate values.  It's best not to use them as
@@ -11697,8 +11848,9 @@
 @samp{=>} [@code{evalto}].
 
 Note that, unlike in usual computer notation, multiplication binds more
-strongly than division:  @samp{a*b/c*d} is equivalent to @c{$a b \over c d$}
-@cite{(a*b)/(c*d)}.
+strongly than division:  @samp{a*b/c*d} is equivalent to 
+@texline @tmath{a b \over c d}.
+@infoline @expr{(a*b)/(c*d)}.
 
 @cindex Multiplication, implicit
 @cindex Implicit multiplication
@@ -11712,7 +11864,7 @@
 cases you must use a space if you omit the @samp{*}:  @samp{2a} is the
 same as @samp{2*a}, and @samp{a b} is the same as @samp{a*b}, but @samp{ab}
 is a variable called @code{ab}, @emph{not} the product of @samp{a} and
-@samp{b}!  Also note that @samp{f (x)} is still a function call.@refill
+@samp{b}!  Also note that @samp{f (x)} is still a function call.
 
 @cindex Implicit comma in vectors
 The rules are slightly different for vectors written with square brackets.
@@ -11724,7 +11876,7 @@
 ignored.  To force spaces to be interpreted as multiplication you can
 enclose a formula in parentheses as in @samp{[(a b) 2(c d)]}, which is
 interpreted as @samp{[a*b, 2*c*d]}.  An implicit comma is also inserted
-between @samp{][}, as in the matrix @samp{[[1 2][3 4]]}.@refill
+between @samp{][}, as in the matrix @samp{[[1 2][3 4]]}.
 
 Vectors that contain commas (not embedded within nested parentheses or
 brackets) do not treat spaces specially:  @samp{[a b, 2 c d]} is a vector
@@ -11753,12 +11905,12 @@
 left alone.  Beware that many innocent-looking short names like @code{in}
 and @code{re} have predefined meanings which could surprise you; however,
 single letters or single letters followed by digits are always safe to
-use for your own function names.  @xref{Function Index}.@refill
+use for your own function names.  @xref{Function Index}.
 
 In the documentation for particular commands, the notation @kbd{H S}
 (@code{calc-sinh}) [@code{sinh}] means that the key sequence @kbd{H S}, the
 command @kbd{M-x calc-sinh}, and the algebraic function @code{sinh(x)} all
-represent the same operation.@refill
+represent the same operation.
 
 Commands that interpret (``parse'') text as algebraic formulas include
 algebraic entry (@kbd{'}), editing commands like @kbd{`} which parse
@@ -11823,7 +11975,7 @@
 @key{RET} creates @samp{10 20 30 30},
 @kbd{C-u 2 @key{RET}} creates @samp{10 20 30 20 30},
 @kbd{C-u - 2 @key{RET}} creates @samp{10 20 30 20}, and
-@kbd{C-u 0 @key{RET}} creates @samp{10 20 30 10 20 30}.@refill
+@kbd{C-u 0 @key{RET}} creates @samp{10 20 30 10 20 30}.
 
 @kindex @key{LFD}
 @pindex calc-over
@@ -11833,7 +11985,7 @@
 oppositely.  Also, with no prefix argument the default argument is 2.
 Thus with @samp{10 20 30} on the stack, @key{LFD} and @kbd{C-u 2 @key{LFD}}
 are both equivalent to @kbd{C-u - 2 @key{RET}}, producing
-@samp{10 20 30 20}.@refill
+@samp{10 20 30 20}.
 
 @kindex @key{DEL}
 @kindex C-d
@@ -11851,7 +12003,7 @@
 @key{DEL} leaves @samp{10 20},
 @kbd{C-u 2 @key{DEL}} leaves @samp{10},
 @kbd{C-u - 2 @key{DEL}} leaves @samp{10 30}, and
-@kbd{C-u 0 @key{DEL}} leaves an empty stack.@refill
+@kbd{C-u 0 @key{DEL}} leaves an empty stack.
 
 @kindex M-@key{DEL}
 @pindex calc-pop-above
@@ -11874,7 +12026,7 @@
 @key{TAB} creates @samp{10 20 30 50 40},
 @kbd{C-u 3 @key{TAB}} creates @samp{10 20 50 30 40},
 @kbd{C-u - 2 @key{TAB}} creates @samp{40 50 10 20 30}, and
-@kbd{C-u 0 @key{TAB}} creates @samp{50 40 30 20 10}.@refill
+@kbd{C-u 0 @key{TAB}} creates @samp{50 40 30 20 10}.
 
 @kindex M-@key{TAB}
 @pindex calc-roll-up
@@ -11885,7 +12037,7 @@
 @kbd{M-@key{TAB}} creates @samp{10 20 40 50 30},
 @kbd{C-u 4 M-@key{TAB}} creates @samp{10 30 40 50 20},
 @kbd{C-u - 2 M-@key{TAB}} creates @samp{30 40 50 10 20}, and
-@kbd{C-u 0 M-@key{TAB}} creates @samp{50 40 30 20 10}.@refill
+@kbd{C-u 0 M-@key{TAB}} creates @samp{50 40 30 20 10}.
 
 A good way to view the operation of @key{TAB} and @kbd{M-@key{TAB}} is in
 terms of moving a particular element to a new position in the stack.
@@ -11988,7 +12140,7 @@
 Calc Trail window.  In practice they are rarely used, since the commands
 shown below are a more convenient way to move around in the
 trail, and they work ``by remote control'' when the cursor is still
-in the Calculator window.@refill
+in the Calculator window.
 
 @cindex Trail pointer
 There is a @dfn{trail pointer} which selects some entry of the trail at
@@ -12011,7 +12163,7 @@
 @pindex calc-trail-scroll-right
 The @kbd{t <} (@code{calc-trail-scroll-left}) and @kbd{t >}
 (@code{calc-trail-scroll-right}) commands horizontally scroll the trail
-window left or right by one half of its width.@refill
+window left or right by one half of its width.
 
 @kindex t n
 @pindex calc-trail-next
@@ -12026,7 +12178,7 @@
 one line.  The @kbd{t f} (@code{calc-trail-forward}) and @kbd{t b}
 (@code{calc-trail-backward}) commands move the trail pointer down or up
 one screenful at a time.  All of these commands accept numeric prefix
-arguments to move several lines or screenfuls at a time.@refill
+arguments to move several lines or screenfuls at a time.
 
 @kindex t [
 @pindex calc-trail-first
@@ -12038,7 +12190,7 @@
 (@code{calc-trail-last}) commands move the trail pointer to the first or
 last line of the trail.  The @kbd{t h} (@code{calc-trail-here}) command
 moves the trail pointer to the cursor position; unlike the other trail
-commands, @kbd{t h} works only when Calc Trail is the selected window.@refill
+commands, @kbd{t h} works only when Calc Trail is the selected window.
 
 @kindex t s
 @pindex calc-trail-isearch-forward
@@ -12050,7 +12202,7 @@
 search forward or backward through the trail.  You can press @key{RET}
 to terminate the search; the trail pointer moves to the current line.
 If you cancel the search with @kbd{C-g}, the trail pointer stays where
-it was when the search began.@refill
+it was when the search began.
 @end ifinfo
 @tex
 The @kbd{t s} (@code{calc-trail-isearch-forward}) and @kbd{t r}
@@ -12248,7 +12400,7 @@
 round values already on the stack, but those values will be rounded
 down before being used in any calculation.  The @kbd{c 0} through
 @kbd{c 9} commands (@pxref{Conversions}) can be used to round an
-existing value to a new precision.@refill
+existing value to a new precision.
 
 @cindex Accuracy of calculations
 It is important to distinguish the concepts of @dfn{precision} and
@@ -12291,7 +12443,7 @@
 Instead, you must first press @kbd{I} (@code{calc-inverse}) to set
 the @dfn{Inverse Flag}, then press @kbd{S} (@code{calc-sin}).
 The @kbd{I} key actually toggles the Inverse Flag.  When this flag
-is set, the word @samp{Inv} appears in the mode line.@refill
+is set, the word @samp{Inv} appears in the mode line.
 
 @kindex H
 @pindex calc-hyperbolic
@@ -12300,7 +12452,7 @@
 If both of these flags are set at once, the effect will be
 @code{calc-arcsinh}.  (The Hyperbolic flag is also used by some
 non-trigonometric commands; for example @kbd{H L} computes a base-10,
-instead of base-@i{e}, logarithm.)@refill
+instead of base-@i{e}, logarithm.)
 
 Command names like @code{calc-arcsin} are provided for completeness, and
 may be executed with @kbd{x} or @kbd{M-x}.  Their effect is simply to
@@ -12356,8 +12508,7 @@
 instead expressed in degrees.  (Complex-number calculations would
 normally be done in radians mode, though.  Complex numbers are converted
 to degrees by calculating the complex result in radians and then
-multiplying by 180 over @c{$\pi$}
-@cite{pi}.)
+multiplying by 180 over @cpi{}.)
 
 @kindex m r
 @pindex calc-radians-mode
@@ -12368,7 +12519,7 @@
 The @kbd{m r} (@code{calc-radians-mode}), @kbd{m d} (@code{calc-degrees-mode}),
 and @kbd{m h} (@code{calc-hms-mode}) commands control the angular mode.
 The current angular mode is displayed on the Emacs mode line.
-The default angular mode is degrees.@refill
+The default angular mode is degrees.
 
 @node Polar Mode, Fraction Mode, Angular Modes, Calculation Modes
 @subsection Polar Mode
@@ -12396,16 +12547,16 @@
 Division of two integers normally yields a floating-point number if the
 result cannot be expressed as an integer.  In some cases you would
 rather get an exact fractional answer.  One way to accomplish this is
-to multiply fractions instead:  @kbd{6 @key{RET} 1:4 *} produces @cite{3:2}
-even though @kbd{6 @key{RET} 4 /} produces @cite{1.5}.
+to multiply fractions instead:  @kbd{6 @key{RET} 1:4 *} produces @expr{3:2}
+even though @kbd{6 @key{RET} 4 /} produces @expr{1.5}.
 
 @kindex m f
 @pindex calc-frac-mode
 To set the Calculator to produce fractional results for normal integer
 divisions, use the @kbd{m f} (@code{calc-frac-mode}) command.
-For example, @cite{8/4} produces @cite{2} in either mode,
-but @cite{6/4} produces @cite{3:2} in Fraction Mode, @cite{1.5} in
-Float Mode.@refill
+For example, @expr{8/4} produces @expr{2} in either mode,
+but @expr{6/4} produces @expr{3:2} in Fraction Mode, @expr{1.5} in
+Float Mode.
 
 At any time you can use @kbd{c f} (@code{calc-float}) to convert a
 fraction to a float, or @kbd{c F} (@code{calc-fraction}) to convert a
@@ -12416,7 +12567,7 @@
 
 @noindent
 @cindex Infinite mode
-The Calculator normally treats results like @cite{1 / 0} as errors;
+The Calculator normally treats results like @expr{1 / 0} as errors;
 formulas like this are left in unsimplified form.  But Calc can be
 put into a mode where such calculations instead produce ``infinite''
 results.
@@ -12432,7 +12583,7 @@
 
 With infinite mode turned on, @samp{1 / 0} will generate @code{uinf},
 an undirected infinity.  @xref{Infinities}, for a discussion of the
-difference between @code{inf} and @code{uinf}.  Also, @cite{0 / 0}
+difference between @code{inf} and @code{uinf}.  Also, @expr{0 / 0}
 evaluates to @code{nan}, the ``indeterminate'' symbol.  Various other
 functions can also return infinities in this mode; for example,
 @samp{ln(0) = -inf}, and @samp{gamma(-7) = uinf}.  Once again,
@@ -12477,7 +12628,7 @@
 @code{calc-symbolic-mode} and executing @kbd{=} (@code{calc-evaluate}).
 Given a numeric prefix argument, it also
 sets the floating-point precision to the specified value for the duration
-of the command.@refill
+of the command.
 
 To evaluate a formula numerically without expanding the variables it
 contains, you can use the key sequence @kbd{m s a v m s} (this uses
@@ -12504,7 +12655,7 @@
 @samp{A*B} is not the same as @samp{B*A}.)  This assumption affects
 rewrite rules and algebraic simplification.  Another effect of this
 mode is that calculations that would normally produce constants like
-0 and 1 (e.g., @cite{a - a} and @cite{a / a}, respectively) will now
+0 and 1 (e.g., @expr{a - a} and @expr{a / a}, respectively) will now
 produce function calls that represent ``generic'' zero or identity
 matrices: @samp{idn(0)}, @samp{idn(1)}.  The @code{idn} function
 @samp{idn(@var{a},@var{n})} returns @var{a} times an @var{n}x@var{n}
@@ -12598,7 +12749,7 @@
 disable all ``working'' messages.  Use a numeric prefix of 1 to enable
 only the plain @samp{Working...} message.  Use a numeric prefix of 2 to
 see intermediate results as well.  With no numeric prefix this displays
-the current mode.@refill
+the current mode.
 
 While it may seem that the ``working'' messages will slow Calc down
 considerably, experiments have shown that their impact is actually
@@ -12613,13 +12764,13 @@
 are ``normalized'' when being taken from or pushed onto the stack.
 Some normalizations are unavoidable, such as rounding floating-point
 results to the current precision, and reducing fractions to simplest
-form.  Others, such as simplifying a formula like @cite{a+a} (or @cite{2+3}),
+form.  Others, such as simplifying a formula like @expr{a+a} (or @expr{2+3}),
 are done by default but can be turned off when necessary.
 
-When you press a key like @kbd{+} when @cite{2} and @cite{3} are on the
+When you press a key like @kbd{+} when @expr{2} and @expr{3} are on the
 stack, Calc pops these numbers, normalizes them, creates the formula
-@cite{2+3}, normalizes it, and pushes the result.  Of course the standard
-rules for normalizing @cite{2+3} will produce the result @cite{5}.
+@expr{2+3}, normalizes it, and pushes the result.  Of course the standard
+rules for normalizing @expr{2+3} will produce the result @expr{5}.
 
 Simplification mode commands consist of the lower-case @kbd{m} prefix key
 followed by a shifted letter.
@@ -12627,7 +12778,7 @@
 @kindex m O
 @pindex calc-no-simplify-mode
 The @kbd{m O} (@code{calc-no-simplify-mode}) command turns off all optional
-simplifications.  These would leave a formula like @cite{2+3} alone.  In
+simplifications.  These would leave a formula like @expr{2+3} alone.  In
 fact, nothing except simple numbers are ever affected by normalization
 in this mode.
 
@@ -12635,22 +12786,24 @@
 @pindex calc-num-simplify-mode
 The @kbd{m N} (@code{calc-num-simplify-mode}) command turns off simplification
 of any formulas except those for which all arguments are constants.  For
-example, @cite{1+2} is simplified to @cite{3}, and @cite{a+(2-2)} is
-simplified to @cite{a+0} but no further, since one argument of the sum
-is not a constant.  Unfortunately, @cite{(a+2)-2} is @emph{not} simplified
+example, @expr{1+2} is simplified to @expr{3}, and @expr{a+(2-2)} is
+simplified to @expr{a+0} but no further, since one argument of the sum
+is not a constant.  Unfortunately, @expr{(a+2)-2} is @emph{not} simplified
 because the top-level @samp{-} operator's arguments are not both
-constant numbers (one of them is the formula @cite{a+2}).
+constant numbers (one of them is the formula @expr{a+2}).
 A constant is a number or other numeric object (such as a constant
 error form or modulo form), or a vector all of whose
-elements are constant.@refill
+elements are constant.
 
 @kindex m D
 @pindex calc-default-simplify-mode
 The @kbd{m D} (@code{calc-default-simplify-mode}) command restores the
 default simplifications for all formulas.  This includes many easy and
-fast algebraic simplifications such as @cite{a+0} to @cite{a}, and
-@cite{a + 2 a} to @cite{3 a}, as well as evaluating functions like
-@cite{@t{deriv}(x^2, x)} to @cite{2 x}.
+fast algebraic simplifications such as @expr{a+0} to @expr{a}, and
+@expr{a + 2 a} to @expr{3 a}, as well as evaluating functions like
+@texline @t{deriv}@expr{(x^2,x)}
+@infoline @expr{@t{deriv}(x^2, x)} 
+to @expr{2 x}.
 
 @kindex m B
 @pindex calc-bin-simplify-mode
@@ -12681,13 +12834,13 @@
 (@code{calc-simplify-units}), which in turn
 is a superset of @kbd{a s}.  In this mode, variable names which
 are identifiable as unit names (like @samp{mm} for ``millimeters'')
-are simplified with their unit definitions in mind.@refill
+are simplified with their unit definitions in mind.
 
 A common technique is to set the simplification mode down to the lowest
 amount of simplification you will allow to be applied automatically, then
 use manual commands like @kbd{a s} and @kbd{c c} (@code{calc-clean}) to
 perform higher types of simplifications on demand.  @xref{Algebraic
-Definitions}, for another sample use of no-simplification mode.@refill
+Definitions}, for another sample use of no-simplification mode.
 
 @node Declarations, Display Modes, Simplification Modes, Mode Settings
 @section Declarations
@@ -12949,8 +13102,8 @@
 Calc does not check the declarations for a variable when you store
 a value in it.  However, storing @i{-3.5} in a variable that has
 been declared @code{pos}, @code{int}, or @code{matrix} may have
-unexpected effects; Calc may evaluate @samp{sqrt(x^2)} to @cite{3.5}
-if it substitutes the value first, or to @cite{-3.5} if @code{x}
+unexpected effects; Calc may evaluate @samp{sqrt(x^2)} to @expr{3.5}
+if it substitutes the value first, or to @expr{-3.5} if @code{x}
 was declared @code{pos} and the formula @samp{sqrt(x^2)} is
 simplified to @samp{x} before the value is substituted.  Before
 using a variable for a new purpose, it is best to use @kbd{s d}
@@ -13018,7 +13171,7 @@
 @end ignore
 @tindex dimag
 The @code{dimag} function checks if its argument is imaginary,
-i.e., is mathematically equal to a real number times @cite{i}.
+i.e., is mathematically equal to a real number times @expr{i}.
 
 @ignore
 @starindex
@@ -13036,7 +13189,7 @@
 The @code{dneg} function checks for negative reals.  The @code{dnonneg}
 function checks for nonnegative reals, i.e., reals greater than or
 equal to zero.  Note that the @kbd{a s} command can simplify an
-expression like @cite{x > 0} to 1 or 0 using @code{dpos}, and that
+expression like @expr{x > 0} to 1 or 0 using @code{dpos}, and that
 @kbd{a s} is effectively applied to all conditions in rewrite rules,
 so the actual functions @code{dpos}, @code{dneg}, and @code{dnonneg}
 are rarely necessary.
@@ -13105,7 +13258,7 @@
 (@code{calc-line-breaking}) commands are described elsewhere;
 @pxref{Stack Basics} and @pxref{Normal Language Modes}, respectively.
 Display formats for vectors and matrices are also covered elsewhere;
-@pxref{Vector and Matrix Formats}.@refill
+@pxref{Vector and Matrix Formats}.
 
 One thing all display modes have in common is their treatment of the
 @kbd{H} prefix.  This prefix causes any mode command that would normally
@@ -13165,7 +13318,7 @@
 respectively.  Numbers can always be entered in any radix, though the
 current radix is used as a default if you press @kbd{#} without any initial
 digits.  A number entered without a @kbd{#} is @emph{always} interpreted
-as decimal.@refill
+as decimal.
 
 @kindex d r
 @pindex calc-radix
@@ -13180,10 +13333,12 @@
 represent the integer and no more.  The @kbd{d z} (@code{calc-leading-zeros})
 command causes integers to be padded out with leading zeros according to the
 current binary word size.  (@xref{Binary Functions}, for a discussion of
-word size.)  If the absolute value of the word size is @cite{w}, all integers
-are displayed with at least enough digits to represent @c{$2^w-1$}
-@cite{(2^w)-1} in the
-current radix.  (Larger integers will still be displayed in their entirety.)
+word size.)  If the absolute value of the word size is @expr{w}, all integers
+are displayed with at least enough digits to represent 
+@texline @tmath{2^w-1}
+@infoline @expr{(2^w)-1} 
+in the current radix.  (Larger integers will still be displayed in their
+entirety.) 
 
 @node Grouping Digits, Float Formats, Radix Modes, Display Modes
 @subsection Grouping Digits
@@ -13202,10 +13357,10 @@
 The @kbd{d g} command toggles grouping on and off.
 With a numerix prefix of 0, this command displays the current state of
 the grouping flag; with an argument of minus one it disables grouping;
-with a positive argument @cite{N} it enables grouping on every @cite{N}
+with a positive argument @expr{N} it enables grouping on every @expr{N}
 digits.  For floating-point numbers, grouping normally occurs only
-before the decimal point.  A negative prefix argument @cite{-N} enables
-grouping every @cite{N} digits both before and after the decimal point.@refill
+before the decimal point.  A negative prefix argument @expr{-N} enables
+grouping every @expr{N} digits both before and after the decimal point.
 
 @kindex d ,
 @pindex calc-group-char
@@ -13298,7 +13453,7 @@
 There are three supported notations for complex numbers in rectangular
 form.  The default is as a pair of real numbers enclosed in parentheses
 and separated by a comma: @samp{(a,b)}.  The @kbd{d c}
-(@code{calc-complex-notation}) command selects this style.@refill
+(@code{calc-complex-notation}) command selects this style.
 
 @kindex d i
 @pindex calc-i-notation
@@ -13307,7 +13462,7 @@
 The other notations are @kbd{d i} (@code{calc-i-notation}), in which
 numbers are displayed in @samp{a+bi} form, and @kbd{d j}
 (@code{calc-j-notation}) which displays the form @samp{a+bj} preferred
-in some disciplines.@refill
+in some disciplines.
 
 @cindex @code{i} variable
 @vindex i
@@ -13318,7 +13473,7 @@
 will be interpreted as @samp{(0,1)} and the formula will be simplified
 to @samp{(2,3)}.  Other commands (like @code{calc-sin}) will @emph{not}
 interpret the formula @samp{2 + 3 * i} as a complex number.
-@xref{Variables}, under ``special constants.''@refill
+@xref{Variables}, under ``special constants.''
 
 @node Fraction Formats, HMS Formats, Complex Formats, Display Modes
 @subsection Fraction Formats
@@ -13346,12 +13501,12 @@
 Calc adjusts all fractions that are displayed to have the specified
 denominator, if possible.  Otherwise it adjusts the denominator to
 be a multiple of the specified value.  For example, in @samp{:6} mode
-the fraction @cite{1:6} will be unaffected, but @cite{2:3} will be
-displayed as @cite{4:6}, @cite{1:2} will be displayed as @cite{3:6},
-and @cite{1:8} will be displayed as @cite{3:24}.  Integers are also
-affected by this mode:  3 is displayed as @cite{18:6}.  Note that the
+the fraction @expr{1:6} will be unaffected, but @expr{2:3} will be
+displayed as @expr{4:6}, @expr{1:2} will be displayed as @expr{3:6},
+and @expr{1:8} will be displayed as @expr{3:24}.  Integers are also
+affected by this mode:  3 is displayed as @expr{18:6}.  Note that the
 format @samp{:1} writes fractions the same as @samp{:}, but it writes
-integers as @cite{n:1}.
+integers as @expr{n:1}.
 
 The fraction format does not affect the way fractions or integers are
 stored, only the way they appear on the screen.  The fraction format
@@ -13710,15 +13865,15 @@
 that the values below the @samp{.} are @emph{visible}, just temporarily
 frozen.  This feature allows you to keep several independent calculations
 running at once in different parts of the stack, or to apply a certain
-command to an element buried deep in the stack.@refill
+command to an element buried deep in the stack.
 
 Pressing @kbd{d t} by itself moves the @samp{.} to the line the cursor
 is on.  Thus, this line and all those below it become hidden.  To un-hide
 these lines, move down to the end of the buffer and press @w{@kbd{d t}}.
-With a positive numeric prefix argument @cite{n}, @kbd{d t} hides the
-bottom @cite{n} values in the buffer.  With a negative argument, it hides
-all but the top @cite{n} values.  With an argument of zero, it hides zero
-values, i.e., moves the @samp{.} all the way down to the bottom.@refill
+With a positive numeric prefix argument @expr{n}, @kbd{d t} hides the
+bottom @expr{n} values in the buffer.  With a negative argument, it hides
+all but the top @expr{n} values.  With an argument of zero, it hides zero
+values, i.e., moves the @samp{.} all the way down to the bottom.
 
 @kindex d [
 @pindex calc-truncate-up
@@ -13726,7 +13881,7 @@
 @pindex calc-truncate-down
 The @kbd{d [} (@code{calc-truncate-up}) and @kbd{d ]}
 (@code{calc-truncate-down}) commands move the @samp{.} up or down one
-line at a time (or several lines with a prefix argument).@refill
+line at a time (or several lines with a prefix argument).
 
 @node Justification, Labels, Truncating the Stack, Display Modes
 @subsection Justification
@@ -13743,7 +13898,7 @@
 @kbd{d >} (@code{calc-right-justify}), or @kbd{d =}
 (@code{calc-center-justify}).  For example, in right-justification mode,
 stack entries are displayed flush-right against the right edge of the
-window.@refill
+window.
 
 If you change the width of the Calculator window you may have to type
 @kbd{d @key{SPC}} (@code{calc-refresh}) to re-align right-justified or centered
@@ -13933,10 +14088,10 @@
 @end example
 
 @noindent
-can represent either the negative rational number @cite{-3:4}, or the
+can represent either the negative rational number @expr{-3:4}, or the
 actual expression @samp{-(3/4)}; but the latter formula would normally
 never be displayed because it would immediately be evaluated to
-@cite{-3:4} or @cite{-0.75}, so this ambiguity is not a problem in
+@expr{-3:4} or @expr{-0.75}, so this ambiguity is not a problem in
 typical use.
 
 Non-decimal numbers are displayed with subscripts.  Thus there is no
@@ -14061,7 +14216,7 @@
 Math formulas are usually enclosed by @samp{$ $} signs in @TeX{}; these
 should be omitted when interfacing with Calc.  To Calc, the @samp{$} sign
 has the same meaning it always does in algebraic formulas (a reference to
-an existing entry on the stack).@refill
+an existing entry on the stack).
 
 Complex numbers are displayed as in @samp{3 + 4i}.  Fractions and
 quotients are written using @code{\over};
@@ -14073,7 +14228,7 @@
 The words @code{\left} and @code{\right} are ignored when reading
 formulas in @TeX{} mode.  Both @code{inf} and @code{uinf} are written
 as @code{\infty}; when read, @code{\infty} always translates to
-@code{inf}.@refill
+@code{inf}.
 
 Function calls are written the usual way, with the function name followed
 by the arguments in parentheses.  However, functions for which @TeX{} has
@@ -14081,9 +14236,11 @@
 parentheses for very simple arguments.  During input, curly braces and
 parentheses work equally well for grouping, but when the document is
 formatted the curly braces will be invisible.  Thus the printed result is
-@c{$\sin{2 x}$}
-@cite{sin 2x} but @c{$\sin(2 + x)$}
-@cite{sin(2 + x)}.
+@texline @tmath{\sin{2 x}}
+@infoline @expr{sin 2x} 
+but 
+@texline @tmath{\sin(2 + x)}.
+@infoline @expr{sin(2 + x)}.
 
 Function and variable names not treated specially by @TeX{} are simply
 written out as-is, which will cause them to come out in italic letters
@@ -14244,7 +14401,6 @@
 @end group
 @end example
 @tex
-\let\rm\goodrm
 $$ \sin\left( a^2 \over b_i \right) $$
 @end tex
 @sp 1
@@ -14282,7 +14438,7 @@
 @end group
 @end example
 @tex
-\turnoffactive\let\rm\goodrm
+\turnoffactive
 $$ [\sin{a}, \sin{2 a}, \sin(2 + a), \sin\left( {a \over b} \right)] $$
 @end tex
 @sp 2
@@ -14300,7 +14456,6 @@
 @end group
 @end example
 @tex
-\let\rm\goodrm
 $$ [f(a), foo(bar), \sin{\pi}] $$
 $$ [f(a), \hbox{foo}(\hbox{bar}), \sin{\pi}] $$
 $$ [f(a), \tilde F(\hbox{bar}), \sin{\pi}] $$
@@ -14453,7 +14608,7 @@
 Mathematica mode.
 Non-decimal numbers are written, e.g., @samp{16^^7fff}.  Floating-point
 numbers in scientific notation are written @samp{1.23*10.^3}.
-Subscripts use double square brackets: @samp{a[[i]]}.@refill
+Subscripts use double square brackets: @samp{a[[i]]}.
 
 @node Maple Language Mode, Compositions, Mathematica Language Mode, Language Modes
 @subsection Maple Language Mode
@@ -14594,9 +14749,9 @@
 =>      40
 @end example
 
-The general rule is that if an operator with precedence @cite{n}
-occurs as an argument to an operator with precedence @cite{m}, then
-the argument is enclosed in parentheses if @cite{n < m}.  Top-level
+The general rule is that if an operator with precedence @expr{n}
+occurs as an argument to an operator with precedence @expr{m}, then
+the argument is enclosed in parentheses if @expr{n < m}.  Top-level
 expressions and expressions which are function arguments, vector
 components, etc., are formatted with precedence zero (so that they
 normally never get additional parentheses).
@@ -15579,8 +15734,10 @@
 
 @item
 Matrix/scalar mode.  Default value is @i{-1}.  Value is 0 for scalar
-mode, @i{-2} for matrix mode, or @var{N} for @c{$N\times N$}
-@var{N}x@var{N} matrix mode.  Command is @kbd{m v}.
+mode, @i{-2} for matrix mode, or @var{N} for 
+@texline @tmath{N\times N}
+@infoline @var{N}x@var{N} 
+matrix mode.  Command is @kbd{m v}.
 
 @item
 Simplification mode.  Default is 1.  Value is @i{-1} for off (@kbd{m O}),
@@ -15906,9 +16063,9 @@
 work, for the same reasons just mentioned for vectors.  Instead you must
 write @samp{(a +/- b) + (c +/- 0)}.
 
-If both arguments of @kbd{+} are modulo forms with equal values of @cite{M},
+If both arguments of @kbd{+} are modulo forms with equal values of @expr{M},
 or if one argument is a modulo form and the other a plain number, the
-result is a modulo form which represents the sum, modulo @cite{M}, of
+result is a modulo form which represents the sum, modulo @expr{M}, of
 the two values.
 
 If both arguments of @kbd{+} are intervals, the result is an interval
@@ -15964,19 +16121,19 @@
 @end ignore
 @tindex /
 The @kbd{/} (@code{calc-divide}) command divides two numbers.  When
-dividing a scalar @cite{B} by a square matrix @cite{A}, the computation
-performed is @cite{B} times the inverse of @cite{A}.  This also occurs
-if @cite{B} is itself a vector or matrix, in which case the effect is
-to solve the set of linear equations represented by @cite{B}.  If @cite{B}
-is a matrix with the same number of rows as @cite{A}, or a plain vector
+dividing a scalar @expr{B} by a square matrix @expr{A}, the computation
+performed is @expr{B} times the inverse of @expr{A}.  This also occurs
+if @expr{B} is itself a vector or matrix, in which case the effect is
+to solve the set of linear equations represented by @expr{B}.  If @expr{B}
+is a matrix with the same number of rows as @expr{A}, or a plain vector
 (which is interpreted here as a column vector), then the equation
-@cite{A X = B} is solved for the vector or matrix @cite{X}.  Otherwise,
-if @cite{B} is a non-square matrix with the same number of @emph{columns}
-as @cite{A}, the equation @cite{X A = B} is solved.  If you wish a vector
-@cite{B} to be interpreted as a row vector to be solved as @cite{X A = B},
+@expr{A X = B} is solved for the vector or matrix @expr{X}.  Otherwise,
+if @expr{B} is a non-square matrix with the same number of @emph{columns}
+as @expr{A}, the equation @expr{X A = B} is solved.  If you wish a vector
+@expr{B} to be interpreted as a row vector to be solved as @expr{X A = B},
 make it into a one-row matrix with @kbd{C-u 1 v p} first.  To force a
-left-handed solution with a square matrix @cite{B}, transpose @cite{A} and
-@cite{B} before dividing, then transpose the result.
+left-handed solution with a square matrix @expr{B}, transpose @expr{A} and
+@expr{B} before dividing, then transpose the result.
 
 HMS forms can be divided by real numbers or by other HMS forms.  Error
 forms can be divided in any combination of ways.  Modulo forms where both
@@ -16026,10 +16183,10 @@
 @tindex %
 The @kbd{%} (@code{calc-mod}) command performs a ``modulo'' (or ``remainder'')
 operation.  Mathematically, @samp{a%b = a - (a\b)*b}, and is defined
-for all real numbers @cite{a} and @cite{b} (except @cite{b=0}).  For
-positive @cite{b}, the result will always be between 0 (inclusive) and
-@cite{b} (exclusive).  Modulo does not work for HMS forms and error forms.
-If @cite{a} is a modulo form, its modulo is changed to @cite{b}, which
+for all real numbers @expr{a} and @expr{b} (except @expr{b=0}).  For
+positive @expr{b}, the result will always be between 0 (inclusive) and
+@expr{b} (exclusive).  Modulo does not work for HMS forms and error forms.
+If @expr{a} is a modulo form, its modulo is changed to @expr{b}, which
 must be positive real number.
 
 @kindex :
@@ -16083,7 +16240,7 @@
 @tindex inv
 @cindex Reciprocal
 The @kbd{&} (@code{calc-inv}) [@code{inv}] command computes the
-reciprocal of a number, i.e., @cite{1 / x}.  Operating on a square
+reciprocal of a number, i.e., @expr{1 / x}.  Operating on a square
 matrix, it computes the inverse of that matrix.
 
 @kindex Q
@@ -16098,8 +16255,8 @@
 @tindex hypot
 The @kbd{f h} (@code{calc-hypot}) [@code{hypot}] command computes the square
 root of the sum of the squares of two numbers.  That is, @samp{hypot(a,b)}
-is the length of the hypotenuse of a right triangle with sides @cite{a}
-and @cite{b}.  If the arguments are complex numbers, their squared
+is the length of the hypotenuse of a right triangle with sides @expr{a}
+and @expr{b}.  If the arguments are complex numbers, their squared
 magnitudes are used.
 
 @kindex f Q
@@ -16124,7 +16281,7 @@
 respectively.  These commands also work on HMS forms, date forms,
 intervals, and infinities.  (In algebraic expressions, these functions
 take any number of arguments and return the maximum or minimum among
-all the arguments.)@refill
+all the arguments.)
 
 @kindex f M
 @kindex f X
@@ -16133,17 +16290,18 @@
 @pindex calc-xpon-part
 @tindex xpon
 The @kbd{f M} (@code{calc-mant-part}) [@code{mant}] function extracts
-the ``mantissa'' part @cite{m} of its floating-point argument; @kbd{f X}
+the ``mantissa'' part @expr{m} of its floating-point argument; @kbd{f X}
 (@code{calc-xpon-part}) [@code{xpon}] extracts the ``exponent'' part
-@cite{e}.  The original number is equal to @c{$m \times 10^e$}
-@cite{m * 10^e},
-where @cite{m} is in the interval @samp{[1.0 ..@: 10.0)} except that
-@cite{m=e=0} if the original number is zero.  For integers
+@expr{e}.  The original number is equal to 
+@texline @tmath{m \times 10^e},
+@infoline @expr{m * 10^e},
+where @expr{m} is in the interval @samp{[1.0 ..@: 10.0)} except that
+@expr{m=e=0} if the original number is zero.  For integers
 and fractions, @code{mant} returns the number unchanged and @code{xpon}
 returns zero.  The @kbd{v u} (@code{calc-unpack}) command can also be
 used to ``unpack'' a floating-point number; this produces an integer
 mantissa and exponent, with the constraint that the mantissa is not
-a multiple of ten (again except for the @cite{m=e=0} case).@refill
+a multiple of ten (again except for the @expr{m=e=0} case).
 
 @kindex f S
 @pindex calc-scale-float
@@ -16152,7 +16310,7 @@
 by a given power of ten.  Thus, @samp{scf(mant(x), xpon(x)) = x} for any
 real @samp{x}.  The second argument must be an integer, but the first
 may actually be any numeric value.  For example, @samp{scf(5,-2) = 0.05}
-or @samp{1:20} depending on the current Fraction Mode.@refill
+or @samp{1:20} depending on the current Fraction Mode.
 
 @kindex f [
 @kindex f ]
@@ -16167,10 +16325,12 @@
 For example, incrementing @samp{12.3456} when the current precision
 is 6 digits yields @samp{12.3457}.  If the current precision had been
 8 digits, the result would have been @samp{12.345601}.  Incrementing
-@samp{0.0} produces @c{$10^{-p}$}
-@cite{10^-p}, where @cite{p} is the current
+@samp{0.0} produces 
+@texline @tmath{10^{-p}},
+@infoline @expr{10^-p}, 
+where @expr{p} is the current
 precision.  These operations are defined only on integers and floats.
-With numeric prefix arguments, they change the number by @cite{n} units.
+With numeric prefix arguments, they change the number by @expr{n} units.
 
 Note that incrementing followed by decrementing, or vice-versa, will
 almost but not quite always cancel out.  Suppose the precision is
@@ -16207,7 +16367,7 @@
 The @kbd{F} (@code{calc-floor}) [@code{floor} or @code{ffloor}] command
 truncates a real number to the next lower integer, i.e., toward minus
 infinity.  Thus @kbd{3.6 F} produces 3, but @kbd{_3.6 F} produces
-@i{-4}.@refill
+@i{-4}.
 
 @kindex I F
 @pindex calc-ceiling
@@ -16219,7 +16379,7 @@
 @kindex H I F
 The @kbd{I F} (@code{calc-ceiling}) [@code{ceil} or @code{fceil}]
 command truncates toward positive infinity.  Thus @kbd{3.6 I F} produces
-4, and @kbd{_3.6 I F} produces @i{-3}.@refill
+4, and @kbd{_3.6 I F} produces @i{-3}.
 
 @kindex R
 @pindex calc-round
@@ -16233,7 +16393,7 @@
 rounds to the nearest integer.  When the fractional part is .5 exactly,
 this command rounds away from zero.  (All other rounding in the
 Calculator uses this convention as well.)  Thus @kbd{3.5 R} produces 4
-but @kbd{3.4 R} produces 3; @kbd{_3.5 R} produces @i{-4}.@refill
+but @kbd{3.4 R} produces 3; @kbd{_3.5 R} produces @i{-4}.
 
 @kindex I R
 @pindex calc-trunc
@@ -16246,7 +16406,7 @@
 The @kbd{I R} (@code{calc-trunc}) [@code{trunc} or @code{ftrunc}]
 command truncates toward zero.  In other words, it ``chops off''
 everything after the decimal point.  Thus @kbd{3.6 I R} produces 3 and
-@kbd{_3.6 I R} produces @i{-3}.@refill
+@kbd{_3.6 I R} produces @i{-3}.
 
 These functions may not be applied meaningfully to error forms, but they
 do work for intervals.  As a convenience, applying @code{floor} to a
@@ -16284,7 +16444,7 @@
 already have been rounded to the current precision before @code{rounde}
 begins.  For example, @samp{rounde(2.500001)} with a current precision
 of 6 will incorrectly, or at least surprisingly, yield 2 because the
-argument will first have been rounded down to @cite{2.5} (which
+argument will first have been rounded down to @expr{2.5} (which
 @code{rounde} sees as an exact tie between 2 and 3).
 
 Each of these functions, when written in algebraic formulas, allows
@@ -16298,7 +16458,7 @@
 @cindex Fractional part of a number
 To compute the fractional part of a number (i.e., the amount which, when
 added to `@t{floor(}@var{n}@t{)}', will produce @var{n}) just take @var{n}
-modulo 1 using the @code{%} command.@refill
+modulo 1 using the @code{%} command.
 
 Note also the @kbd{\} (integer quotient), @kbd{f I} (integer logarithm),
 and @kbd{f Q} (integer square root) commands, which are analogous to
@@ -16313,8 +16473,8 @@
 @pindex calc-conj
 @tindex conj
 The @kbd{J} (@code{calc-conj}) [@code{conj}] command computes the
-complex conjugate of a number.  For complex number @cite{a+bi}, the
-complex conjugate is @cite{a-bi}.  If the argument is a real number,
+complex conjugate of a number.  For complex number @expr{a+bi}, the
+complex conjugate is @expr{a-bi}.  If the argument is a real number,
 this command leaves it the same.  If the argument is a vector or matrix,
 this command replaces each element by its complex conjugate.
 
@@ -16324,15 +16484,15 @@
 The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the
 ``argument'' or polar angle of a complex number.  For a number in polar
 notation, this is simply the second component of the pair
-`@t{(}@var{r}@t{;}@c{$\theta$}
-@var{theta}@t{)}'.
+@texline `@t{(}@var{r}@t{;}@tmath{\theta}@t{)}'.
+@infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}'.
 The result is expressed according to the current angular mode and will
 be in the range @i{-180} degrees (exclusive) to @i{+180} degrees
-(inclusive), or the equivalent range in radians.@refill
+(inclusive), or the equivalent range in radians.
 
 @pindex calc-imaginary
 The @code{calc-imaginary} command multiplies the number on the
-top of the stack by the imaginary number @cite{i = (0,1)}.  This
+top of the stack by the imaginary number @expr{i = (0,1)}.  This
 command is not normally bound to a key in Calc, but it is available
 on the @key{IMAG} button in Keypad Mode.
 
@@ -16342,14 +16502,14 @@
 The @kbd{f r} (@code{calc-re}) [@code{re}] command replaces a complex number
 by its real part.  This command has no effect on real numbers.  (As an
 added convenience, @code{re} applied to a modulo form extracts
-the value part.)@refill
+the value part.)
 
 @kindex f i
 @pindex calc-im
 @tindex im
 The @kbd{f i} (@code{calc-im}) [@code{im}] command replaces a complex number
 by its imaginary part; real numbers are converted to zero.  With a vector
-or matrix argument, these functions operate element-wise.@refill
+or matrix argument, these functions operate element-wise.
 
 @ignore
 @mindex v p
@@ -16383,13 +16543,13 @@
 @tindex pfloat
 The @kbd{c f} (@code{calc-float}) [@code{pfloat}] command converts the
 number on the top of the stack to floating-point form.  For example,
-@cite{23} is converted to @cite{23.0}, @cite{3:2} is converted to
-@cite{1.5}, and @cite{2.3} is left the same.  If the value is a composite
+@expr{23} is converted to @expr{23.0}, @expr{3:2} is converted to
+@expr{1.5}, and @expr{2.3} is left the same.  If the value is a composite
 object such as a complex number or vector, each of the components is
 converted to floating-point.  If the value is a formula, all numbers
 in the formula are converted to floating-point.  Note that depending
 on the current floating-point precision, conversion to floating-point
-format may lose information.@refill
+format may lose information.
 
 As a special exception, integers which appear as powers or subscripts
 are not floated by @kbd{c f}.  If you really want to float a power,
@@ -16442,7 +16602,7 @@
 The @kbd{c d} (@code{calc-to-degrees}) [@code{deg}] command converts a
 number into degrees form.  The value on the top of the stack may be an
 HMS form (interpreted as degrees-minutes-seconds), or a real number which
-will be interpreted in radians regardless of the current angular mode.@refill
+will be interpreted in radians regardless of the current angular mode.
 
 @kindex c r
 @pindex calc-to-radians
@@ -16475,7 +16635,7 @@
 functions in algebraic formulas, depending on the direction of
 conversion.  (It uses @code{polar}, except that if the argument is
 already a polar complex number, it uses @code{rect} instead.  The
-@kbd{I c p} command always uses @code{rect}.)@refill
+@kbd{I c p} command always uses @code{rect}.)
 
 @kindex c c
 @pindex calc-clean
@@ -16488,7 +16648,7 @@
 angular mode is different from the one under which the number was
 produced!)  Integers and fractions are generally unaffected by this
 operation.  Vectors and formulas are cleaned by cleaning each component
-number (i.e., pervasively).@refill
+number (i.e., pervasively).
 
 If the simplification mode is set below the default level, it is raised
 to the default level for the purposes of this command.  Thus, @kbd{c c}
@@ -16809,7 +16969,7 @@
 
 There is no @code{newday} function at all because @kbd{F} [@code{floor}]
 serves this purpose.  Similarly, instead of @code{incday} and
-@code{incweek} simply use @cite{d + n} or @cite{d + 7 n}.
+@code{incweek} simply use @expr{d + n} or @expr{d + 7 n}.
 
 @xref{Basic Arithmetic}, for the @kbd{f ]} [@code{incr}] command
 which can adjust a date/time form by a certain number of seconds.
@@ -16870,12 +17030,12 @@
 
 @item
 Any Calc formula which evaluates to one of the above three things.
-If the formula involves the variable @cite{y}, it stands for a
-yearly repeating holiday; @cite{y} will take on various year
+If the formula involves the variable @expr{y}, it stands for a
+yearly repeating holiday; @expr{y} will take on various year
 numbers like 1992.  For example, @samp{date(y, 12, 25)} specifies
 Christmas day, and @samp{newweek(date(y, 11, 7), 4) + 21} specifies
 Thanksgiving (which is held on the fourth Thursday of November).
-If the formula involves the variable @cite{m}, that variable
+If the formula involves the variable @expr{m}, that variable
 takes on month numbers from 1 to 12:  @samp{date(y, m, 15)} is
 a holiday that takes place on the 15th of every month.
 
@@ -17290,7 +17450,7 @@
 20% smaller than 50.  (The answers are different in magnitude
 because, in the first case, we're increasing by 25% of 40, but
 in the second case, we're decreasing by 20% of 50.)  The effect
-of @kbd{40 @key{RET} 50 b %} is to compute @cite{(50-40)/40}, converting
+of @kbd{40 @key{RET} 50 b %} is to compute @expr{(50-40)/40}, converting
 the answer to percentage form as if by @kbd{c %}.
 
 @node Future Value, Present Value, Percentages, Financial Functions
@@ -17334,7 +17494,7 @@
 fourth argument, which is used as an initial lump sum in the sense
 of @code{fvl}.  In other words, @code{fv(@var{rate}, @var{n},
 @var{payment}, @var{initial}) = fv(@var{rate}, @var{n}, @var{payment})
-+ fvl(@var{rate}, @var{n}, @var{initial})}.@refill
++ fvl(@var{rate}, @var{n}, @var{initial})}.
 
 To illustrate the relationships between these functions, we could
 do the @code{fvb} calculation ``by hand'' using @code{fvl}.  The
@@ -17352,7 +17512,7 @@
 as the beginning of the next, so what this really means is that we've
 lost the payment at year zero (which contributed $1300.78), but we're
 now counting the payment at year five (which, since it didn't have
-a chance to earn interest, counts as $1000).  Indeed, @cite{5569.96 =
+a chance to earn interest, counts as $1000).  Indeed, @expr{5569.96 =
 5870.73 - 1300.78 + 1000} (give or take a bit of roundoff error).
 
 @node Present Value, Related Financial Functions, Future Value, Financial Functions
@@ -17382,7 +17542,7 @@
 the return from leaving the money in the bank, which is
 @code{fvl(9%, 4, @var{x})} where @var{x} is the amount of money
 you would have to put up in advance.  The @code{pv} function
-finds the break-even point, @cite{x = 6479.44}, at which
+finds the break-even point, @expr{x = 6479.44}, at which
 @code{fvl(9%, 4, 6479.44)} is also equal to 9146.26.  This is
 the largest amount you should be willing to invest.
 
@@ -17431,7 +17591,7 @@
 payment arguments, each either a vector or a plain number, all these
 values are collected left-to-right into the complete list of payments.
 A numeric prefix argument on the @kbd{b N} command says how many
-payment values or vectors to take from the stack.@refill
+payment values or vectors to take from the stack.
 
 @kindex I b N
 @tindex npvb
@@ -17453,7 +17613,7 @@
 the amount of periodic payment necessary to amortize a loan.
 Thus @code{pmt(@var{rate}, @var{n}, @var{amount})} equals the
 value of @var{payment} such that @code{pv(@var{rate}, @var{n},
-@var{payment}) = @var{amount}}.@refill
+@var{payment}) = @var{amount}}.
 
 @kindex I b M
 @tindex pmtb
@@ -17475,14 +17635,14 @@
 the value of @var{n} such that @code{pv(@var{rate}, @var{n},
 @var{payment}) = @var{amount}}.  If @var{payment} is too small
 ever to amortize a loan for @var{amount} at interest rate @var{rate},
-the @code{nper} function is left in symbolic form.@refill
+the @code{nper} function is left in symbolic form.
 
 @kindex I b #
 @tindex nperb
 The @kbd{I b #} [@code{nperb}] command does the same computation
 but using @code{pvb} instead of @code{pv}.  You can give a fourth
 lump-sum argument to these functions, but the computation will be
-rather slow in the four-argument case.@refill
+rather slow in the four-argument case.
 
 @kindex H b #
 @tindex nperl
@@ -17490,7 +17650,7 @@
 using @code{pvl}.  By exchanging @var{payment} and @var{amount} you
 can also get the solution for @code{fvl}.  For example,
 @code{nperl(8%, 2000, 1000) = 9.006}, so if you place $1000 in a
-bank account earning 8%, it will take nine years to grow to $2000.@refill
+bank account earning 8%, it will take nine years to grow to $2000.
 
 @kindex b T
 @pindex calc-fin-rate
@@ -17499,7 +17659,7 @@
 the rate of return on an investment.  This is also an inverse of @code{pv}:
 @code{rate(@var{n}, @var{payment}, @var{amount})} computes the value of
 @var{rate} such that @code{pv(@var{rate}, @var{n}, @var{payment}) =
-@var{amount}}.  The result is expressed as a formula like @samp{6.3%}.@refill
+@var{amount}}.  The result is expressed as a formula like @samp{6.3%}.
 
 @kindex I b T
 @kindex H b T
@@ -17511,7 +17671,7 @@
 accept an optional fourth argument just like @code{pv} and @code{pvb}.
 To redo the above example from a different perspective,
 @code{ratel(9, 2000, 1000) = 8.00597%}, which says you will need an
-interest rate of 8% in order to double your account in nine years.@refill
+interest rate of 8% in order to double your account in nine years.
 
 @kindex b I
 @pindex calc-fin-irr
@@ -17573,7 +17733,7 @@
 parameter as well, although it will ignore its value except that the
 return value will as usual be zero if @var{period} is out of range.
 
-For example, pushing the vector @cite{[1,2,3,4,5]} (perhaps with @kbd{v x 5})
+For example, pushing the vector @expr{[1,2,3,4,5]} (perhaps with @kbd{v x 5})
 and then mapping @kbd{V M ' [sln(12000,2000,5,$), syd(12000,2000,5,$),
 ddb(12000,2000,5,$)] @key{RET}} produces a matrix that allows us to compare
 the three depreciation methods:
@@ -17594,7 +17754,7 @@
 @kbd{syd} depreciates more at the beginning and less at the end,
 and @kbd{ddb} weights the depreciation even more toward the beginning.
 
-Summing columns with @kbd{V R : +} yields @cite{[10000, 10000, 10000]};
+Summing columns with @kbd{V R : +} yields @expr{[10000, 10000, 10000]};
 the total depreciation in any method is (by definition) the
 difference between the cost and the salvage value.
 
@@ -17716,7 +17876,7 @@
 @end tex
 
 @noindent
-In @code{pmt} and @code{pmtb}, @cite{x=0} if omitted.
+In @code{pmt} and @code{pmtb}, @expr{x=0} if omitted.
 
 These functions accept any numeric objects, including error forms,
 intervals, and even (though not very usefully) complex numbers.  The
@@ -17776,31 +17936,34 @@
 zeros with @kbd{d z}.  @xref{Radix Modes}.
 
 @cindex Word size for binary operations
-The Calculator maintains a current @dfn{word size} @cite{w}, an
+The Calculator maintains a current @dfn{word size} @expr{w}, an
 arbitrary positive or negative integer.  For a positive word size, all
-of the binary operations described here operate modulo @cite{2^w}.  In
+of the binary operations described here operate modulo @expr{2^w}.  In
 particular, negative arguments are converted to positive integers modulo
-@cite{2^w} by all binary functions.@refill
+@expr{2^w} by all binary functions.
 
 If the word size is negative, binary operations produce 2's complement
-integers from @c{$-2^{-w-1}$}
-@cite{-(2^(-w-1))} to @c{$2^{-w-1}-1$}
-@cite{2^(-w-1)-1} inclusive.  Either
-mode accepts inputs in any range; the sign of @cite{w} affects only
-the results produced.
+integers from 
+@texline @tmath{-2^{-w-1}}
+@infoline @expr{-(2^(-w-1))} 
+to 
+@texline @tmath{2^{-w-1}-1}
+@infoline @expr{2^(-w-1)-1} 
+inclusive.  Either mode accepts inputs in any range; the sign of
+@expr{w} affects only the results produced.
 
 @kindex b c
 @pindex calc-clip
 @tindex clip
 The @kbd{b c} (@code{calc-clip})
 [@code{clip}] command can be used to clip a number by reducing it modulo
-@cite{2^w}.  The commands described in this chapter automatically clip
+@expr{2^w}.  The commands described in this chapter automatically clip
 their results to the current word size.  Note that other operations like
 addition do not use the current word size, since integer addition
 generally is not ``binary.''  (However, @pxref{Simplification Modes},
 @code{calc-bin-simplify-mode}.)  For example, with a word size of 8
 bits @kbd{b c} converts a number to the range 0 to 255; with a word
-size of @i{-8} @kbd{b c} converts to the range @i{-128} to 127.@refill
+size of @i{-8} @kbd{b c} converts to the range @i{-128} to 127.
 
 @kindex b w
 @pindex calc-word-size
@@ -17820,7 +17983,7 @@
 in symbolic form unless the all of its argument(s) are integers or
 integer-valued floats.
 
-If either or both arguments are modulo forms for which @cite{M} is a
+If either or both arguments are modulo forms for which @expr{M} is a
 power of two, that power of two is taken as the word size unless a
 numeric prefix argument overrides it.  The current word size is never
 consulted when modulo-power-of-two forms are involved.
@@ -17830,7 +17993,7 @@
 @tindex and
 The @kbd{b a} (@code{calc-and}) [@code{and}] command computes the bitwise
 AND of the two numbers on the top of the stack.  In other words, for each
-of the @cite{w} binary digits of the two numbers (pairwise), the corresponding
+of the @expr{w} binary digits of the two numbers (pairwise), the corresponding
 bit of the result is 1 if and only if both input bits are 1:
 @samp{and(2#1100, 2#1010) = 2#1000}.
 
@@ -17965,17 +18128,20 @@
 @cindex Phi, golden ratio
 @cindex Golden ratio
 One miscellaneous command is shift-@kbd{P} (@code{calc-pi}), which pushes
-the value of @c{$\pi$}
-@cite{pi} (at the current precision) onto the stack.  With the
-Hyperbolic flag, it pushes the value @cite{e}, the base of natural logarithms.
-With the Inverse flag, it pushes Euler's constant @c{$\gamma$}
-@cite{gamma} (about 0.5772).  With both Inverse and Hyperbolic, it
-pushes the ``golden ratio'' @c{$\phi$}
-@cite{phi} (about 1.618).  (At present, Euler's constant is not available
+the value of @cpi{} (at the current precision) onto the stack.  With the
+Hyperbolic flag, it pushes the value @expr{e}, the base of natural logarithms.
+With the Inverse flag, it pushes Euler's constant 
+@texline @tmath{\gamma}
+@infoline @expr{gamma} 
+(about 0.5772).  With both Inverse and Hyperbolic, it
+pushes the ``golden ratio'' 
+@texline @tmath{\phi}
+@infoline @expr{phi} 
+(about 1.618).  (At present, Euler's constant is not available
 to unlimited precision; Calc knows only the first 100 digits.)
 In Symbolic mode, these commands push the
 actual variables @samp{pi}, @samp{e}, @samp{gamma}, and @samp{phi},
-respectively, instead of their values; @pxref{Symbolic Mode}.@refill
+respectively, instead of their values; @pxref{Symbolic Mode}.
 
 @ignore
 @mindex Q
@@ -18027,7 +18193,7 @@
 @end ignore
 @kindex I L
 The shift-@kbd{E} (@code{calc-exp}) [@code{exp}] command computes the
-exponential, i.e., @cite{e} raised to the power of the number on the stack.
+exponential, i.e., @expr{e} raised to the power of the number on the stack.
 The meanings of the Inverse and Hyperbolic flags follow from those for
 the @code{calc-ln} command.
 
@@ -18048,8 +18214,9 @@
 (base-10) logarithm of a number.  (With the Inverse flag [@code{exp10}],
 it raises ten to a given power.)  Note that the common logarithm of a
 complex number is computed by taking the natural logarithm and dividing
-by @c{$\ln10$}
-@cite{ln(10)}.
+by 
+@texline @tmath{\ln10}.
+@infoline @expr{ln(10)}.
 
 @kindex B
 @kindex I B
@@ -18058,9 +18225,10 @@
 @tindex alog
 The @kbd{B} (@code{calc-log}) [@code{log}] command computes a logarithm
 to any base.  For example, @kbd{1024 @key{RET} 2 B} produces 10, since
-@c{$2^{10} = 1024$}
-@cite{2^10 = 1024}.  In certain cases like @samp{log(3,9)}, the result
-will be either @cite{1:2} or @cite{0.5} depending on the current Fraction
+@texline @tmath{2^{10} = 1024}.
+@infoline @expr{2^10 = 1024}.  
+In certain cases like @samp{log(3,9)}, the result
+will be either @expr{1:2} or @expr{0.5} depending on the current Fraction
 Mode setting.  With the Inverse flag [@code{alog}], this command is
 similar to @kbd{^} except that the order of the arguments is reversed.
 
@@ -18070,7 +18238,7 @@
 The @kbd{f I} (@code{calc-ilog}) [@code{ilog}] command computes the
 integer logarithm of a number to any base.  The number and the base must
 themselves be positive integers.  This is the true logarithm, rounded
-down to an integer.  Thus @kbd{ilog(x,10)} is 3 for all @cite{x} in the
+down to an integer.  Thus @kbd{ilog(x,10)} is 3 for all @expr{x} in the
 range from 1000 to 9999.  If both arguments are positive integers, exact
 integer arithmetic is used; otherwise, this is equivalent to
 @samp{floor(log(x,b))}.
@@ -18079,19 +18247,21 @@
 @pindex calc-expm1
 @tindex expm1
 The @kbd{f E} (@code{calc-expm1}) [@code{expm1}] command computes
-@c{$e^x - 1$}
-@cite{exp(x)-1}, but using an algorithm that produces a more accurate
-answer when the result is close to zero, i.e., when @c{$e^x$}
-@cite{exp(x)} is close
-to one.
+@texline @tmath{e^x - 1},
+@infoline @expr{exp(x)-1}, 
+but using an algorithm that produces a more accurate
+answer when the result is close to zero, i.e., when 
+@texline @tmath{e^x}
+@infoline @expr{exp(x)} 
+is close to one.
 
 @kindex f L
 @pindex calc-lnp1
 @tindex lnp1
 The @kbd{f L} (@code{calc-lnp1}) [@code{lnp1}] command computes
-@c{$\ln(x+1)$}
-@cite{ln(x+1)}, producing a more accurate answer when @cite{x} is close
-to zero.
+@texline @tmath{\ln(x+1)},
+@infoline @expr{ln(x+1)}, 
+producing a more accurate answer when @expr{x} is close to zero.
 
 @node Trigonometric and Hyperbolic Functions, Advanced Math Functions, Logarithmic Functions, Scientific Functions
 @section Trigonometric/Hyperbolic Functions
@@ -18104,7 +18274,7 @@
 of an angle or complex number.  If the input is an HMS form, it is interpreted
 as degrees-minutes-seconds; otherwise, the input is interpreted according
 to the current angular mode.  It is best to use Radians mode when operating
-on complex numbers.@refill
+on complex numbers.
 
 Calc's ``units'' mechanism includes angular units like @code{deg},
 @code{rad}, and @code{grad}.  While @samp{sin(45 deg)} is not evaluated
@@ -18120,15 +18290,11 @@
 @xref{Symbolic Mode}.  Beware, this simplification occurs even if you
 have stored a different value in the variable @samp{pi}; this is one
 reason why changing built-in variables is a bad idea.  Arguments of
-the form @cite{x} plus a multiple of @c{$\pi/2$}
-@cite{pi/2} are also simplified.
-Calc includes similar formulas for @code{cos} and @code{tan}.@refill
+the form @expr{x} plus a multiple of @cpiover{2} are also simplified.
+Calc includes similar formulas for @code{cos} and @code{tan}.
 
 The @kbd{a s} command knows all angles which are integer multiples of
-@c{$\pi/12$}
-@cite{pi/12}, @c{$\pi/10$}
-@cite{pi/10}, or @c{$\pi/8$}
-@cite{pi/8} radians.  In degrees mode,
+@cpiover{12}, @cpiover{10}, or @cpiover{8} radians.  In degrees mode,
 analogous simplifications occur for integer multiples of 15 or 18
 degrees, and for arguments plus multiples of 90 degrees.
 
@@ -18253,7 +18419,7 @@
 @samp{[@var{cos}, @var{sin}]}.
 With the Inverse flag [@code{arcsincos}], this command takes a two-element
 vector as an argument and computes @code{arctan2} of the elements.
-(This command does not accept the Hyperbolic flag.)@refill
+(This command does not accept the Hyperbolic flag.)
 
 @node Advanced Math Functions, Branch Cuts, Trigonometric and Hyperbolic Functions, Scientific Functions
 @section Advanced Mathematical Functions
@@ -18278,8 +18444,9 @@
 gamma function.  For positive integer arguments, this is related to the
 factorial function:  @samp{gamma(n+1) = fact(n)}.  For general complex
 arguments the gamma function can be defined by the following definite
-integral:  @c{$\Gamma(a) = \int_0^\infty t^{a-1} e^t dt$}
-@cite{gamma(a) = integ(t^(a-1) exp(t), t, 0, inf)}.
+integral:  
+@texline @tmath{\Gamma(a) = \int_0^\infty t^{a-1} e^t dt}.
+@infoline @expr{gamma(a) = integ(t^(a-1) exp(t), t, 0, inf)}.  
 (The actual implementation uses far more efficient computational methods.)
 
 @kindex f G
@@ -18311,22 +18478,23 @@
 @tindex gammaG
 The @kbd{f G} (@code{calc-inc-gamma}) [@code{gammaP}] command computes
 the incomplete gamma function, denoted @samp{P(a,x)}.  This is defined by
-the integral, @c{$P(a,x) = \left( \int_0^x t^{a-1} e^t dt \right) / \Gamma(a)$}
-@cite{gammaP(a,x) = integ(t^(a-1) exp(t), t, 0, x) / gamma(a)}.
-This implies that @samp{gammaP(a,inf) = 1} for any @cite{a} (see the
+the integral, 
+@texline @tmath{P(a,x) = \left( \int_0^x t^{a-1} e^t dt \right) / \Gamma(a)}.
+@infoline @expr{gammaP(a,x) = integ(t^(a-1) exp(t), t, 0, x) / gamma(a)}.
+This implies that @samp{gammaP(a,inf) = 1} for any @expr{a} (see the
 definition of the normal gamma function).
 
 Several other varieties of incomplete gamma function are defined.
-The complement of @cite{P(a,x)}, called @cite{Q(a,x) = 1-P(a,x)} by
+The complement of @expr{P(a,x)}, called @expr{Q(a,x) = 1-P(a,x)} by
 some authors, is computed by the @kbd{I f G} [@code{gammaQ}] command.
 You can think of this as taking the other half of the integral, from
-@cite{x} to infinity.
-
-@ifinfo
-The functions corresponding to the integrals that define @cite{P(a,x)}
-and @cite{Q(a,x)} but without the normalizing @cite{1/gamma(a)}
-factor are called @cite{g(a,x)} and @cite{G(a,x)}, respectively
-(where @cite{g} and @cite{G} represent the lower- and upper-case Greek
+@expr{x} to infinity.
+
+@ifinfo
+The functions corresponding to the integrals that define @expr{P(a,x)}
+and @expr{Q(a,x)} but without the normalizing @expr{1/gamma(a)}
+factor are called @expr{g(a,x)} and @expr{G(a,x)}, respectively
+(where @expr{g} and @expr{G} represent the lower- and upper-case Greek
 letter gamma).  You can obtain these using the @kbd{H f G} [@code{gammag}]
 and @kbd{H I f G} [@code{gammaG}] commands.
 @end ifinfo
@@ -18344,10 +18512,11 @@
 @tindex beta
 The @kbd{f b} (@code{calc-beta}) [@code{beta}] command computes the
 Euler beta function, which is defined in terms of the gamma function as
-@c{$B(a,b) = \Gamma(a) \Gamma(b) / \Gamma(a+b)$}
-@cite{beta(a,b) = gamma(a) gamma(b) / gamma(a+b)}, or by
-@c{$B(a,b) = \int_0^1 t^{a-1} (1-t)^{b-1} dt$}
-@cite{beta(a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, 1)}.
+@texline @tmath{B(a,b) = \Gamma(a) \Gamma(b) / \Gamma(a+b)},
+@infoline @expr{beta(a,b) = gamma(a) gamma(b) / gamma(a+b)}, 
+or by
+@texline @tmath{B(a,b) = \int_0^1 t^{a-1} (1-t)^{b-1} dt}.
+@infoline @expr{beta(a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, 1)}.
 
 @kindex f B
 @kindex H f B
@@ -18355,9 +18524,9 @@
 @tindex betaI
 @tindex betaB
 The @kbd{f B} (@code{calc-inc-beta}) [@code{betaI}] command computes
-the incomplete beta function @cite{I(x,a,b)}.  It is defined by
-@c{$I(x,a,b) = \left( \int_0^x t^{a-1} (1-t)^{b-1} dt \right) / B(a,b)$}
-@cite{betaI(x,a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, x) / beta(a,b)}.
+the incomplete beta function @expr{I(x,a,b)}.  It is defined by
+@texline @tmath{I(x,a,b) = \left( \int_0^x t^{a-1} (1-t)^{b-1} dt \right) / B(a,b)}.
+@infoline @expr{betaI(x,a,b) = integ(t^(a-1) (1-t)^(b-1), t, 0, x) / beta(a,b)}.
 Once again, the @kbd{H} (hyperbolic) prefix gives the corresponding
 un-normalized version [@code{betaB}].
 
@@ -18367,12 +18536,13 @@
 @tindex erf
 @tindex erfc
 The @kbd{f e} (@code{calc-erf}) [@code{erf}] command computes the
-error function @c{$\hbox{erf}(x) = {2 \over \sqrt{\pi}} \int_0^x e^{-t^2} dt$}
-@cite{erf(x) = 2 integ(exp(-(t^2)), t, 0, x) / sqrt(pi)}.
+error function 
+@texline @tmath{\hbox{erf}(x) = {2 \over \sqrt{\pi}} \int_0^x e^{-t^2} dt}.
+@infoline @expr{erf(x) = 2 integ(exp(-(t^2)), t, 0, x) / sqrt(pi)}.
 The complementary error function @kbd{I f e} (@code{calc-erfc}) [@code{erfc}]
 is the corresponding integral from @samp{x} to infinity; the sum
-@c{$\hbox{erf}(x) + \hbox{erfc}(x) = 1$}
-@cite{erf(x) + erfc(x) = 1}.
+@texline @tmath{\hbox{erf}(x) + \hbox{erfc}(x) = 1}.
+@infoline @expr{erf(x) + erfc(x) = 1}.
 
 @kindex f j
 @kindex f y
@@ -18384,10 +18554,10 @@
 (@code{calc-bessel-Y}) [@code{besY}] commands compute the Bessel
 functions of the first and second kinds, respectively.
 In @samp{besJ(n,x)} and @samp{besY(n,x)} the ``order'' parameter
-@cite{n} is often an integer, but is not required to be one.
+@expr{n} is often an integer, but is not required to be one.
 Calc's implementation of the Bessel functions currently limits the
 precision to 8 digits, and may not be exact even to that precision.
-Use with care!@refill
+Use with care!
 
 @node Branch Cuts, Random Numbers, Advanced Math Functions, Scientific Functions
 @section Branch Cuts and Principal Values
@@ -18420,9 +18590,9 @@
 efficiency or accuracy.  You may need to increase the floating precision
 and wait a while to get suitable answers from them.
 
-For @samp{sqrt(a+bi)}:  When @cite{a<0} and @cite{b} is small but positive
-or zero, the result is close to the @cite{+i} axis.  For @cite{b} small and
-negative, the result is close to the @cite{-i} axis.  The result always lies
+For @samp{sqrt(a+bi)}:  When @expr{a<0} and @expr{b} is small but positive
+or zero, the result is close to the @expr{+i} axis.  For @expr{b} small and
+negative, the result is close to the @expr{-i} axis.  The result always lies
 in the right half of the complex plane.
 
 For @samp{ln(a+bi)}:  The real part is defined as @samp{ln(abs(a+bi))}.
@@ -18431,8 +18601,8 @@
 negative real axis.
 
 The following table describes these branch cuts in another way.
-If the real and imaginary parts of @cite{z} are as shown, then
-the real and imaginary parts of @cite{f(z)} will be as shown.
+If the real and imaginary parts of @expr{z} are as shown, then
+the real and imaginary parts of @expr{f(z)} will be as shown.
 Here @code{eps} stands for a small positive value; each
 occurrence of @code{eps} may stand for a different small value.
 
@@ -18448,8 +18618,8 @@
 For @samp{z1^z2}:  This is defined by @samp{exp(ln(z1)*z2)}.
 One interesting consequence of this is that @samp{(-8)^1:3} does
 not evaluate to @i{-2} as you might expect, but to the complex
-number @cite{(1., 1.732)}.  Both of these are valid cube roots
-of @i{-8} (as is @cite{(1., -1.732)}); Calc chooses a perhaps
+number @expr{(1., 1.732)}.  Both of these are valid cube roots
+of @i{-8} (as is @expr{(1., -1.732)}); Calc chooses a perhaps
 less-obvious root for the sake of mathematical consistency.
 
 For @samp{arcsin(z)}:  This is defined by @samp{-i*ln(i*z + sqrt(1-z^2))}.
@@ -18461,11 +18631,11 @@
 
 For @samp{arctan(z)}:  This is defined by
 @samp{(ln(1+i*z) - ln(1-i*z)) / (2*i)}.  The branch cuts are on the
-imaginary axis, below @cite{-i} and above @cite{i}.
+imaginary axis, below @expr{-i} and above @expr{i}.
 
 For @samp{arcsinh(z)}:  This is defined by @samp{ln(z + sqrt(1+z^2))}.
-The branch cuts are on the imaginary axis, below @cite{-i} and
-above @cite{i}.
+The branch cuts are on the imaginary axis, below @expr{-i} and
+above @expr{i}.
 
 For @samp{arccosh(z)}:  This is defined by
 @samp{ln(z + (z+1)*sqrt((z-1)/(z+1)))}.  The branch cut is on the
@@ -18543,38 +18713,47 @@
 The @kbd{k r} (@code{calc-random}) [@code{random}] command produces
 random numbers of various sorts.
 
-Given a positive numeric prefix argument @cite{M}, it produces a random
-integer @cite{N} in the range @c{$0 \le N < M$}
-@cite{0 <= N < M}.  Each of the @cite{M}
-values appears with equal probability.@refill
+Given a positive numeric prefix argument @expr{M}, it produces a random
+integer @expr{N} in the range 
+@texline @tmath{0 \le N < M}.
+@infoline @expr{0 <= N < M}.  
+Each of the @expr{M} values appears with equal probability.
 
 With no numeric prefix argument, the @kbd{k r} command takes its argument
-from the stack instead.  Once again, if this is a positive integer @cite{M}
-the result is a random integer less than @cite{M}.  However, note that
-while numeric prefix arguments are limited to six digits or so, an @cite{M}
-taken from the stack can be arbitrarily large.  If @cite{M} is negative,
-the result is a random integer in the range @c{$M < N \le 0$}
-@cite{M < N <= 0}.
-
-If the value on the stack is a floating-point number @cite{M}, the result
-is a random floating-point number @cite{N} in the range @c{$0 \le N < M$}
-@cite{0 <= N < M}
-or @c{$M < N \le 0$}
-@cite{M < N <= 0}, according to the sign of @cite{M}.
-
-If @cite{M} is zero, the result is a Gaussian-distributed random real
+from the stack instead.  Once again, if this is a positive integer @expr{M}
+the result is a random integer less than @expr{M}.  However, note that
+while numeric prefix arguments are limited to six digits or so, an @expr{M}
+taken from the stack can be arbitrarily large.  If @expr{M} is negative,
+the result is a random integer in the range 
+@texline @tmath{M < N \le 0}.
+@infoline @expr{M < N <= 0}.
+
+If the value on the stack is a floating-point number @expr{M}, the result
+is a random floating-point number @expr{N} in the range 
+@texline @tmath{0 \le N < M}
+@infoline @expr{0 <= N < M}
+or 
+@texline @tmath{M < N \le 0},
+@infoline @expr{M < N <= 0}, 
+according to the sign of @expr{M}.
+
+If @expr{M} is zero, the result is a Gaussian-distributed random real
 number; the distribution has a mean of zero and a standard deviation
 of one.  The algorithm used generates random numbers in pairs; thus,
 every other call to this function will be especially fast.
 
-If @cite{M} is an error form @c{$m$ @code{+/-} $\sigma$}
-@samp{m +/- s} where @var{m}
-and @c{$\sigma$}
-@var{s} are both real numbers, the result uses a Gaussian
-distribution with mean @var{m} and standard deviation @c{$\sigma$}
+If @expr{M} is an error form 
+@texline @tmath{m} @code{+/-} @tmath{\sigma}
+@infoline @samp{m +/- s} 
+where @var{m} and 
+@texline @tmath{\sigma}
+@infoline @var{s} 
+are both real numbers, the result uses a Gaussian distribution with mean
+@var{m} and standard deviation 
+@texline @tmath{\sigma}.
 @var{s}.
 
-If @cite{M} is an interval form, the lower and upper bounds specify the
+If @expr{M} is an interval form, the lower and upper bounds specify the
 acceptable limits of the random numbers.  If both bounds are integers,
 the result is a random integer in the specified range.  If either bound
 is floating-point, the result is a random real number in the specified
@@ -18586,7 +18765,7 @@
 additionally return 2.00000, but the probability of this happening is
 extremely small.)
 
-If @cite{M} is a vector, the result is one element taken at random from
+If @expr{M} is a vector, the result is one element taken at random from
 the vector.  All elements of the vector are given equal probabilities.
 
 @vindex RandSeed
@@ -18609,9 +18788,9 @@
 @kindex k a
 @pindex calc-random-again
 The @kbd{k a} (@code{calc-random-again}) command produces another random
-number, re-using the most recent value of @cite{M}.  With a numeric
+number, re-using the most recent value of @expr{M}.  With a numeric
 prefix argument @var{n}, it produces @var{n} more random numbers using
-that value of @cite{M}.
+that value of @expr{M}.
 
 @kindex k h
 @pindex calc-shuffle
@@ -18619,12 +18798,12 @@
 The @kbd{k h} (@code{calc-shuffle}) command produces a vector of several
 random values with no duplicates.  The value on the top of the stack
 specifies the set from which the random values are drawn, and may be any
-of the @cite{M} formats described above.  The numeric prefix argument
+of the @expr{M} formats described above.  The numeric prefix argument
 gives the length of the desired list.  (If you do not provide a numeric
 prefix argument, the length of the list is taken from the top of the
-stack, and @cite{M} from second-to-top.)
-
-If @cite{M} is a floating-point number, zero, or an error form (so
+stack, and @expr{M} from second-to-top.)
+
+If @expr{M} is a floating-point number, zero, or an error form (so
 that the random values are being drawn from the set of real numbers)
 there is little practical difference between using @kbd{k h} and using
 @kbd{k r} several times.  But if the set of possible values consists
@@ -18632,8 +18811,8 @@
 a very real chance that multiple @kbd{k r}'s will produce the same
 number more than once.  The @kbd{k h} command produces a vector whose
 elements are always distinct.  (Actually, there is a slight exception:
-If @cite{M} is a vector, no given vector element will be drawn more
-than once, but if several elements of @cite{M} are equal, they may
+If @expr{M} is a vector, no given vector element will be drawn more
+than once, but if several elements of @expr{M} are equal, they may
 each make it into the result vector.)
 
 One use of @kbd{k h} is to rearrange a list at random.  This happens
@@ -18641,12 +18820,12 @@
 @kbd{[1, 1.5, 2, 2.5, 3] 5 k h} might produce the permuted list
 @samp{[2.5, 1, 1.5, 3, 2]}.  As a convenient feature, if the argument
 @var{n} is negative it is replaced by the size of the set represented
-by @cite{M}.  Naturally, this is allowed only when @cite{M} specifies
+by @expr{M}.  Naturally, this is allowed only when @expr{M} specifies
 a small discrete set of possibilities.
 
 To do the equivalent of @kbd{k h} but with duplications allowed,
-given @cite{M} on the stack and with @var{n} just entered as a numeric
-prefix, use @kbd{v b} to build a vector of copies of @cite{M}, then use
+given @expr{M} on the stack and with @var{n} just entered as a numeric
+prefix, use @kbd{v b} to build a vector of copies of @expr{M}, then use
 @kbd{V M k r} to ``map'' the normal @kbd{k r} function over the
 elements of this vector.  @xref{Matrix Functions}.
 
@@ -18683,10 +18862,12 @@
 
 If @code{RandSeed} contains an integer, Calc uses this integer to
 seed an ``additive congruential'' method (Knuth's algorithm 3.2.2A,
-computing @c{$X_{n-55} - X_{n-24}$}
-@cite{X_n-55 - X_n-24}).  This method expands the seed
+computing 
+@texline @tmath{X_{n-55} - X_{n-24}}.
+@infoline @expr{X_n-55 - X_n-24}).  
+This method expands the seed
 value into a large table which is maintained internally; the variable
-@code{RandSeed} is changed from, e.g., 42 to the vector @cite{[42]}
+@code{RandSeed} is changed from, e.g., 42 to the vector @expr{[42]}
 to indicate that the seed has been absorbed into this table.  When
 @code{RandSeed} contains a vector, @kbd{k r} and related commands
 continue to use the same internal table as last time.  There is no
@@ -18718,16 +18899,21 @@
 
 To create a random floating-point number with precision @var{p}, Calc
 simply creates a random @var{p}-digit integer and multiplies by
-@c{$10^{-p}$}
-@cite{10^-p}.  The resulting random numbers should be very clean, but note
+@texline @tmath{10^{-p}}.
+@infoline @expr{10^-p}.  
+The resulting random numbers should be very clean, but note
 that relatively small numbers will have few significant random digits.
 In other words, with a precision of 12, you will occasionally get
-numbers on the order of @c{$10^{-9}$}
-@cite{10^-9} or @c{$10^{-10}$}
-@cite{10^-10}, but those numbers
-will only have two or three random digits since they correspond to small
-integers times @c{$10^{-12}$}
-@cite{10^-12}.
+numbers on the order of 
+@texline @tmath{10^{-9}}
+@infoline @expr{10^-9} 
+or 
+@texline @tmath{10^{-10}},
+@infoline @expr{10^-10}, 
+but those numbers will only have two or three random digits since they
+correspond to small integers times 
+@texline @tmath{10^{-12}}.
+@infoline @expr{10^-12}.
 
 To create a random integer in the interval @samp{[0 .. @var{m})}, Calc
 counts the digits in @var{m}, creates a random integer with three
@@ -18761,7 +18947,7 @@
 numerators, and the LCM of the denominators.  This definition is
 consistent with the idea that @samp{a / gcd(a,x)} should yield an
 integer for any @samp{a} and @samp{x}.  For other types of arguments,
-the operation is left in symbolic form.@refill
+the operation is left in symbolic form.
 
 @kindex k l
 @pindex calc-lcm
@@ -18769,15 +18955,16 @@
 The @kbd{k l} (@code{calc-lcm}) [@code{lcm}] command computes the
 Least Common Multiple of two integers or fractions.  The product of
 the LCM and GCD of two numbers is equal to the product of the
-numbers.@refill
+numbers.
 
 @kindex k E
 @pindex calc-extended-gcd
 @tindex egcd
 The @kbd{k E} (@code{calc-extended-gcd}) [@code{egcd}] command computes
-the GCD of two integers @cite{x} and @cite{y} and returns a vector
-@cite{[g, a, b]} where @c{$g = \gcd(x,y) = a x + b y$}
-@cite{g = gcd(x,y) = a x + b y}.
+the GCD of two integers @expr{x} and @expr{y} and returns a vector
+@expr{[g, a, b]} where 
+@texline @tmath{g = \gcd(x,y) = a x + b y}.
+@infoline @expr{g = gcd(x,y) = a x + b y}.
 
 @kindex !
 @pindex calc-factorial
@@ -18794,7 +18981,7 @@
 as defined by the Euler Gamma function.  Please note that computation of
 large factorials can be slow; using floating-point format will help
 since fewer digits must be maintained.  The same is true of many of
-the commands in this section.@refill
+the commands in this section.
 
 @kindex k d
 @pindex calc-double-factorial
@@ -18805,29 +18992,30 @@
 @tindex !!
 The @kbd{k d} (@code{calc-double-factorial}) [@code{dfact}] command
 computes the ``double factorial'' of an integer.  For an even integer,
-this is the product of even integers from 2 to @cite{N}.  For an odd
-integer, this is the product of odd integers from 3 to @cite{N}.  If
+this is the product of even integers from 2 to @expr{N}.  For an odd
+integer, this is the product of odd integers from 3 to @expr{N}.  If
 the argument is an integer-valued float, the result is a floating-point
 approximation.  This function is undefined for negative even integers.
-The notation @cite{N!!} is also recognized for double factorials.@refill
+The notation @expr{N!!} is also recognized for double factorials.
 
 @kindex k c
 @pindex calc-choose
 @tindex choose
 The @kbd{k c} (@code{calc-choose}) [@code{choose}] command computes the
-binomial coefficient @cite{N}-choose-@cite{M}, where @cite{M} is the number
-on the top of the stack and @cite{N} is second-to-top.  If both arguments
+binomial coefficient @expr{N}-choose-@expr{M}, where @expr{M} is the number
+on the top of the stack and @expr{N} is second-to-top.  If both arguments
 are integers, the result is an exact integer.  Otherwise, the result is a
 floating-point approximation.  The binomial coefficient is defined for all
-real numbers by @c{$N! \over M! (N-M)!\,$}
-@cite{N! / M! (N-M)!}.
+real numbers by
+@texline @tmath{N! \over M! (N-M)!\,}.
+@infoline @expr{N! / M! (N-M)!}.
 
 @kindex H k c
 @pindex calc-perm
 @tindex perm
 @ifinfo
 The @kbd{H k c} (@code{calc-perm}) [@code{perm}] command computes the
-number-of-permutations function @cite{N! / (N-M)!}.
+number-of-permutations function @expr{N! / (N-M)!}.
 @end ifinfo
 @tex
 The \kbd{H k c} (\code{calc-perm}) [\code{perm}] command computes the
@@ -18840,11 +19028,11 @@
 @tindex bern
 The @kbd{k b} (@code{calc-bernoulli-number}) [@code{bern}] command
 computes a given Bernoulli number.  The value at the top of the stack
-is a nonnegative integer @cite{n} that specifies which Bernoulli number
+is a nonnegative integer @expr{n} that specifies which Bernoulli number
 is desired.  The @kbd{H k b} command computes a Bernoulli polynomial,
-taking @cite{n} from the second-to-top position and @cite{x} from the
-top of the stack.  If @cite{x} is a variable or formula the result is
-a polynomial in @cite{x}; if @cite{x} is a number the result is a number.
+taking @expr{n} from the second-to-top position and @expr{x} from the
+top of the stack.  If @expr{x} is a variable or formula the result is
+a polynomial in @expr{x}; if @expr{x} is a number the result is a number.
 
 @kindex k e
 @kindex H k e
@@ -18861,13 +19049,15 @@
 @tindex stir1
 @tindex stir2
 The @kbd{k s} (@code{calc-stirling-number}) [@code{stir1}] command
-computes a Stirling number of the first kind@c{ $n \brack m$}
-@asis{}, given two integers
-@cite{n} and @cite{m} on the stack.  The @kbd{H k s} [@code{stir2}]
-command computes a Stirling number of the second kind@c{ $n \brace m$}
-@asis{}.  These are
-the number of @cite{m}-cycle permutations of @cite{n} objects, and
-the number of ways to partition @cite{n} objects into @cite{m}
+computes a Stirling number of the first 
+@texline kind@tie{}@tmath{n \brack m},
+@infoline kind,
+given two integers @expr{n} and @expr{m} on the stack.  The @kbd{H k s}
+[@code{stir2}] command computes a Stirling number of the second 
+@texline kind@tie{}@tmath{n \brace m}.
+@infoline kind.
+These are the number of @expr{m}-cycle permutations of @expr{n} objects,
+and the number of ways to partition @expr{n} objects into @expr{m}
 non-empty sets, respectively.
 
 @kindex k p
@@ -18895,7 +19085,7 @@
 test.  Pressing @kbd{k p} repeatedly for the same integer will perform
 additional iterations.  Also, @kbd{k p} with a numeric prefix performs
 the specified number of iterations.  There is also an algebraic function
-@samp{prime(n)} or @samp{prime(n,iters)} which returns 1 if @cite{n}
+@samp{prime(n)} or @samp{prime(n,iters)} which returns 1 if @expr{n}
 is (probably) prime and 0 if not.
 
 @kindex k f
@@ -18942,17 +19132,20 @@
 @pindex calc-totient
 @tindex totient
 The @kbd{k t} (@code{calc-totient}) [@code{totient}] command computes the
-Euler ``totient'' function@c{ $\phi(n)$}
-@asis{}, the number of integers less than @cite{n} which
-are relatively prime to @cite{n}.
+Euler ``totient'' 
+@texline function@tie{}@tmath{\phi(n)},
+@infoline function,
+the number of integers less than @expr{n} which
+are relatively prime to @expr{n}.
 
 @kindex k m
 @pindex calc-moebius
 @tindex moebius
 The @kbd{k m} (@code{calc-moebius}) [@code{moebius}] command computes the
-@c{M\"obius $\mu$}
-@asis{Moebius ``mu''} function.  If the input number is a product of @cite{k}
-distinct factors, this is @cite{(-1)^k}.  If the input number has any
+@texline M@"obius @tmath{\mu}
+@infoline Moebius ``mu''
+function.  If the input number is a product of @expr{k}
+distinct factors, this is @expr{(-1)^k}.  If the input number has any
 duplicate factors (i.e., can be divided by the same prime more than once),
 the result is zero.
 
@@ -18962,14 +19155,14 @@
 @noindent
 The functions in this section compute various probability distributions.
 For continuous distributions, this is the integral of the probability
-density function from @cite{x} to infinity.  (These are the ``upper
+density function from @expr{x} to infinity.  (These are the ``upper
 tail'' distribution functions; there are also corresponding ``lower
-tail'' functions which integrate from minus infinity to @cite{x}.)
+tail'' functions which integrate from minus infinity to @expr{x}.)
 For discrete distributions, the upper tail function gives the sum
-from @cite{x} to infinity; the lower tail function gives the sum
-from minus infinity up to, but not including,@w{ }@cite{x}.
-
-To integrate from @cite{x} to @cite{y}, just use the distribution
+from @expr{x} to infinity; the lower tail function gives the sum
+from minus infinity up to, but not including,@w{ }@expr{x}.
+
+To integrate from @expr{x} to @expr{y}, just use the distribution
 function twice and subtract.  For example, the probability that a
 Gaussian random variable with mean 2 and standard deviation 1 will
 lie in the range from 2.5 to 2.8 is @samp{utpn(2.5,2,1) - utpn(2.8,2,1)}
@@ -18999,7 +19192,7 @@
 arguments as found on the stack.  (The random variable comes last on
 the stack, so that you can type, e.g., @kbd{2 @key{RET} 1 @key{RET} 2.5
 k N M-@key{RET} @key{DEL} 2.8 k N -}, using @kbd{M-@key{RET} @key{DEL}} to
-recover the original arguments but substitute a new value for @cite{x}.)
+recover the original arguments but substitute a new value for @expr{x}.)
 
 @kindex k C
 @pindex calc-utpc
@@ -19013,9 +19206,10 @@
 @end ignore
 @tindex ltpc
 The @samp{utpc(x,v)} function uses the chi-square distribution with
-@c{$\nu$}
-@cite{v} degrees of freedom.  It is the probability that a model is
-correct if its chi-square statistic is @cite{x}.
+@texline @tmath{\nu}
+@infoline @expr{v} 
+degrees of freedom.  It is the probability that a model is
+correct if its chi-square statistic is @expr{x}.
 
 @kindex k F
 @pindex calc-utpf
@@ -19029,11 +19223,14 @@
 @end ignore
 @tindex ltpf
 The @samp{utpf(F,v1,v2)} function uses the F distribution, used in
-various statistical tests.  The parameters @c{$\nu_1$}
-@cite{v1} and @c{$\nu_2$}
-@cite{v2}
+various statistical tests.  The parameters 
+@texline @tmath{\nu_1}
+@infoline @expr{v1} 
+and 
+@texline @tmath{\nu_2}
+@infoline @expr{v2}
 are the degrees of freedom in the numerator and denominator,
-respectively, used in computing the statistic @cite{F}.
+respectively, used in computing the statistic @expr{F}.
 
 @kindex k N
 @pindex calc-utpn
@@ -19047,10 +19244,11 @@
 @end ignore
 @tindex ltpn
 The @samp{utpn(x,m,s)} function uses a normal (Gaussian) distribution
-with mean @cite{m} and standard deviation @c{$\sigma$}
-@cite{s}.  It is the
-probability that such a normal-distributed random variable would
-exceed @cite{x}.
+with mean @expr{m} and standard deviation 
+@texline @tmath{\sigma}.
+@infoline @expr{s}.  
+It is the probability that such a normal-distributed random variable
+would exceed @expr{x}.
 
 @kindex k P
 @pindex calc-utpp
@@ -19064,7 +19262,7 @@
 @end ignore
 @tindex ltpp
 The @samp{utpp(n,x)} function uses a Poisson distribution with
-mean @cite{x}.  It is the probability that @cite{n} or more such
+mean @expr{x}.  It is the probability that @expr{n} or more such
 Poisson random events will occur.
 
 @kindex k T
@@ -19079,16 +19277,22 @@
 @end ignore
 @tindex ltpt
 The @samp{utpt(t,v)} function uses the Student's ``t'' distribution
-with @c{$\nu$}
-@cite{v} degrees of freedom.  It is the probability that a
-t-distributed random variable will be greater than @cite{t}.
-(Note:  This computes the distribution function @c{$A(t|\nu)$}
-@cite{A(t|v)}
-where @c{$A(0|\nu) = 1$}
-@cite{A(0|v) = 1} and @c{$A(\infty|\nu) \to 0$}
-@cite{A(inf|v) -> 0}.  The
-@code{UTPT} operation on the HP-48 uses a different definition
-which returns half of Calc's value:  @samp{UTPT(t,v) = .5*utpt(t,v)}.)
+with 
+@texline @tmath{\nu}
+@infoline @expr{v} 
+degrees of freedom.  It is the probability that a
+t-distributed random variable will be greater than @expr{t}.
+(Note:  This computes the distribution function 
+@texline @tmath{A(t|\nu)}
+@infoline @expr{A(t|v)}
+where 
+@texline @tmath{A(0|\nu) = 1}
+@infoline @expr{A(0|v) = 1} 
+and 
+@texline @tmath{A(\infty|\nu) \to 0}.
+@infoline @expr{A(inf|v) -> 0}.  
+The @code{UTPT} operation on the HP-48 uses a different definition which
+returns half of Calc's value:  @samp{UTPT(t,v) = .5*utpt(t,v)}.)
 
 While Calc does not provide inverses of the probability distribution
 functions, the @kbd{a R} command can be used to solve for the inverse.
@@ -19155,7 +19359,7 @@
 @item -1
 Two values are collected to build a complex number.  For example,
 @kbd{5 @key{RET} 7 C-u -1 v p} creates the complex number
-@cite{(5, 7)}.  The result is always a rectangular complex
+@expr{(5, 7)}.  The result is always a rectangular complex
 number.  The two input values must both be real numbers,
 i.e., integers, fractions, or floats.  If they are not, Calc
 will instead build a formula like @samp{a + (0, 1) b}.  (The
@@ -19245,8 +19449,9 @@
 If any elements of the vector are negative, other kinds of
 packing are done at that level as described above.  For
 example, @samp{[2, 3, -4]} takes 12 objects and creates a
-@c{$2\times3$}
-@asis{2x3} matrix of error forms: @samp{[[a +/- b, c +/- d ... ]]}.
+@texline @tmath{2\times3}
+@infoline 2x3
+matrix of error forms: @samp{[[a +/- b, c +/- d ... ]]}.
 Also, @samp{[-4, -10]} will convert four integers into an
 error form consisting of two fractions:  @samp{a:b +/- c:d}.
 
@@ -19346,7 +19551,7 @@
 
 @noindent
 Vectors and matrices can be added,
-subtracted, multiplied, and divided; @pxref{Basic Arithmetic}.@refill
+subtracted, multiplied, and divided; @pxref{Basic Arithmetic}.
 
 @kindex |
 @pindex calc-concat
@@ -19392,11 +19597,12 @@
 the stack is a scalar, it is used for each element on the diagonal, and
 the prefix argument is required.
 
-To build a constant square matrix, e.g., a @c{$3\times3$}
-@asis{3x3} matrix filled with ones,
-use @kbd{0 M-3 v d 1 +}, i.e., build a zero matrix first and then add a
-constant value to that matrix.  (Another alternative would be to use
-@kbd{v b} and @kbd{v a}; see below.)
+To build a constant square matrix, e.g., a 
+@texline @tmath{3\times3}
+@infoline 3x3
+matrix filled with ones, use @kbd{0 M-3 v d 1 +}, i.e., build a zero
+matrix first and then add a constant value to that matrix.  (Another
+alternative would be to use @kbd{v b} and @kbd{v a}; see below.)
 
 @kindex v i
 @pindex calc-ident
@@ -19407,8 +19613,8 @@
 this command prompts for one.
 
 In algebraic notation, @samp{idn(a,n)} acts much like @samp{diag(a,n)},
-except that @cite{a} is required to be a scalar (non-vector) quantity.
-If @cite{n} is omitted, @samp{idn(a)} represents @cite{a} times an
+except that @expr{a} is required to be a scalar (non-vector) quantity.
+If @expr{n} is omitted, @samp{idn(a)} represents @expr{a} times an
 identity matrix of unknown size.  Calc can operate algebraically on
 such generic identity matrices, and if one is combined with a matrix
 whose size is known, it is converted automatically to an identity
@@ -19531,10 +19737,10 @@
 @tindex _
 Subscript notation in algebraic formulas (@samp{a_b}) stands for the
 Calc function @code{subscr}, which is synonymous with @code{mrow}.
-Thus, @samp{[x, y, z]_k} produces @cite{x}, @cite{y}, or @cite{z} if
-@cite{k} is one, two, or three, respectively.  A double subscript
+Thus, @samp{[x, y, z]_k} produces @expr{x}, @expr{y}, or @expr{z} if
+@expr{k} is one, two, or three, respectively.  A double subscript
 (@samp{M_i_j}, equivalent to @samp{subscr(subscr(M, i), j)}) will
-access the element at row @cite{i}, column @cite{j} of a matrix.
+access the element at row @expr{i}, column @expr{j} of a matrix.
 The @kbd{a _} (@code{calc-subscript}) command creates a subscript
 formula @samp{a_b} out of two stack entries.  (It is on the @kbd{a}
 ``algebra'' prefix because subscripted variables are often used
@@ -19561,13 +19767,13 @@
 it extracts (or removes) one element, just like @kbd{v r}.  If the
 index in @kbd{C-u v c} is an interval or vector and the argument is a
 matrix, the result is a submatrix with only the specified columns
-retained (and possibly permuted in the case of a vector index).@refill
+retained (and possibly permuted in the case of a vector index).
 
 To extract a matrix element at a given row and column, use @kbd{v r} to
 extract the row as a vector, then @kbd{v c} to extract the column element
 from that vector.  In algebraic formulas, it is often more convenient to
-use subscript notation:  @samp{m_i_j} gives row @cite{i}, column @cite{j}
-of matrix @cite{m}.
+use subscript notation:  @samp{m_i_j} gives row @expr{i}, column @expr{j}
+of matrix @expr{m}.
 
 @kindex v s
 @pindex calc-subvector
@@ -19610,15 +19816,17 @@
 The @kbd{v l} (@code{calc-vlength}) [@code{vlen}] command computes the
 length of a vector.  The length of a non-vector is considered to be zero.
 Note that matrices are just vectors of vectors for the purposes of this
-command.@refill
+command.
 
 @kindex H v l
 @tindex mdims
 With the Hyperbolic flag, @kbd{H v l} [@code{mdims}] computes a vector
 of the dimensions of a vector, matrix, or higher-order object.  For
 example, @samp{mdims([[a,b,c],[d,e,f]])} returns @samp{[2, 3]} since
-its argument is a @c{$2\times3$}
-@asis{2x3} matrix.
+its argument is a 
+@texline @tmath{2\times3}
+@infoline 2x3
+matrix.
 
 @kindex v f
 @pindex calc-vector-find
@@ -19647,14 +19855,18 @@
 in the vector, the last row will be short and the result will not be
 suitable for use as a matrix.  For example, with the matrix
 @samp{[[1, 2], @w{[3, 4]}]} on the stack, @kbd{v a 4} produces
-@samp{[[1, 2, 3, 4]]} (a @c{$1\times4$}
-@asis{1x4} matrix), @kbd{v a 1} produces
-@samp{[[1], [2], [3], [4]]} (a @c{$4\times1$}
-@asis{4x1} matrix), @kbd{v a 2} produces
-@samp{[[1, 2], [3, 4]]} (the original @c{$2\times2$}
-@asis{2x2} matrix), @w{@kbd{v a 3}} produces
-@samp{[[1, 2, 3], [4]]} (not a matrix), and @kbd{v a 0} produces
-the flattened list @samp{[1, 2, @w{3, 4}]}.
+@samp{[[1, 2, 3, 4]]} (a 
+@texline @tmath{1\times4}
+@infoline 1x4
+matrix), @kbd{v a 1} produces @samp{[[1], [2], [3], [4]]} (a 
+@texline @tmath{4\times1}
+@infoline 4x1
+matrix), @kbd{v a 2} produces @samp{[[1, 2], [3, 4]]} (the original 
+@texline @tmath{2\times2}
+@infoline 2x2
+matrix), @w{@kbd{v a 3}} produces @samp{[[1, 2, 3], [4]]} (not a
+matrix), and @kbd{v a 0} produces the flattened list 
+@samp{[1, 2, @w{3, 4}]}.
 
 @cindex Sorting data
 @kindex V S
@@ -19810,7 +20022,7 @@
 The following functions are applied element-wise if their arguments are
 vectors or matrices: @code{change-sign}, @code{conj}, @code{arg},
 @code{re}, @code{im}, @code{polar}, @code{rect}, @code{clean},
-@code{float}, @code{frac}.  @xref{Function Index}.@refill
+@code{float}, @code{frac}.  @xref{Function Index}.
 
 @kindex V J
 @pindex calc-conj-transpose
@@ -19832,7 +20044,7 @@
 root of the sum of the squares of the absolute values of the
 elements of the vector or matrix.  If the vector is interpreted as
 a point in two- or three-dimensional space, this is the distance
-from that point to the origin.@refill
+from that point to the origin.
 
 @kindex v n
 @pindex calc-rnorm
@@ -19851,7 +20063,7 @@
 the column norm, or one-norm, of a vector or matrix.  For a plain
 vector, this is the sum of the absolute values of the elements.
 For a matrix, this is the maximum of the column-absolute-value-sums.
-General @cite{k}-norms for @cite{k} other than one or infinity are
+General @expr{k}-norms for @expr{k} other than one or infinity are
 not provided.
 
 @kindex V C
@@ -19877,8 +20089,8 @@
 computed, the inverse and determinant of the matrix can be recomputed
 quickly in the future.
 
-If the argument to @kbd{&} is a plain number @cite{x}, this
-command simply computes @cite{1/x}.  This is okay, because the
+If the argument to @kbd{&} is a plain number @expr{x}, this
+command simply computes @expr{1/x}.  This is okay, because the
 @samp{/} operator also does a matrix inversion when dividing one
 by a matrix.
 
@@ -19936,8 +20148,8 @@
 single interval, the interval itself is returned instead.
 
 @xref{Logical Operations}, for the @code{in} function which tests if
-a certain value is a member of a given set.  To test if the set @cite{A}
-is a subset of the set @cite{B}, use @samp{vdiff(A, B) = []}.
+a certain value is a member of a given set.  To test if the set @expr{A}
+is a subset of the set @expr{B}, use @samp{vdiff(A, B) = []}.
 
 @kindex V +
 @pindex calc-remove-duplicates
@@ -19969,20 +20181,23 @@
 sets are disjoint, i.e., if they share no common elements, the result
 will be the empty vector @samp{[]}.  Note that the characters @kbd{V}
 and @kbd{^} were chosen to be close to the conventional mathematical
-notation for set union@c{ ($A \cup B$)}
-@asis{} and intersection@c{ ($A \cap B$)}
-@asis{}.
+notation for set 
+@texline union@tie{}(@tmath{A \cup B})
+@infoline union
+and 
+@texline intersection@tie{}(@tmath{A \cap B}).
+@infoline intersection.
 
 @kindex V -
 @pindex calc-set-difference
 @tindex vdiff
 The @kbd{V -} (@code{calc-set-difference}) [@code{vdiff}] command computes
 the difference between two sets.  An object is in the difference
-@cite{A - B} if and only if it is in @cite{A} but not in @cite{B}.
+@expr{A - B} if and only if it is in @expr{A} but not in @expr{B}.
 Thus subtracting @samp{[y,z]} from a set will remove the elements
 @samp{y} and @samp{z} if they are present.  You can also think of this
-as a general @dfn{set complement} operator; if @cite{A} is the set of
-all possible values, then @cite{A - B} is the ``complement'' of @cite{B}.
+as a general @dfn{set complement} operator; if @expr{A} is the set of
+all possible values, then @expr{A - B} is the ``complement'' of @expr{B}.
 Obviously this is only practical if the set of all possible values in
 your problem is small enough to list in a Calc vector (or simple
 enough to express in a few intervals).
@@ -20078,8 +20293,9 @@
 not include any negative numbers.  The input is interpreted as a
 set of integers in the sense of @kbd{V F} (@code{vfloor}).  Beware
 that a simple input like @samp{[100]} can result in a huge integer
-representation (@c{$2^{100}$}
-@cite{2^100}, a 31-digit integer, in this case).
+representation 
+@texline (@tmath{2^{100}}, a 31-digit integer, in this case).
+@infoline (@expr{2^100}, a 31-digit integer, in this case).
 
 @node Statistical Operations, Reducing and Mapping, Set Operations, Matrix Functions
 @section Statistical Operations on Vectors
@@ -20167,7 +20383,7 @@
 (@code{calc-vector-prod}) [@code{vprod}] command computes the
 product of the data values.  If the input is a single flat vector,
 these are the same as @kbd{V R +} and @kbd{V R *}
-(@pxref{Reducing and Mapping}).@refill
+(@pxref{Reducing and Mapping}).
 
 @kindex u X
 @kindex u N
@@ -20189,21 +20405,25 @@
 @cindex Mean of data values
 The @kbd{u M} (@code{calc-vector-mean}) [@code{vmean}] command
 computes the average (arithmetic mean) of the data values.
-If the inputs are error forms @c{$x$ @code{+/-} $\sigma$}
-@samp{x +/- s}, this is the weighted
-mean of the @cite{x} values with weights @c{$1 / \sigma^2$}
-@cite{1 / s^2}.
+If the inputs are error forms 
+@texline @tmath{x \pm \sigma},
+@infoline @samp{x +/- s}, 
+this is the weighted mean of the @expr{x} values with weights 
+@texline @tmath{1 /\sigma^2}.
+@infoline @expr{1 / s^2}.
 @tex
 \turnoffactive
 $$ \mu = { \displaystyle \sum { x_i \over \sigma_i^2 } \over
            \displaystyle \sum { 1 \over \sigma_i^2 } } $$
 @end tex
 If the inputs are not error forms, this is simply the sum of the
-values divided by the count of the values.@refill
+values divided by the count of the values.
 
 Note that a plain number can be considered an error form with
-error @c{$\sigma = 0$}
-@cite{s = 0}.  If the input to @kbd{u M} is a mixture of
+error 
+@texline @tmath{\sigma = 0}.
+@infoline @expr{s = 0}.  
+If the input to @kbd{u M} is a mixture of
 plain numbers and error forms, the result is the mean of the
 plain numbers, ignoring all values with non-zero errors.  (By the
 above definitions it's clear that a plain number effectively
@@ -20212,7 +20432,7 @@
 
 This function also works for distributions (error forms or
 intervals).  The mean of an error form `@var{a} @t{+/-} @var{b}' is simply
-@cite{a}.  The mean of an interval is the mean of the minimum
+@expr{a}.  The mean of an interval is the mean of the minimum
 and maximum values of the interval.
 
 @kindex I u M
@@ -20234,7 +20454,7 @@
 divided by the square root of the number of values.  (This works
 out to be equivalent to calculating the standard deviation and
 then assuming each value's error is equal to this standard
-deviation.)@refill
+deviation.)
 @tex
 \turnoffactive
 $$ \sigma_\mu^2 = {\sigma^2 \over N} $$
@@ -20309,13 +20529,14 @@
 @cindex Standard deviation
 @cindex Sample statistics
 The @kbd{u S} (@code{calc-vector-sdev}) [@code{vsdev}] command
-computes the standard deviation@c{ $\sigma$}
-@asis{} of the data values.  If the
-values are error forms, the errors are used as weights just
-as for @kbd{u M}.  This is the @emph{sample} standard deviation,
-whose value is the square root of the sum of the squares of the
-differences between the values and the mean of the @cite{N} values,
-divided by @cite{N-1}.
+computes the standard 
+@texline deviation@tie{}@tmath{\sigma}
+@infoline deviation
+of the data values.  If the values are error forms, the errors are used
+as weights just as for @kbd{u M}.  This is the @emph{sample} standard
+deviation, whose value is the square root of the sum of the squares of
+the differences between the values and the mean of the @expr{N} values,
+divided by @expr{N-1}.
 @tex
 \turnoffactive
 $$ \sigma^2 = {1 \over N - 1} \sum (x_i - \mu)^2 $$
@@ -20324,10 +20545,11 @@
 This function also applies to distributions.  The standard deviation
 of a single error form is simply the error part.  The standard deviation
 of a continuous interval happens to equal the difference between the
-limits, divided by @c{$\sqrt{12}$}
-@cite{sqrt(12)}.  The standard deviation of an
-integer interval is the same as the standard deviation of a vector
-of those integers.
+limits, divided by 
+@texline @tmath{\sqrt{12}}.
+@infoline @expr{sqrt(12)}.  
+The standard deviation of an integer interval is the same as the
+standard deviation of a vector of those integers.
 
 @kindex I u S
 @pindex calc-vector-pop-sdev
@@ -20336,7 +20558,7 @@
 The @kbd{I u S} (@code{calc-vector-pop-sdev}) [@code{vpsdev}]
 command computes the @emph{population} standard deviation.
 It is defined by the same formula as above but dividing
-by @cite{N} instead of by @cite{N-1}.  The population standard
+by @expr{N} instead of by @expr{N-1}.  The population standard
 deviation is used when the input represents the entire set of
 data values in the distribution; the sample standard deviation
 is used when the input represents a sample of the set of all
@@ -20361,8 +20583,10 @@
 The @kbd{H u S} (@code{calc-vector-variance}) [@code{vvar}] and
 @kbd{H I u S} (@code{calc-vector-pop-variance}) [@code{vpvar}]
 commands compute the variance of the data values.  The variance
-is the square@c{ $\sigma^2$}
-@asis{} of the standard deviation, i.e., the sum of the
+is the 
+@texline square@tie{}@tmath{\sigma^2}
+@infoline square
+of the standard deviation, i.e., the sum of the
 squares of the deviations of the data values from the mean.
 (This definition also applies when the argument is a distribution.)
 
@@ -20383,10 +20607,11 @@
 vectors of equal size.  The vectors are each flattened in the same
 way as by the single-variable statistical functions.  Given a numeric
 prefix argument of 1, these functions instead take one object from
-the stack, which must be an @c{$N\times2$}
-@asis{Nx2} matrix of data values.  Once
-again, variable names can be used in place of actual vectors and
-matrices.
+the stack, which must be an 
+@texline @tmath{N\times2}
+@infoline Nx2
+matrix of data values.  Once again, variable names can be used in place
+of actual vectors and matrices.
 
 @kindex u C
 @pindex calc-vector-covariance
@@ -20397,7 +20622,7 @@
 of vectors @var{x} and @var{y} is the sum of the products of the
 differences between the elements of @var{x} and the mean of @var{x}
 times the differences between the corresponding elements of @var{y}
-and the mean of @var{y}, all divided by @cite{N-1}.  Note that
+and the mean of @var{y}, all divided by @expr{N-1}.  Note that
 the variance of a vector is just the covariance of the vector
 with itself.  Once again, if the inputs are error forms the
 errors are used as weight factors.  If both @var{x} and @var{y}
@@ -20419,8 +20644,8 @@
 @tindex vpcov
 The @kbd{I u C} (@code{calc-vector-pop-covariance}) [@code{vpcov}]
 command computes the population covariance, which is the same as the
-sample covariance computed by @kbd{u C} except dividing by @cite{N}
-instead of @cite{N-1}.
+sample covariance computed by @kbd{u C} except dividing by @expr{N}
+instead of @expr{N-1}.
 
 @kindex H u C
 @pindex calc-vector-correlation
@@ -20598,7 +20823,7 @@
 or a nameless function like @samp{<#^3+1>}.  Operators that are normally
 written as algebraic symbols have the names @code{add}, @code{sub},
 @code{mul}, @code{div}, @code{pow}, @code{neg}, @code{mod}, and
-@code{vconcat}.@refill
+@code{vconcat}.
 
 @ignore
 @starindex
@@ -20635,24 +20860,26 @@
 With the 2 listed first, it would have computed a vector of powers of
 two.  Mapping a user-defined function pops as many arguments from the
 stack as the function requires.  If you give an undefined name, you will
-be prompted for the number of arguments to use.@refill
+be prompted for the number of arguments to use.
 
 If any argument to @kbd{V M} is a matrix, the operator is normally mapped
 across all elements of the matrix.  For example, given the matrix
-@cite{[[1, -2, 3], [-4, 5, -6]]}, @kbd{V M A} takes six absolute values to
-produce another @c{$3\times2$}
-@asis{3x2} matrix, @cite{[[1, 2, 3], [4, 5, 6]]}.
+@expr{[[1, -2, 3], [-4, 5, -6]]}, @kbd{V M A} takes six absolute values to
+produce another 
+@texline @tmath{3\times2}
+@infoline 3x2
+matrix, @expr{[[1, 2, 3], [4, 5, 6]]}.
 
 @tindex mapr
 The command @kbd{V M _} [@code{mapr}] (i.e., type an underscore at the
 operator prompt) maps by rows instead.  For example, @kbd{V M _ A} views
 the above matrix as a vector of two 3-element row vectors.  It produces
 a new vector which contains the absolute values of those row vectors,
-namely @cite{[3.74, 8.77]}.  (Recall, the absolute value of a vector is
+namely @expr{[3.74, 8.77]}.  (Recall, the absolute value of a vector is
 defined as the square root of the sum of the squares of the elements.)
 Some operators accept vectors and return new vectors; for example,
 @kbd{v v} reverses a vector, so @kbd{V M _ v v} would reverse each row
-of the matrix to get a new matrix, @cite{[[3, -2, 1], [-6, 5, -4]]}.
+of the matrix to get a new matrix, @expr{[[3, -2, 1], [-6, 5, -4]]}.
 
 Sometimes a vector of vectors (representing, say, strings, sets, or lists)
 happens to look like a matrix.  If so, remember to use @kbd{V M _} if you
@@ -20665,7 +20892,7 @@
 matrix, transposes again.  For example, @kbd{V M : A} takes the absolute
 values of the three columns of the matrix, treating each as a 2-vector,
 and @kbd{V M : v v} reverses the columns to get the matrix
-@cite{[[-4, 5, -6], [1, -2, 3]]}.
+@expr{[[-4, 5, -6], [1, -2, 3]]}.
 
 (The symbols @kbd{_} and @kbd{:} were chosen because they had row-like
 and column-like appearances, and were not already taken by useful
@@ -20756,13 +20983,13 @@
 @tindex reduced
 @tindex rreduced
 As for @kbd{V M}, @kbd{V R} normally reduces a matrix elementwise.  For
-example, given the matrix @cite{[[a, b, c], [d, e, f]]}, @kbd{V R +} will
-compute @cite{a + b + c + d + e + f}.  You can type @kbd{V R _} or
+example, given the matrix @expr{[[a, b, c], [d, e, f]]}, @kbd{V R +} will
+compute @expr{a + b + c + d + e + f}.  You can type @kbd{V R _} or
 @kbd{V R :} to modify this behavior.  The @kbd{V R _} [@code{reducea}]
 command reduces ``across'' the matrix; it reduces each row of the matrix
 as a vector, then collects the results.  Thus @kbd{V R _ +} of this
-matrix would produce @cite{[a + b + c, d + e + f]}.  Similarly, @kbd{V R :}
-[@code{reduced}] reduces down; @kbd{V R : +} would produce @cite{[a + d,
+matrix would produce @expr{[a + b + c, d + e + f]}.  Similarly, @kbd{V R :}
+[@code{reduced}] reduces down; @kbd{V R : +} would produce @expr{[a + d,
 b + e, c + f]}.
 
 @tindex reducer
@@ -20919,7 +21146,7 @@
 The commands @kbd{v <} (@code{calc-matrix-left-justify}), @kbd{v >}
 (@code{calc-matrix-right-justify}), and @w{@kbd{v =}}
 (@code{calc-matrix-center-justify}) control whether matrix elements
-are justified to the left, right, or center of their columns.@refill
+are justified to the left, right, or center of their columns.
 
 @kindex V [
 @pindex calc-vector-brackets
@@ -20936,7 +21163,7 @@
 Mathematica.  (In fact, the Mathematica language mode uses this mode;
 @pxref{Mathematica Language Mode}.)  Note that, regardless of the
 display mode, either brackets or braces may be used to enter vectors,
-and parentheses may never be used for this purpose.@refill
+and parentheses may never be used for this purpose.
 
 @kindex V ]
 @pindex calc-matrix-brackets
@@ -20989,7 +21216,7 @@
 @kindex V ,
 @pindex calc-vector-commas
 The @kbd{v ,} (@code{calc-vector-commas}) command turns commas on and
-off in vector and matrix display.@refill
+off in vector and matrix display.
 
 In vectors of length one, and in all vectors when commas have been
 turned off, Calc adds extra parentheses around formulas that might
@@ -21047,7 +21274,7 @@
 for anything else'') prefix.
 
 @xref{Editing Stack Entries}, to see how to manipulate formulas
-using regular Emacs editing commands.@refill
+using regular Emacs editing commands.
 
 When doing algebraic work, you may find several of the Calculator's
 modes to be helpful, including algebraic-simplification mode (@kbd{m A})
@@ -21055,7 +21282,7 @@
 algebraic-entry mode (@kbd{m a}), fraction mode (@kbd{m f}), and
 symbolic mode (@kbd{m s}).  @xref{Mode Settings}, for discussions
 of these modes.  You may also wish to select ``big'' display mode (@kbd{d B}).
-@xref{Normal Language Modes}.@refill
+@xref{Normal Language Modes}.
 
 @menu
 * Selecting Subformulas::
@@ -21213,7 +21440,7 @@
 behavior of some commands such as @kbd{j r} (@code{calc-rewrite-selection};
 @pxref{Selections with Rewrite Rules}) and is mainly intended to be
 used in keyboard macros that implement your own selection-oriented
-commands.@refill
+commands.
 
 Selection of sub-formulas normally treats associative terms like
 @samp{a + b - c + d} and @samp{x * y * z} as single levels of the formula.
@@ -21311,7 +21538,7 @@
 the @var{n}th top-level sub-formula.  (In other words, they act as if
 the entire stack entry were selected first.)  To select the @var{n}th
 sub-formula where @var{n} is greater than nine, you must instead invoke
-@w{@kbd{j 1}} with @var{n} as a numeric prefix argument.@refill
+@w{@kbd{j 1}} with @var{n} as a numeric prefix argument.
 
 @kindex j n
 @kindex j p
@@ -21493,7 +21720,7 @@
 Operations on sub-formulas sometimes leave the formula as a whole
 in an ``un-natural'' state.  Consider negating the @samp{2 x} term
 of our sample formula by selecting it and pressing @kbd{n}
-(@code{calc-change-sign}).@refill
+(@code{calc-change-sign}).
 
 @smallexample
 @group
@@ -21850,7 +22077,7 @@
 to @kbd{V M}, which operates on vectors instead of equations.
 @pxref{Reducing and Mapping}.  For example, @kbd{a M S} changes
 @samp{x = y+1} to @samp{sin(x) = sin(y+1)}, and @kbd{a M +} with
-@samp{x = y+1} and @cite{6} on the stack produces @samp{x+6 = y+7}.
+@samp{x = y+1} and @expr{6} on the stack produces @samp{x+6 = y+7}.
 With two equations on the stack, @kbd{a M +} would add the lefthand
 sides together and the righthand sides together to get the two
 respective sides of a new equation.
@@ -21899,7 +22126,7 @@
 Note that this is a purely structural substitution; the lone @samp{x} and
 the @samp{sin(2 x)} stayed the same because they did not look like
 @samp{sin(x)}.  @xref{Rewrite Rules}, for a more general method for
-doing substitutions.@refill
+doing substitutions.
 
 The @kbd{a b} command normally prompts for two formulas, the old
 one and the new one.  If you enter a blank line for the first
@@ -21966,26 +22193,27 @@
 @cindex Default simplifications
 This section describes the ``default simplifications,'' those which are
 normally applied to all results.  For example, if you enter the variable
-@cite{x} on the stack twice and push @kbd{+}, Calc's default
-simplifications automatically change @cite{x + x} to @cite{2 x}.
+@expr{x} on the stack twice and push @kbd{+}, Calc's default
+simplifications automatically change @expr{x + x} to @expr{2 x}.
 
 The @kbd{m O} command turns off the default simplifications, so that
-@cite{x + x} will remain in this form unless you give an explicit
+@expr{x + x} will remain in this form unless you give an explicit
 ``simplify'' command like @kbd{=} or @kbd{a v}.  @xref{Algebraic
 Manipulation}.  The @kbd{m D} command turns the default simplifications
 back on.
 
 The most basic default simplification is the evaluation of functions.
-For example, @cite{2 + 3} is evaluated to @cite{5}, and @cite{@t{sqrt}(9)}
-is evaluated to @cite{3}.  Evaluation does not occur if the arguments
-to a function are somehow of the wrong type (@cite{@t{tan}([2,3,4])}),
-range (@cite{@t{tan}(90)}), or number (@cite{@t{tan}(3,5)}), or if the
-function name is not recognized (@cite{@t{f}(5)}), or if ``symbolic''
-mode (@pxref{Symbolic Mode}) prevents evaluation (@cite{@t{sqrt}(2)}).
+For example, @expr{2 + 3} is evaluated to @expr{5}, and @expr{@t{sqrt}(9)}
+is evaluated to @expr{3}.  Evaluation does not occur if the arguments
+to a function are somehow of the wrong type @expr{@t{tan}([2,3,4])}),
+range (@expr{@t{tan}(90)}), or number (@expr{@t{tan}(3,5)}), 
+or if the function name is not recognized (@expr{@t{f}(5)}), or if
+``symbolic'' mode (@pxref{Symbolic Mode}) prevents evaluation
+(@expr{@t{sqrt}(2)}).
 
 Calc simplifies (evaluates) the arguments to a function before it
-simplifies the function itself.  Thus @cite{@t{sqrt}(5+4)} is
-simplified to @cite{@t{sqrt}(9)} before the @code{sqrt} function
+simplifies the function itself.  Thus @expr{@t{sqrt}(5+4)} is
+simplified to @expr{@t{sqrt}(9)} before the @code{sqrt} function
 itself is applied.  There are very few exceptions to this rule:
 @code{quote}, @code{lambda}, and @code{condition} (the @code{::}
 operator) do not evaluate their arguments, @code{if} (the @code{? :}
@@ -22024,9 +22252,9 @@
 Arithmetic operators like @kbd{+} and @kbd{*} always take two
 arguments in Calc's internal form.  Sums and products of three or
 more terms are arranged by the associative law of algebra into
-a left-associative form for sums, @cite{((a + b) + c) + d}, and
-a right-associative form for products, @cite{a * (b * (c * d))}.
-Formulas like @cite{(a + b) + (c + d)} are rearranged to
+a left-associative form for sums, @expr{((a + b) + c) + d}, and
+a right-associative form for products, @expr{a * (b * (c * d))}.
+Formulas like @expr{(a + b) + (c + d)} are rearranged to
 left-associative form, though this rarely matters since Calc's
 algebra commands are designed to hide the inner structure of
 sums and products as much as possible.  Sums and products in
@@ -22034,199 +22262,213 @@
 in the examples below.
 
 Sums and products are @emph{not} rearranged according to the
-commutative law (@cite{a + b} to @cite{b + a}) except in a few
+commutative law (@expr{a + b} to @expr{b + a}) except in a few
 special cases described below.  Some algebra programs always
 rearrange terms into a canonical order, which enables them to
-see that @cite{a b + b a} can be simplified to @cite{2 a b}.
+see that @expr{a b + b a} can be simplified to @expr{2 a b}.
 Calc assumes you have put the terms into the order you want
 and generally leaves that order alone, with the consequence
 that formulas like the above will only be simplified if you
 explicitly give the @kbd{a s} command.  @xref{Algebraic
 Simplifications}.
 
-Differences @cite{a - b} are treated like sums @cite{a + (-b)}
+Differences @expr{a - b} are treated like sums @expr{a + (-b)}
 for purposes of simplification; one of the default simplifications
-is to rewrite @cite{a + (-b)} or @cite{(-b) + a}, where @cite{-b}
-represents a ``negative-looking'' term, into @cite{a - b} form.
+is to rewrite @expr{a + (-b)} or @expr{(-b) + a}, where @expr{-b}
+represents a ``negative-looking'' term, into @expr{a - b} form.
 ``Negative-looking'' means negative numbers, negated formulas like
-@cite{-x}, and products or quotients in which either term is
+@expr{-x}, and products or quotients in which either term is
 negative-looking.
 
-Other simplifications involving negation are @cite{-(-x)} to @cite{x};
-@cite{-(a b)} or @cite{-(a/b)} where either @cite{a} or @cite{b} is
+Other simplifications involving negation are @expr{-(-x)} to @expr{x};
+@expr{-(a b)} or @expr{-(a/b)} where either @expr{a} or @expr{b} is
 negative-looking, simplified by negating that term, or else where
-@cite{a} or @cite{b} is any number, by negating that number;
-@cite{-(a + b)} to @cite{-a - b}, and @cite{-(b - a)} to @cite{a - b}.
-(This, and rewriting @cite{(-b) + a} to @cite{a - b}, are the only
+@expr{a} or @expr{b} is any number, by negating that number;
+@expr{-(a + b)} to @expr{-a - b}, and @expr{-(b - a)} to @expr{a - b}.
+(This, and rewriting @expr{(-b) + a} to @expr{a - b}, are the only
 cases where the order of terms in a sum is changed by the default
 simplifications.)
 
 The distributive law is used to simplify sums in some cases:
-@cite{a x + b x} to @cite{(a + b) x}, where @cite{a} represents
-a number or an implicit 1 or @i{-1} (as in @cite{x} or @cite{-x})
-and similarly for @cite{b}.  Use the @kbd{a c}, @w{@kbd{a f}}, or
+@expr{a x + b x} to @expr{(a + b) x}, where @expr{a} represents
+a number or an implicit 1 or @i{-1} (as in @expr{x} or @expr{-x})
+and similarly for @expr{b}.  Use the @kbd{a c}, @w{@kbd{a f}}, or
 @kbd{j M} commands to merge sums with non-numeric coefficients
 using the distributive law.
 
 The distributive law is only used for sums of two terms, or
-for adjacent terms in a larger sum.  Thus @cite{a + b + b + c}
-is simplified to @cite{a + 2 b + c}, but @cite{a + b + c + b}
+for adjacent terms in a larger sum.  Thus @expr{a + b + b + c}
+is simplified to @expr{a + 2 b + c}, but @expr{a + b + c + b}
 is not simplified.  The reason is that comparing all terms of a
 sum with one another would require time proportional to the
 square of the number of terms; Calc relegates potentially slow
 operations like this to commands that have to be invoked
 explicitly, like @kbd{a s}.
 
-Finally, @cite{a + 0} and @cite{0 + a} are simplified to @cite{a}.
-A consequence of the above rules is that @cite{0 - a} is simplified
-to @cite{-a}.
+Finally, @expr{a + 0} and @expr{0 + a} are simplified to @expr{a}.
+A consequence of the above rules is that @expr{0 - a} is simplified
+to @expr{-a}.
 
 @tex
 \bigskip
 @end tex
 
-The products @cite{1 a} and @cite{a 1} are simplified to @cite{a};
-@cite{(-1) a} and @cite{a (-1)} are simplified to @cite{-a};
-@cite{0 a} and @cite{a 0} are simplified to @cite{0}, except that
-in matrix mode where @cite{a} is not provably scalar the result
-is the generic zero matrix @samp{idn(0)}, and that if @cite{a} is
+The products @expr{1 a} and @expr{a 1} are simplified to @expr{a};
+@expr{(-1) a} and @expr{a (-1)} are simplified to @expr{-a};
+@expr{0 a} and @expr{a 0} are simplified to @expr{0}, except that
+in matrix mode where @expr{a} is not provably scalar the result
+is the generic zero matrix @samp{idn(0)}, and that if @expr{a} is
 infinite the result is @samp{nan}.
 
-Also, @cite{(-a) b} and @cite{a (-b)} are simplified to @cite{-(a b)},
+Also, @expr{(-a) b} and @expr{a (-b)} are simplified to @expr{-(a b)},
 where this occurs for negated formulas but not for regular negative
 numbers.
 
 Products are commuted only to move numbers to the front:
-@cite{a b 2} is commuted to @cite{2 a b}.
-
-The product @cite{a (b + c)} is distributed over the sum only if
-@cite{a} and at least one of @cite{b} and @cite{c} are numbers:
-@cite{2 (x + 3)} goes to @cite{2 x + 6}.  The formula
-@cite{(-a) (b - c)}, where @cite{-a} is a negative number, is
-rewritten to @cite{a (c - b)}.
+@expr{a b 2} is commuted to @expr{2 a b}.
+
+The product @expr{a (b + c)} is distributed over the sum only if
+@expr{a} and at least one of @expr{b} and @expr{c} are numbers:
+@expr{2 (x + 3)} goes to @expr{2 x + 6}.  The formula
+@expr{(-a) (b - c)}, where @expr{-a} is a negative number, is
+rewritten to @expr{a (c - b)}.
 
 The distributive law of products and powers is used for adjacent
-terms of the product: @cite{x^a x^b} goes to @c{$x^{a+b}$}
-@cite{x^(a+b)}
-where @cite{a} is a number, or an implicit 1 (as in @cite{x}),
-or the implicit one-half of @cite{@t{sqrt}(x)}, and similarly for
-@cite{b}.  The result is written using @samp{sqrt} or @samp{1/sqrt}
-if the sum of the powers is @cite{1/2} or @cite{-1/2}, respectively.
+terms of the product: @expr{x^a x^b} goes to 
+@texline @tmath{x^{a+b}}
+@infoline @expr{x^(a+b)}
+where @expr{a} is a number, or an implicit 1 (as in @expr{x}),
+or the implicit one-half of @expr{@t{sqrt}(x)}, and similarly for
+@expr{b}.  The result is written using @samp{sqrt} or @samp{1/sqrt}
+if the sum of the powers is @expr{1/2} or @expr{-1/2}, respectively.
 If the sum of the powers is zero, the product is simplified to
-@cite{1} or to @samp{idn(1)} if matrix mode is enabled.
+@expr{1} or to @samp{idn(1)} if matrix mode is enabled.
 
 The product of a negative power times anything but another negative
-power is changed to use division:  @c{$x^{-2} y$}
-@cite{x^(-2) y} goes to @cite{y / x^2} unless matrix mode is
-in effect and neither @cite{x} nor @cite{y} are scalar (in which
+power is changed to use division:  
+@texline @tmath{x^{-2} y}
+@infoline @expr{x^(-2) y} 
+goes to @expr{y / x^2} unless matrix mode is
+in effect and neither @expr{x} nor @expr{y} are scalar (in which
 case it is considered unsafe to rearrange the order of the terms).
 
-Finally, @cite{a (b/c)} is rewritten to @cite{(a b)/c}, and also
-@cite{(a/b) c} is changed to @cite{(a c)/b} unless in matrix mode.
+Finally, @expr{a (b/c)} is rewritten to @expr{(a b)/c}, and also
+@expr{(a/b) c} is changed to @expr{(a c)/b} unless in matrix mode.
 
 @tex
 \bigskip
 @end tex
 
 Simplifications for quotients are analogous to those for products.
-The quotient @cite{0 / x} is simplified to @cite{0}, with the same
-exceptions that were noted for @cite{0 x}.  Likewise, @cite{x / 1}
-and @cite{x / (-1)} are simplified to @cite{x} and @cite{-x},
+The quotient @expr{0 / x} is simplified to @expr{0}, with the same
+exceptions that were noted for @expr{0 x}.  Likewise, @expr{x / 1}
+and @expr{x / (-1)} are simplified to @expr{x} and @expr{-x},
 respectively.
 
-The quotient @cite{x / 0} is left unsimplified or changed to an
+The quotient @expr{x / 0} is left unsimplified or changed to an
 infinite quantity, as directed by the current infinite mode.
 @xref{Infinite Mode}.
 
-The expression @c{$a / b^{-c}$}
-@cite{a / b^(-c)} is changed to @cite{a b^c},
-where @cite{-c} is any negative-looking power.  Also, @cite{1 / b^c}
-is changed to @c{$b^{-c}$}
-@cite{b^(-c)} for any power @cite{c}.
-
-Also, @cite{(-a) / b} and @cite{a / (-b)} go to @cite{-(a/b)};
-@cite{(a/b) / c} goes to @cite{a / (b c)}; and @cite{a / (b/c)}
-goes to @cite{(a c) / b} unless matrix mode prevents this
-rearrangement.  Similarly, @cite{a / (b:c)} is simplified to
-@cite{(c:b) a} for any fraction @cite{b:c}.
-
-The distributive law is applied to @cite{(a + b) / c} only if
-@cite{c} and at least one of @cite{a} and @cite{b} are numbers.
+The expression 
+@texline @tmath{a / b^{-c}}
+@infoline @expr{a / b^(-c)} 
+is changed to @expr{a b^c}, where @expr{-c} is any negative-looking
+power.  Also, @expr{1 / b^c} is changed to 
+@texline @tmath{b^{-c}}
+@infoline @expr{b^(-c)} 
+for any power @expr{c}.
+
+Also, @expr{(-a) / b} and @expr{a / (-b)} go to @expr{-(a/b)};
+@expr{(a/b) / c} goes to @expr{a / (b c)}; and @expr{a / (b/c)}
+goes to @expr{(a c) / b} unless matrix mode prevents this
+rearrangement.  Similarly, @expr{a / (b:c)} is simplified to
+@expr{(c:b) a} for any fraction @expr{b:c}.
+
+The distributive law is applied to @expr{(a + b) / c} only if
+@expr{c} and at least one of @expr{a} and @expr{b} are numbers.
 Quotients of powers and square roots are distributed just as
 described for multiplication.
 
 Quotients of products cancel only in the leading terms of the
-numerator and denominator.  In other words, @cite{a x b / a y b}
-is cancelled to @cite{x b / y b} but not to @cite{x / y}.  Once
+numerator and denominator.  In other words, @expr{a x b / a y b}
+is cancelled to @expr{x b / y b} but not to @expr{x / y}.  Once
 again this is because full cancellation can be slow; use @kbd{a s}
 to cancel all terms of the quotient.
 
 Quotients of negative-looking values are simplified according
-to @cite{(-a) / (-b)} to @cite{a / b}, @cite{(-a) / (b - c)}
-to @cite{a / (c - b)}, and @cite{(a - b) / (-c)} to @cite{(b - a) / c}.
+to @expr{(-a) / (-b)} to @expr{a / b}, @expr{(-a) / (b - c)}
+to @expr{a / (c - b)}, and @expr{(a - b) / (-c)} to @expr{(b - a) / c}.
 
 @tex
 \bigskip
 @end tex
 
-The formula @cite{x^0} is simplified to @cite{1}, or to @samp{idn(1)}
-in matrix mode.  The formula @cite{0^x} is simplified to @cite{0}
-unless @cite{x} is a negative number or complex number, in which
+The formula @expr{x^0} is simplified to @expr{1}, or to @samp{idn(1)}
+in matrix mode.  The formula @expr{0^x} is simplified to @expr{0}
+unless @expr{x} is a negative number or complex number, in which
 case the result is an infinity or an unsimplified formula according
-to the current infinite mode.  Note that @cite{0^0} is an
+to the current infinite mode.  Note that @expr{0^0} is an
 indeterminate form, as evidenced by the fact that the simplifications
-for @cite{x^0} and @cite{0^x} conflict when @cite{x=0}.
-
-Powers of products or quotients @cite{(a b)^c}, @cite{(a/b)^c}
-are distributed to @cite{a^c b^c}, @cite{a^c / b^c} only if @cite{c}
-is an integer, or if either @cite{a} or @cite{b} are nonnegative
-real numbers.  Powers of powers @cite{(a^b)^c} are simplified to
-@c{$a^{b c}$}
-@cite{a^(b c)} only when @cite{c} is an integer and @cite{b c} also
+for @expr{x^0} and @expr{0^x} conflict when @expr{x=0}.
+
+Powers of products or quotients @expr{(a b)^c}, @expr{(a/b)^c}
+are distributed to @expr{a^c b^c}, @expr{a^c / b^c} only if @expr{c}
+is an integer, or if either @expr{a} or @expr{b} are nonnegative
+real numbers.  Powers of powers @expr{(a^b)^c} are simplified to
+@texline @tmath{a^{b c}}
+@infoline @expr{a^(b c)} 
+only when @expr{c} is an integer and @expr{b c} also
 evaluates to an integer.  Without these restrictions these simplifications
 would not be safe because of problems with principal values.
-(In other words, @c{$((-3)^{1/2})^2$}
-@cite{((-3)^1:2)^2} is safe to simplify, but
-@c{$((-3)^2)^{1/2}$}
-@cite{((-3)^2)^1:2} is not.)  @xref{Declarations}, for ways to inform
-Calc that your variables satisfy these requirements.
-
-As a special case of this rule, @cite{@t{sqrt}(x)^n} is simplified to
-@c{$x^{n/2}$}
-@cite{x^(n/2)} only for even integers @cite{n}.
-
-If @cite{a} is known to be real, @cite{b} is an even integer, and
-@cite{c} is a half- or quarter-integer, then @cite{(a^b)^c} is
-simplified to @c{$@t{abs}(a^{b c})$}
-@cite{@t{abs}(a^(b c))}.
-
-Also, @cite{(-a)^b} is simplified to @cite{a^b} if @cite{b} is an
-even integer, or to @cite{-(a^b)} if @cite{b} is an odd integer,
-for any negative-looking expression @cite{-a}.
-
-Square roots @cite{@t{sqrt}(x)} generally act like one-half powers
-@c{$x^{1:2}$}
-@cite{x^1:2} for the purposes of the above-listed simplifications.
-
-Also, note that @c{$1 / x^{1:2}$}
-@cite{1 / x^1:2} is changed to @c{$x^{-1:2}$}
-@cite{x^(-1:2)},
-but @cite{1 / @t{sqrt}(x)} is left alone.
+(In other words, 
+@texline @tmath{((-3)^{1/2})^2}
+@infoline @expr{((-3)^1:2)^2} 
+is safe to simplify, but
+@texline @tmath{((-3)^2)^{1/2}}
+@infoline @expr{((-3)^2)^1:2} 
+is not.)  @xref{Declarations}, for ways to inform Calc that your
+variables satisfy these requirements.
+
+As a special case of this rule, @expr{@t{sqrt}(x)^n} is simplified to
+@texline @tmath{x^{n/2}}
+@infoline @expr{x^(n/2)} 
+only for even integers @expr{n}.
+
+If @expr{a} is known to be real, @expr{b} is an even integer, and
+@expr{c} is a half- or quarter-integer, then @expr{(a^b)^c} is
+simplified to @expr{@t{abs}(a^(b c))}.
+
+Also, @expr{(-a)^b} is simplified to @expr{a^b} if @expr{b} is an
+even integer, or to @expr{-(a^b)} if @expr{b} is an odd integer,
+for any negative-looking expression @expr{-a}.
+
+Square roots @expr{@t{sqrt}(x)} generally act like one-half powers
+@texline @tmath{x^{1:2}}
+@infoline @expr{x^1:2} 
+for the purposes of the above-listed simplifications.
+
+Also, note that 
+@texline @tmath{1 / x^{1:2}}
+@infoline @expr{1 / x^1:2} 
+is changed to 
+@texline @tmath{x^{-1:2}},
+@infoline @expr{x^(-1:2)},
+but @expr{1 / @t{sqrt}(x)} is left alone.
 
 @tex
 \bigskip
 @end tex
 
 Generic identity matrices (@pxref{Matrix Mode}) are simplified by the
-following rules:  @cite{@t{idn}(a) + b} to @cite{a + b} if @cite{b}
-is provably scalar, or expanded out if @cite{b} is a matrix;
-@cite{@t{idn}(a) + @t{idn}(b)} to @cite{@t{idn}(a + b)};
-@cite{-@t{idn}(a)} to @cite{@t{idn}(-a)}; @cite{a @t{idn}(b)} to
-@cite{@t{idn}(a b)} if @cite{a} is provably scalar, or to @cite{a b}
-if @cite{a} is provably non-scalar; @cite{@t{idn}(a) @t{idn}(b)}
-to @cite{@t{idn}(a b)}; analogous simplifications for quotients
-involving @code{idn}; and @cite{@t{idn}(a)^n} to @cite{@t{idn}(a^n)}
-where @cite{n} is an integer.
+following rules:  @expr{@t{idn}(a) + b} to @expr{a + b} if @expr{b}
+is provably scalar, or expanded out if @expr{b} is a matrix;
+@expr{@t{idn}(a) + @t{idn}(b)} to @expr{@t{idn}(a + b)}; 
+@expr{-@t{idn}(a)} to @expr{@t{idn}(-a)}; @expr{a @t{idn}(b)} to 
+@expr{@t{idn}(a b)} if @expr{a} is provably scalar, or to @expr{a b} 
+if @expr{a} is provably non-scalar;  @expr{@t{idn}(a) @t{idn}(b)} to
+@expr{@t{idn}(a b)}; analogous simplifications for quotients involving
+@code{idn}; and @expr{@t{idn}(a)^n} to @expr{@t{idn}(a^n)} where
+@expr{n} is an integer.
 
 @tex
 \bigskip
@@ -22234,26 +22476,28 @@
 
 The @code{floor} function and other integer truncation functions
 vanish if the argument is provably integer-valued, so that
-@cite{@t{floor}(@t{round}(x))} simplifies to @cite{@t{round}(x)}.
+@expr{@t{floor}(@t{round}(x))} simplifies to @expr{@t{round}(x)}.
 Also, combinations of @code{float}, @code{floor} and its friends,
 and @code{ffloor} and its friends, are simplified in appropriate
 ways.  @xref{Integer Truncation}.
 
-The expression @cite{@t{abs}(-x)} changes to @cite{@t{abs}(x)}.
-The expression @cite{@t{abs}(@t{abs}(x))} changes to @cite{@t{abs}(x)};
-in fact, @cite{@t{abs}(x)} changes to @cite{x} or @cite{-x} if @cite{x}
-is provably nonnegative or nonpositive (@pxref{Declarations}).
+The expression @expr{@t{abs}(-x)} changes to @expr{@t{abs}(x)}.
+The expression @expr{@t{abs}(@t{abs}(x))} changes to
+@expr{@t{abs}(x)};  in fact, @expr{@t{abs}(x)} changes to @expr{x} or
+@expr{-x} if @expr{x} is provably nonnegative or nonpositive
+(@pxref{Declarations}). 
 
 While most functions do not recognize the variable @code{i} as an
 imaginary number, the @code{arg} function does handle the two cases
-@cite{@t{arg}(@t{i})} and @cite{@t{arg}(-@t{i})} just for convenience.
-
-The expression @cite{@t{conj}(@t{conj}(x))} simplifies to @cite{x}.
+@expr{@t{arg}(@t{i})} and @expr{@t{arg}(-@t{i})} just for convenience.
+
+The expression @expr{@t{conj}(@t{conj}(x))} simplifies to @expr{x}.
 Various other expressions involving @code{conj}, @code{re}, and
 @code{im} are simplified, especially if some of the arguments are
 provably real or involve the constant @code{i}.  For example,
-@cite{@t{conj}(a + b i)} is changed to @cite{@t{conj}(a) - @t{conj}(b) i},
-or to @cite{a - b i} if @cite{a} and @cite{b} are known to be real.
+@expr{@t{conj}(a + b i)} is changed to 
+@expr{@t{conj}(a) - @t{conj}(b) i},  or to @expr{a - b i} if @expr{a}
+and @expr{b} are known to be real.
 
 Functions like @code{sin} and @code{arctan} generally don't have
 any default simplifications beyond simply evaluating the functions
@@ -22261,18 +22505,18 @@
 described in the next section does provide some simplifications for
 these functions, though.
 
-One important simplification that does occur is that @cite{@t{ln}(@t{e})}
-is simplified to 1, and @cite{@t{ln}(@t{e}^x)} is simplified to @cite{x}
-for any @cite{x}.  This occurs even if you have stored a different
-value in the Calc variable @samp{e}; but this would be a bad idea
-in any case if you were also using natural logarithms!
+One important simplification that does occur is that
+@expr{@t{ln}(@t{e})} is simplified to 1, and @expr{@t{ln}(@t{e}^x)} is
+simplified to @expr{x} for any @expr{x}.  This occurs even if you have
+stored a different value in the Calc variable @samp{e}; but this would
+be a bad idea in any case if you were also using natural logarithms!
 
 Among the logical functions, @t{(@var{a} <= @var{b})} changes to
 @t{@var{a} > @var{b}} and so on.  Equations and inequalities where both sides
 are either negative-looking or zero are simplified by negating both sides
 and reversing the inequality.  While it might seem reasonable to simplify
-@cite{!!x} to @cite{x}, this would not be valid in general because
-@cite{!!2} is 1, not 2.
+@expr{!!x} to @expr{x}, this would not be valid in general because
+@expr{!!2} is 1, not 2.
 
 Most other Calc functions have few if any default simplifications
 defined, aside of course from evaluation when the arguments are
@@ -22309,13 +22553,13 @@
 @end tex
 
 Sums are simplified in two ways.  Constant terms are commuted to the
-end of the sum, so that @cite{a + 2 + b} changes to @cite{a + b + 2}.
+end of the sum, so that @expr{a + 2 + b} changes to @expr{a + b + 2}.
 The only exception is that a constant will not be commuted away
-from the first position of a difference, i.e., @cite{2 - x} is not
-commuted to @cite{-x + 2}.
+from the first position of a difference, i.e., @expr{2 - x} is not
+commuted to @expr{-x + 2}.
 
 Also, terms of sums are combined by the distributive law, as in
-@cite{x + y + 2 x} to @cite{y + 3 x}.  This always occurs for
+@expr{x + y + 2 x} to @expr{y + 3 x}.  This always occurs for
 adjacent terms, but @kbd{a s} compares all pairs of terms including
 non-adjacent ones.
 
@@ -22324,10 +22568,10 @@
 @end tex
 
 Products are sorted into a canonical order using the commutative
-law.  For example, @cite{b c a} is commuted to @cite{a b c}.
+law.  For example, @expr{b c a} is commuted to @expr{a b c}.
 This allows easier comparison of products; for example, the default
-simplifications will not change @cite{x y + y x} to @cite{2 x y},
-but @kbd{a s} will; it first rewrites the sum to @cite{x y + x y},
+simplifications will not change @expr{x y + y x} to @expr{2 x y},
+but @kbd{a s} will; it first rewrites the sum to @expr{x y + x y},
 and then the default simplifications are able to recognize a sum
 of identical terms.
 
@@ -22346,15 +22590,15 @@
 
 Even though sums are not sorted, the commutative law is still
 taken into account when terms of a product are being compared.
-Thus @cite{(x + y) (y + x)} will be simplified to @cite{(x + y)^2}.
-A subtle point is that @cite{(x - y) (y - x)} will @emph{not}
-be simplified to @cite{-(x - y)^2}; Calc does not notice that
+Thus @expr{(x + y) (y + x)} will be simplified to @expr{(x + y)^2}.
+A subtle point is that @expr{(x - y) (y - x)} will @emph{not}
+be simplified to @expr{-(x - y)^2}; Calc does not notice that
 one term can be written as a constant times the other, even if
 that constant is @i{-1}.
 
-A fraction times any expression, @cite{(a:b) x}, is changed to
-a quotient involving integers:  @cite{a x / b}.  This is not
-done for floating-point numbers like @cite{0.5}, however.  This
+A fraction times any expression, @expr{(a:b) x}, is changed to
+a quotient involving integers:  @expr{a x / b}.  This is not
+done for floating-point numbers like @expr{0.5}, however.  This
 is one reason why you may find it convenient to turn Fraction mode
 on while doing algebra; @pxref{Fraction Mode}.
 
@@ -22364,25 +22608,25 @@
 
 Quotients are simplified by comparing all terms in the numerator
 with all terms in the denominator for possible cancellation using
-the distributive law.  For example, @cite{a x^2 b / c x^3 d} will
-cancel @cite{x^2} from both sides to get @cite{a b / c x d}.
-(The terms in the denominator will then be rearranged to @cite{c d x}
+the distributive law.  For example, @expr{a x^2 b / c x^3 d} will
+cancel @expr{x^2} from both sides to get @expr{a b / c x d}.
+(The terms in the denominator will then be rearranged to @expr{c d x}
 as described above.)  If there is any common integer or fractional
 factor in the numerator and denominator, it is cancelled out;
-for example, @cite{(4 x + 6) / 8 x} simplifies to @cite{(2 x + 3) / 4 x}.
+for example, @expr{(4 x + 6) / 8 x} simplifies to @expr{(2 x + 3) / 4 x}.
 
 Non-constant common factors are not found even by @kbd{a s}.  To
-cancel the factor @cite{a} in @cite{(a x + a) / a^2} you could first
-use @kbd{j M} on the product @cite{a x} to Merge the numerator to
-@cite{a (1+x)}, which can then be simplified successfully.
+cancel the factor @expr{a} in @expr{(a x + a) / a^2} you could first
+use @kbd{j M} on the product @expr{a x} to Merge the numerator to
+@expr{a (1+x)}, which can then be simplified successfully.
 
 @tex
 \bigskip
 @end tex
 
 Integer powers of the variable @code{i} are simplified according
-to the identity @cite{i^2 = -1}.  If you store a new value other
-than the complex number @cite{(0,1)} in @code{i}, this simplification
+to the identity @expr{i^2 = -1}.  If you store a new value other
+than the complex number @expr{(0,1)} in @code{i}, this simplification
 will no longer occur.  This is done by @kbd{a s} instead of by default
 in case someone (unwisely) uses the name @code{i} for a variable
 unrelated to complex numbers; it would be unfortunate if Calc
@@ -22392,26 +22636,26 @@
 Square roots of integer or rational arguments are simplified in
 several ways.  (Note that these will be left unevaluated only in
 Symbolic mode.)  First, square integer or rational factors are
-pulled out so that @cite{@t{sqrt}(8)} is rewritten as
-@c{$2\,\t{sqrt}(2)$}
-@cite{2 sqrt(2)}.  Conceptually speaking this implies factoring
-the argument into primes and moving pairs of primes out of the
-square root, but for reasons of efficiency Calc only looks for
-primes up to 29.
+pulled out so that @expr{@t{sqrt}(8)} is rewritten as
+@texline @tmath{$2\,\t{sqrt}(2)$}.
+@infoline @expr{2 sqrt(2)}.  
+Conceptually speaking this implies factoring the argument into primes
+and moving pairs of primes out of the square root, but for reasons of
+efficiency Calc only looks for primes up to 29.
 
 Square roots in the denominator of a quotient are moved to the
-numerator:  @cite{1 / @t{sqrt}(3)} changes to @cite{@t{sqrt}(3) / 3}.
+numerator:  @expr{1 / @t{sqrt}(3)} changes to @expr{@t{sqrt}(3) / 3}.
 The same effect occurs for the square root of a fraction:
-@cite{@t{sqrt}(2:3)} changes to @cite{@t{sqrt}(6) / 3}.
+@expr{@t{sqrt}(2:3)} changes to @expr{@t{sqrt}(6) / 3}.
 
 @tex
 \bigskip
 @end tex
 
 The @code{%} (modulo) operator is simplified in several ways
-when the modulus @cite{M} is a positive real number.  First, if
-the argument is of the form @cite{x + n} for some real number
-@cite{n}, then @cite{n} is itself reduced modulo @cite{M}.  For
+when the modulus @expr{M} is a positive real number.  First, if
+the argument is of the form @expr{x + n} for some real number
+@expr{n}, then @expr{n} is itself reduced modulo @expr{M}.  For
 example, @samp{(x - 23) % 10} is simplified to @samp{(x + 7) % 10}.
 
 If the argument is multiplied by a constant, and this constant
@@ -22435,16 +22679,16 @@
 @end tex
 
 Trigonometric functions are simplified in several ways.  First,
-@cite{@t{sin}(@t{arcsin}(x))} is simplified to @cite{x}, and
+@expr{@t{sin}(@t{arcsin}(x))} is simplified to @expr{x}, and
 similarly for @code{cos} and @code{tan}.  If the argument to
-@code{sin} is negative-looking, it is simplified to @cite{-@t{sin}(x)},
-and similarly for @code{cos} and @code{tan}.  Finally, certain
-special values of the argument are recognized;
+@code{sin} is negative-looking, it is simplified to 
+@expr{-@t{sin}(x),},  and similarly for @code{cos} and @code{tan}.
+Finally, certain special values of the argument are recognized;
 @pxref{Trigonometric and Hyperbolic Functions}.
 
 Trigonometric functions of inverses of different trigonometric
-functions can also be simplified, as in @cite{@t{sin}(@t{arccos}(x))}
-to @cite{@t{sqrt}(1 - x^2)}.
+functions can also be simplified, as in @expr{@t{sin}(@t{arccos}(x))}
+to @expr{@t{sqrt}(1 - x^2)}.
 
 Hyperbolic functions of their inverses and of negative-looking
 arguments are also handled, as are exponentials of inverse
@@ -22453,26 +22697,31 @@
 No simplifications for inverse trigonometric and hyperbolic
 functions are known, except for negative arguments of @code{arcsin},
 @code{arctan}, @code{arcsinh}, and @code{arctanh}.  Note that
-@cite{@t{arcsin}(@t{sin}(x))} can @emph{not} safely change to
-@cite{x}, since this only correct within an integer multiple
-of @c{$2 \pi$}
-@cite{2 pi} radians or 360 degrees.  However,
-@cite{@t{arcsinh}(@t{sinh}(x))} is simplified to @cite{x} if
-@cite{x} is known to be real.
+@expr{@t{arcsin}(@t{sin}(x))} can @emph{not} safely change to
+@expr{x}, since this only correct within an integer multiple of 
+@texline @tmath{2 \pi}
+@infoline @expr{2 pi} 
+radians or 360 degrees.  However, @expr{@t{arcsinh}(@t{sinh}(x))} is
+simplified to @expr{x} if @expr{x} is known to be real.
 
 Several simplifications that apply to logarithms and exponentials
-are that @cite{@t{exp}(@t{ln}(x))}, @c{$@t{e}^{\ln(x)}$}
-@cite{e^@t{ln}(x)}, and
-@c{$10^{{\rm log10}(x)}$}
-@cite{10^@t{log10}(x)} all reduce to @cite{x}.
-Also, @cite{@t{ln}(@t{exp}(x))}, etc., can reduce to @cite{x} if
-@cite{x} is provably real.  The form @cite{@t{exp}(x)^y} is simplified
-to @cite{@t{exp}(x y)}.  If @cite{x} is a suitable multiple of @c{$\pi i$}
-@cite{pi i}
-(as described above for the trigonometric functions), then @cite{@t{exp}(x)}
-or @cite{e^x} will be expanded.  Finally, @cite{@t{ln}(x)} is simplified
-to a form involving @code{pi} and @code{i} where @cite{x} is provably
-negative, positive imaginary, or negative imaginary.
+are that @expr{@t{exp}(@t{ln}(x))}, 
+@texline @t{e}@tmath{^{\ln(x)}},
+@infoline @expr{e^@t{ln}(x)}, 
+and
+@texline @tmath{10^{{\rm log10}(x)}}
+@infoline @expr{10^@t{log10}(x)} 
+all reduce to @expr{x}.  Also, @expr{@t{ln}(@t{exp}(x))}, etc., can
+reduce to @expr{x} if @expr{x} is provably real.  The form
+@expr{@t{exp}(x)^y} is simplified to @expr{@t{exp}(x y)}.  If @expr{x}
+is a suitable multiple of 
+@texline @tmath{\pi i} 
+@infoline @expr{pi i}
+(as described above for the trigonometric functions), then
+@expr{@t{exp}(x)} or @expr{e^x} will be expanded.  Finally,
+@expr{@t{ln}(x)} is simplified to a form involving @code{pi} and
+@code{i} where @expr{x} is provably negative, positive imaginary, or
+negative imaginary. 
 
 The error functions @code{erf} and @code{erfc} are simplified when
 their arguments are negative-looking or are calls to the @code{conj}
@@ -22485,7 +22734,7 @@
 Equations and inequalities are simplified by cancelling factors
 of products, quotients, or sums on both sides.  Inequalities
 change sign if a negative multiplicative factor is cancelled.
-Non-constant multiplicative factors as in @cite{a b = a c} are
+Non-constant multiplicative factors as in @expr{a b = a c} are
 cancelled from equations only if they are provably nonzero (generally
 because they were declared so; @pxref{Declarations}).  Factors
 are cancelled from inequalities only if they are nonzero and their
@@ -22493,11 +22742,11 @@
 
 Simplification also replaces an equation or inequality with
 1 or 0 (``true'' or ``false'') if it can through the use of
-declarations.  If @cite{x} is declared to be an integer greater
-than 5, then @cite{x < 3}, @cite{x = 3}, and @cite{x = 7.5} are
-all simplified to 0, but @cite{x > 3} is simplified to 1.
-By a similar analysis, @cite{abs(x) >= 0} is simplified to 1,
-as is @cite{x^2 >= 0} if @cite{x} is known to be real.
+declarations.  If @expr{x} is declared to be an integer greater
+than 5, then @expr{x < 3}, @expr{x = 3}, and @expr{x = 7.5} are
+all simplified to 0, but @expr{x > 3} is simplified to 1.
+By a similar analysis, @expr{abs(x) >= 0} is simplified to 1,
+as is @expr{x^2 >= 0} if @expr{x} is known to be real.
 
 @node Unsafe Simplifications, Simplification of Units, Algebraic Simplifications, Simplifying Formulas
 @subsection ``Unsafe'' Simplifications
@@ -22519,8 +22768,8 @@
 are valid.  The symbolic integrator uses @kbd{a e};
 one effect of this is that the integrator's results must be used with
 caution.  Where an integral table will often attach conditions like
-``for positive @cite{a} only,'' Calc (like most other symbolic
-integration programs) will simply produce an unqualified result.@refill
+``for positive @expr{a} only,'' Calc (like most other symbolic
+integration programs) will simply produce an unqualified result.
 
 Because @kbd{a e}'s simplifications are unsafe, it is sometimes better
 to type @kbd{C-u -3 a v}, which does extended simplification only
@@ -22542,45 +22791,49 @@
 
 Inverse trigonometric or hyperbolic functions, called with their
 corresponding non-inverse functions as arguments, are simplified
-by @kbd{a e}.  For example, @cite{@t{arcsin}(@t{sin}(x))} changes
-to @cite{x}.  Also, @cite{@t{arcsin}(@t{cos}(x))} and
-@cite{@t{arccos}(@t{sin}(x))} both change to @cite{@t{pi}/2 - x}.
+by @kbd{a e}.  For example, @expr{@t{arcsin}(@t{sin}(x))} changes
+to @expr{x}.  Also, @expr{@t{arcsin}(@t{cos}(x))} and
+@expr{@t{arccos}(@t{sin}(x))} both change to @expr{@t{pi}/2 - x}.
 These simplifications are unsafe because they are valid only for
-values of @cite{x} in a certain range; outside that range, values
+values of @expr{x} in a certain range; outside that range, values
 are folded down to the 360-degree range that the inverse trigonometric
 functions always produce.
 
-Powers of powers @cite{(x^a)^b} are simplified to @c{$x^{a b}$}
-@cite{x^(a b)}
-for all @cite{a} and @cite{b}.  These results will be valid only
-in a restricted range of @cite{x}; for example, in @c{$(x^2)^{1:2}$}
-@cite{(x^2)^1:2}
-the powers cancel to get @cite{x}, which is valid for positive values
-of @cite{x} but not for negative or complex values.
-
-Similarly, @cite{@t{sqrt}(x^a)} and @cite{@t{sqrt}(x)^a} are both
-simplified (possibly unsafely) to @c{$x^{a/2}$}
-@cite{x^(a/2)}.
-
-Forms like @cite{@t{sqrt}(1 - @t{sin}(x)^2)} are simplified to, e.g.,
-@cite{@t{cos}(x)}.  Calc has identities of this sort for @code{sin},
+Powers of powers @expr{(x^a)^b} are simplified to 
+@texline @tmath{x^{a b}}
+@infoline @expr{x^(a b)}
+for all @expr{a} and @expr{b}.  These results will be valid only
+in a restricted range of @expr{x}; for example, in 
+@texline @tmath{(x^2)^{1:2}}
+@infoline @expr{(x^2)^1:2}
+the powers cancel to get @expr{x}, which is valid for positive values
+of @expr{x} but not for negative or complex values.
+
+Similarly, @expr{@t{sqrt}(x^a)} and @expr{@t{sqrt}(x)^a} are both
+simplified (possibly unsafely) to 
+@texline @tmath{x^{a/2}}.
+@infoline @expr{x^(a/2)}.
+
+Forms like @expr{@t{sqrt}(1 - sin(x)^2)} are simplified to, e.g.,
+@expr{@t{cos}(x)}.  Calc has identities of this sort for @code{sin},
 @code{cos}, @code{tan}, @code{sinh}, and @code{cosh}.
 
 Arguments of square roots are partially factored to look for
 squared terms that can be extracted.  For example,
-@cite{@t{sqrt}(a^2 b^3 + a^3 b^2)} simplifies to @cite{a b @t{sqrt}(a+b)}.
-
-The simplifications of @cite{@t{ln}(@t{exp}(x))}, @cite{@t{ln}(@t{e}^x)},
-and @cite{@t{log10}(10^x)} to @cite{x} are also unsafe because
-of problems with principal values (although these simplifications
-are safe if @cite{x} is known to be real).
+@expr{@t{sqrt}(a^2 b^3 + a^3 b^2)} simplifies to 
+@expr{a b @t{sqrt}(a+b)}.
+
+The simplifications of @expr{@t{ln}(@t{exp}(x))},
+@expr{@t{ln}(@t{e}^x)}, and @expr{@t{log10}(10^x)} to @expr{x} are also
+unsafe because of problems with principal values (although these
+simplifications are safe if @expr{x} is known to be real).
 
 Common factors are cancelled from products on both sides of an
-equation, even if those factors may be zero:  @cite{a x / b x}
-to @cite{a / b}.  Such factors are never cancelled from
+equation, even if those factors may be zero:  @expr{a x / b x}
+to @expr{a / b}.  Such factors are never cancelled from
 inequalities:  Even @kbd{a e} is not bold enough to reduce
-@cite{a x < b x} to @cite{a < b} (or @cite{a > b}, depending
-on whether you believe @cite{x} is positive or negative).
+@expr{a x < b x} to @expr{a < b} (or @expr{a > b}, depending
+on whether you believe @expr{x} is positive or negative).
 The @kbd{a M /} command can be used to divide a factor out of
 both sides of an inequality.
 
@@ -22600,12 +22853,12 @@
 Scalar mode is automatically put into effect when simplifying units.
 @xref{Matrix Mode}.
 
-Sums @cite{a + b} involving units are simplified by extracting the
-units of @cite{a} as if by the @kbd{u x} command (call the result
-@cite{u_a}), then simplifying the expression @cite{b / u_a}
+Sums @expr{a + b} involving units are simplified by extracting the
+units of @expr{a} as if by the @kbd{u x} command (call the result
+@expr{u_a}), then simplifying the expression @expr{b / u_a}
 using @kbd{u b} and @kbd{u s}.  If the result has units then the sum
 is inconsistent and is left alone.  Otherwise, it is rewritten
-in terms of the units @cite{u_a}.
+in terms of the units @expr{u_a}.
 
 If units auto-ranging mode is enabled, products or quotients in
 which the first argument is a number which is out of range for the
@@ -22617,39 +22870,44 @@
 However, compatible but different units like @code{ft} and @code{in}
 are not combined in this way.
 
-Quotients @cite{a / b} are simplified in three additional ways.  First,
-if @cite{b} is a number or a product beginning with a number, Calc
+Quotients @expr{a / b} are simplified in three additional ways.  First,
+if @expr{b} is a number or a product beginning with a number, Calc
 computes the reciprocal of this number and moves it to the numerator.
 
 Second, for each pair of unit names from the numerator and denominator
 of a quotient, if the units are compatible (e.g., they are both
 units of area) then they are replaced by the ratio between those
 units.  For example, in @samp{3 s in N / kg cm} the units
-@samp{in / cm} will be replaced by @cite{2.54}.
+@samp{in / cm} will be replaced by @expr{2.54}.
 
 Third, if the units in the quotient exactly cancel out, so that
 a @kbd{u b} command on the quotient would produce a dimensionless
 number for an answer, then the quotient simplifies to that number.
 
 For powers and square roots, the ``unsafe'' simplifications
-@cite{(a b)^c} to @cite{a^c b^c}, @cite{(a/b)^c} to @cite{a^c / b^c},
-and @cite{(a^b)^c} to @c{$a^{b c}$}
-@cite{a^(b c)} are done if the powers are
-real numbers.  (These are safe in the context of units because
-all numbers involved can reasonably be assumed to be real.)
+@expr{(a b)^c} to @expr{a^c b^c}, @expr{(a/b)^c} to @expr{a^c / b^c},
+and @expr{(a^b)^c} to 
+@texline @tmath{a^{b c}}
+@infoline @expr{a^(b c)} 
+are done if the powers are real numbers.  (These are safe in the context
+of units because all numbers involved can reasonably be assumed to be
+real.)
 
 Also, if a unit name is raised to a fractional power, and the
 base units in that unit name all occur to powers which are a
 multiple of the denominator of the power, then the unit name
 is expanded out into its base units, which can then be simplified
 according to the previous paragraph.  For example, @samp{acre^1.5}
-is simplified by noting that @cite{1.5 = 3:2}, that @samp{acre}
+is simplified by noting that @expr{1.5 = 3:2}, that @samp{acre}
 is defined in terms of @samp{m^2}, and that the 2 in the power of
-@code{m} is a multiple of 2 in @cite{3:2}.  Thus, @code{acre^1.5} is
-replaced by approximately @c{$(4046 m^2)^{1.5}$}
-@cite{(4046 m^2)^1.5}, which is then
-changed to @c{$4046^{1.5} \, (m^2)^{1.5}$}
-@cite{4046^1.5 (m^2)^1.5}, then to @cite{257440 m^3}.
+@code{m} is a multiple of 2 in @expr{3:2}.  Thus, @code{acre^1.5} is
+replaced by approximately 
+@texline @tmath{(4046 m^2)^{1.5}}
+@infoline @expr{(4046 m^2)^1.5}, 
+which is then changed to 
+@texline @tmath{4046^{1.5} \, (m^2)^{1.5}},
+@infoline @expr{4046^1.5 (m^2)^1.5}, 
+then to @expr{257440 m^3}.
 
 The functions @code{float}, @code{frac}, @code{clean}, @code{abs},
 as well as @code{floor} and the other integer truncation functions,
@@ -22667,10 +22925,10 @@
 @section Polynomials
 
 A @dfn{polynomial} is a sum of terms which are coefficients times
-various powers of a ``base'' variable.  For example, @cite{2 x^2 + 3 x - 4}
-is a polynomial in @cite{x}.  Some formulas can be considered
-polynomials in several different variables:  @cite{1 + 2 x + 3 y + 4 x y^2}
-is a polynomial in both @cite{x} and @cite{y}.  Polynomial coefficients
+various powers of a ``base'' variable.  For example, @expr{2 x^2 + 3 x - 4}
+is a polynomial in @expr{x}.  Some formulas can be considered
+polynomials in several different variables:  @expr{1 + 2 x + 3 y + 4 x y^2}
+is a polynomial in both @expr{x} and @expr{y}.  Polynomial coefficients
 are often numbers, but they may in general be any formulas not
 involving the base variable.
 
@@ -22679,9 +22937,9 @@
 @tindex factor
 The @kbd{a f} (@code{calc-factor}) [@code{factor}] command factors a
 polynomial into a product of terms.  For example, the polynomial
-@cite{x^3 + 2 x^2 + x} is factored into @samp{x*(x+1)^2}.  As another
-example, @cite{a c + b d + b c + a d} is factored into the product
-@cite{(a + b) (c + d)}.
+@expr{x^3 + 2 x^2 + x} is factored into @samp{x*(x+1)^2}.  As another
+example, @expr{a c + b d + b c + a d} is factored into the product
+@expr{(a + b) (c + d)}.
 
 Calc currently has three algorithms for factoring.  Formulas which are
 linear in several variables, such as the second example above, are
@@ -22689,7 +22947,7 @@
 polynomials in a single variable, with constant integer or fractional
 coefficients, are factored into irreducible linear and/or quadratic
 terms.  The first example above factors into three linear terms
-(@cite{x}, @cite{x+1}, and @cite{x+1} again).  Finally, formulas
+(@expr{x}, @expr{x+1}, and @expr{x+1} again).  Finally, formulas
 which do not fit the above criteria are handled by the algebraic
 rewrite mechanism.
 
@@ -22721,7 +22979,7 @@
 @code{FactorRules}.  @xref{Rewrite Rules}, for a discussion of the
 operation of rewrite rules.  The default @code{FactorRules} are able
 to factor quadratic forms symbolically into two linear terms,
-@cite{(a x + b) (c x + d)}.  You can edit these rules to include other
+@expr{(a x + b) (c x + d)}.  You can edit these rules to include other
 cases if you wish.  To use the rules, Calc builds the formula
 @samp{thecoefs(x, [a, b, c, ...])} where @code{x} is the polynomial
 base variable and @code{a}, @code{b}, etc., are polynomial coefficients
@@ -22742,13 +23000,13 @@
 but it returns a list of factors instead of an expression which is the
 product of the factors.  Each factor is represented by a sub-vector
 of the factor, and the power with which it appears.  For example,
-@cite{x^5 + x^4 - 33 x^3 + 63 x^2} factors to @cite{(x + 7) x^2 (x - 3)^2}
-in @kbd{a f}, or to @cite{[ [x, 2], [x+7, 1], [x-3, 2] ]} in @kbd{H a f}.
+@expr{x^5 + x^4 - 33 x^3 + 63 x^2} factors to @expr{(x + 7) x^2 (x - 3)^2}
+in @kbd{a f}, or to @expr{[ [x, 2], [x+7, 1], [x-3, 2] ]} in @kbd{H a f}.
 If there is an overall numeric factor, it always comes first in the list.
 The functions @code{factor} and @code{factors} allow a second argument
-when written in algebraic form; @samp{factor(x,v)} factors @cite{x} with
-respect to the specific variable @cite{v}.  The default is to factor with
-respect to all the variables that appear in @cite{x}.
+when written in algebraic form; @samp{factor(x,v)} factors @expr{x} with
+respect to the specific variable @expr{v}.  The default is to factor with
+respect to all the variables that appear in @expr{x}.
 
 @kindex a c
 @pindex calc-collect
@@ -22756,12 +23014,12 @@
 The @kbd{a c} (@code{calc-collect}) [@code{collect}] command rearranges a
 formula as a
 polynomial in a given variable, ordered in decreasing powers of that
-variable.  For example, given @cite{1 + 2 x + 3 y + 4 x y^2} on
-the stack, @kbd{a c x} would produce @cite{(2 + 4 y^2) x + (1 + 3 y)},
-and @kbd{a c y} would produce @cite{(4 x) y^2 + 3 y + (1 + 2 x)}.
+variable.  For example, given @expr{1 + 2 x + 3 y + 4 x y^2} on
+the stack, @kbd{a c x} would produce @expr{(2 + 4 y^2) x + (1 + 3 y)},
+and @kbd{a c y} would produce @expr{(4 x) y^2 + 3 y + (1 + 2 x)}.
 The polynomial will be expanded out using the distributive law as
-necessary:  Collecting @cite{x} in @cite{(x - 1)^3} produces
-@cite{x^3 - 3 x^2 + 3 x - 1}.  Terms not involving @cite{x} will
+necessary:  Collecting @expr{x} in @expr{(x - 1)^3} produces
+@expr{x^3 - 3 x^2 + 3 x - 1}.  Terms not involving @expr{x} will
 not be expanded.
 
 The ``variable'' you specify at the prompt can actually be any
@@ -22790,10 +23048,10 @@
 do not do.)
 
 Calc's automatic simplifications will sometimes reverse a partial
-expansion.  For example, the first step in expanding @cite{(x+1)^3} is
-to write @cite{(x+1) (x+1)^2}.  If @kbd{a x} stops there and tries
+expansion.  For example, the first step in expanding @expr{(x+1)^3} is
+to write @expr{(x+1) (x+1)^2}.  If @kbd{a x} stops there and tries
 to put this formula onto the stack, though, Calc will automatically
-simplify it back to @cite{(x+1)^3} form.  The solution is to turn
+simplify it back to @expr{(x+1)^3} form.  The solution is to turn
 simplification off first (@pxref{Simplification Modes}), or to run
 @kbd{a x} without a numeric prefix argument so that it expands all
 the way in one step.
@@ -22814,21 +23072,21 @@
 @tindex nrat
 The @kbd{a n} (@code{calc-normalize-rat}) [@code{nrat}] command
 attempts to arrange a formula into a quotient of two polynomials.
-For example, given @cite{1 + (a + b/c) / d}, the result would be
-@cite{(b + a c + c d) / c d}.  The quotient is reduced, so that
-@kbd{a n} will simplify @cite{(x^2 + 2x + 1) / (x^2 - 1)} by dividing
-out the common factor @cite{x + 1}, yielding @cite{(x + 1) / (x - 1)}.
+For example, given @expr{1 + (a + b/c) / d}, the result would be
+@expr{(b + a c + c d) / c d}.  The quotient is reduced, so that
+@kbd{a n} will simplify @expr{(x^2 + 2x + 1) / (x^2 - 1)} by dividing
+out the common factor @expr{x + 1}, yielding @expr{(x + 1) / (x - 1)}.
 
 @kindex a \
 @pindex calc-poly-div
 @tindex pdiv
 The @kbd{a \} (@code{calc-poly-div}) [@code{pdiv}] command divides
-two polynomials @cite{u} and @cite{v}, yielding a new polynomial
-@cite{q}.  If several variables occur in the inputs, the inputs are
+two polynomials @expr{u} and @expr{v}, yielding a new polynomial
+@expr{q}.  If several variables occur in the inputs, the inputs are
 considered multivariate polynomials.  (Calc divides by the variable
-with the largest power in @cite{u} first, or, in the case of equal
+with the largest power in @expr{u} first, or, in the case of equal
 powers, chooses the variables in alphabetical order.)  For example,
-dividing @cite{x^2 + 3 x + 2} by @cite{x + 2} yields @cite{x + 1}.
+dividing @expr{x^2 + 3 x + 2} by @expr{x + 2} yields @expr{x + 1}.
 The remainder from the division, if any, is reported at the bottom
 of the screen and is also placed in the Trail along with the quotient.
 
@@ -22842,9 +23100,9 @@
 @pindex calc-poly-rem
 @tindex prem
 The @kbd{a %} (@code{calc-poly-rem}) [@code{prem}] command divides
-two polynomials and keeps the remainder @cite{r}.  The quotient
-@cite{q} is discarded.  For any formulas @cite{a} and @cite{b}, the
-results of @kbd{a \} and @kbd{a %} satisfy @cite{a = q b + r}.
+two polynomials and keeps the remainder @expr{r}.  The quotient
+@expr{q} is discarded.  For any formulas @expr{a} and @expr{b}, the
+results of @kbd{a \} and @kbd{a %} satisfy @expr{a = q b + r}.
 (This is analogous to plain @kbd{\} and @kbd{%}, which compute the
 integer quotient and remainder from dividing two numbers.)
 
@@ -22855,10 +23113,10 @@
 @tindex pdivide
 The @kbd{a /} (@code{calc-poly-div-rem}) [@code{pdivrem}] command
 divides two polynomials and reports both the quotient and the
-remainder as a vector @cite{[q, r]}.  The @kbd{H a /} [@code{pdivide}]
+remainder as a vector @expr{[q, r]}.  The @kbd{H a /} [@code{pdivide}]
 command divides two polynomials and constructs the formula
-@cite{q + r/b} on the stack.  (Naturally if the remainder is zero,
-this will immediately simplify to @cite{q}.)
+@expr{q + r/b} on the stack.  (Naturally if the remainder is zero,
+this will immediately simplify to @expr{q}.)
 
 @kindex a g
 @pindex calc-poly-gcd
@@ -22936,8 +23194,9 @@
 
 If you use the @code{deriv} function directly in an algebraic formula,
 you can write @samp{deriv(f,x,x0)} which represents the derivative
-of @cite{f} with respect to @cite{x}, evaluated at the point @c{$x=x_0$}
-@cite{x=x0}.
+of @expr{f} with respect to @expr{x}, evaluated at the point 
+@texline @tmath{x=x_0}.
+@infoline @expr{x=x0}.
 
 If the formula being differentiated contains functions which Calc does
 not know, the derivatives of those functions are produced by adding
@@ -22960,7 +23219,7 @@
 Various higher-order derivatives can be formed in the obvious way, e.g.,
 @samp{f'@var{}'(x)} (the second derivative of @code{f}) or
 @samp{f'@var{}'2'3(x,y,z)} (@code{f} differentiated with respect to each
-argument once).@refill
+argument once).
 
 @node Integration, Customizing the Integrator, Differentiation, Calculus
 @subsection Integration
@@ -22975,11 +23234,12 @@
 all integrable functions, but it is able to integrate several large
 classes of formulas.  In particular, any polynomial or rational function
 (a polynomial divided by a polynomial) is acceptable.  (Rational functions
-don't have to be in explicit quotient form, however; @c{$x/(1+x^{-2})$}
-@cite{x/(1+x^-2)}
+don't have to be in explicit quotient form, however; 
+@texline @tmath{x/(1+x^{-2})}
+@infoline @expr{x/(1+x^-2)}
 is not strictly a quotient of polynomials, but it is equivalent to
-@cite{x^3/(x^2+1)}, which is.)  Also, square roots of terms involving
-@cite{x} and @cite{x^2} may appear in rational functions being
+@expr{x^3/(x^2+1)}, which is.)  Also, square roots of terms involving
+@expr{x} and @expr{x^2} may appear in rational functions being
 integrated.  Finally, rational functions involving trigonometric or
 hyperbolic functions can be integrated.
 
@@ -23000,17 +23260,21 @@
 
 Please note that the current implementation of Calc's integrator sometimes
 produces results that are significantly more complex than they need to
-be.  For example, the integral Calc finds for @c{$1/(x+\sqrt{x^2+1})$}
-@cite{1/(x+sqrt(x^2+1))}
+be.  For example, the integral Calc finds for 
+@texline @tmath{1/(x+\sqrt{x^2+1})}
+@infoline @expr{1/(x+sqrt(x^2+1))}
 is several times more complicated than the answer Mathematica
 returns for the same input, although the two forms are numerically
 equivalent.  Also, any indefinite integral should be considered to have
 an arbitrary constant of integration added to it, although Calc does not
 write an explicit constant of integration in its result.  For example,
-Calc's solution for @c{$1/(1+\tan x)$}
-@cite{1/(1+tan(x))} differs from the solution given
-in the @emph{CRC Math Tables} by a constant factor of @c{$\pi i / 2$}
-@cite{pi i / 2},
+Calc's solution for 
+@texline @tmath{1/(1+\tan x)}
+@infoline @expr{1/(1+tan(x))} 
+differs from the solution given in the @emph{CRC Math Tables} by a
+constant factor of  
+@texline @tmath{\pi i / 2}
+@infoline @expr{pi i / 2},
 due to a different choice of constant of integration.
 
 The Calculator remembers all the integrals it has done.  If conditions
@@ -23068,8 +23332,10 @@
 @tindex Ei
 As a more serious example, the expression @samp{exp(x)/x} cannot be
 integrated in terms of the standard functions, so the ``exponential
-integral'' function @c{${\rm Ei}(x)$}
-@cite{Ei(x)} was invented to describe it.
+integral'' function 
+@texline @tmath{{\rm Ei}(x)}
+@infoline @expr{Ei(x)} 
+was invented to describe it.
 We can get Calc to do this integral in terms of a made-up @code{Ei}
 function by adding the rule @samp{[integtry(exp(x)/x, x) := Ei(x)]}
 to @code{IntegRules}.  Now entering @samp{exp(2x)/x} on the stack
@@ -23215,7 +23481,7 @@
 You may specify the number of terms with a numeric prefix argument;
 otherwise the command will prompt you for the number of terms.  Note that
 many series expansions have coefficients of zero for some terms, so you
-may appear to get fewer terms than you asked for.@refill
+may appear to get fewer terms than you asked for.
 
 If the @kbd{a i} command is unable to find a symbolic integral for a
 function, you can get an approximation by integrating the function's
@@ -23232,28 +23498,32 @@
 @cindex Solving equations
 The @kbd{a S} (@code{calc-solve-for}) [@code{solve}] command rearranges
 an equation to solve for a specific variable.  An equation is an
-expression of the form @cite{L = R}.  For example, the command @kbd{a S x}
-will rearrange @cite{y = 3x + 6} to the form, @cite{x = y/3 - 2}.  If the
+expression of the form @expr{L = R}.  For example, the command @kbd{a S x}
+will rearrange @expr{y = 3x + 6} to the form, @expr{x = y/3 - 2}.  If the
 input is not an equation, it is treated like an equation of the
-form @cite{X = 0}.
-
-This command also works for inequalities, as in @cite{y < 3x + 6}.
+form @expr{X = 0}.
+
+This command also works for inequalities, as in @expr{y < 3x + 6}.
 Some inequalities cannot be solved where the analogous equation could
-be; for example, solving @c{$a < b \, c$}
-@cite{a < b c} for @cite{b} is impossible
-without knowing the sign of @cite{c}.  In this case, @kbd{a S} will
-produce the result @c{$b \mathbin{\hbox{\code{!=}}} a/c$}
-@cite{b != a/c} (using the not-equal-to operator)
-to signify that the direction of the inequality is now unknown.  The
-inequality @c{$a \le b \, c$}
-@cite{a <= b c} is not even partially solved.
-@xref{Declarations}, for a way to tell Calc that the signs of the
-variables in a formula are in fact known.
+be; for example, solving 
+@texline @tmath{a < b \, c}
+@infoline @expr{a < b c} 
+for @expr{b} is impossible
+without knowing the sign of @expr{c}.  In this case, @kbd{a S} will
+produce the result 
+@texline @tmath{b \mathbin{\hbox{\code{!=}}} a/c}
+@infoline @expr{b != a/c} 
+(using the not-equal-to operator) to signify that the direction of the
+inequality is now unknown.  The inequality 
+@texline @tmath{a \le b \, c}
+@infoline @expr{a <= b c} 
+is not even partially solved.  @xref{Declarations}, for a way to tell
+Calc that the signs of the variables in a formula are in fact known.
 
 Two useful commands for working with the result of @kbd{a S} are
-@kbd{a .} (@pxref{Logical Operations}), which converts @cite{x = y/3 - 2}
-to @cite{y/3 - 2}, and @kbd{s l} (@pxref{Let Command}) which evaluates
-another formula with @cite{x} set equal to @cite{y/3 - 2}.
+@kbd{a .} (@pxref{Logical Operations}), which converts @expr{x = y/3 - 2}
+to @expr{y/3 - 2}, and @kbd{s l} (@pxref{Let Command}) which evaluates
+another formula with @expr{x} set equal to @expr{y/3 - 2}.
 
 @menu
 * Multiple Solutions::
@@ -23293,7 +23563,7 @@
 we solve @samp{sqrt(y) = x} for @code{y}.  Calc squares both sides
 to get @samp{y = x^2}.  This is correct, except that it introduces
 some dubious solutions.  Consider solving @samp{sqrt(y) = -3}:
-Calc will report @cite{y = 9} as a valid solution, which is true
+Calc will report @expr{y = 9} as a valid solution, which is true
 in the mathematical sense of square-root, but false (there is no
 solution) for the actual Calc positive-valued @code{sqrt}.  This
 happens for both @kbd{a S} and @kbd{H a S}.
@@ -23337,7 +23607,7 @@
 With the Inverse flag, @kbd{I a S} [@code{finv}] treats the expression
 on top of the stack as a function of the specified variable and solves
 to find the inverse function, written in terms of the same variable.
-For example, @kbd{I a S x} inverts @cite{2x + 6} to @cite{x/2 - 3}.
+For example, @kbd{I a S x} inverts @expr{2x + 6} to @expr{x/2 - 3}.
 You can use both Inverse and Hyperbolic [@code{ffinv}] to obtain a
 fully general inverse, as described above.
 
@@ -23361,12 +23631,12 @@
 Note that because @kbd{a P} uses @kbd{H a S}, it is able to deliver
 symbolic solutions if the polynomial has symbolic coefficients.  Also
 note that Calc's solver is not able to get exact symbolic solutions
-to all polynomials.  Polynomials containing powers up to @cite{x^4}
+to all polynomials.  Polynomials containing powers up to @expr{x^4}
 can always be solved exactly; polynomials of higher degree sometimes
-can be:  @cite{x^6 + x^3 + 1} is converted to @cite{(x^3)^2 + (x^3) + 1},
-which can be solved for @cite{x^3} using the quadratic equation, and then
-for @cite{x} by taking cube roots.  But in many cases, like
-@cite{x^6 + x + 1}, Calc does not know how to rewrite the polynomial
+can be:  @expr{x^6 + x^3 + 1} is converted to @expr{(x^3)^2 + (x^3) + 1},
+which can be solved for @expr{x^3} using the quadratic equation, and then
+for @expr{x} by taking cube roots.  But in many cases, like
+@expr{x^6 + x + 1}, Calc does not know how to rewrite the polynomial
 into a form it can solve.  The @kbd{a P} command can still deliver a
 list of numerical roots, however, provided that symbolic mode (@kbd{m s})
 is not turned on.  (If you work with symbolic mode on, recall that the
@@ -23392,7 +23662,7 @@
 have the same length as the variables vector, and the variables
 will be listed in the same order there.  Note that the solutions
 are not always simplified as far as possible; the solution for
-@cite{x} here could be improved by an application of the @kbd{a n}
+@expr{x} here could be improved by an application of the @kbd{a n}
 command.
 
 Calc's algorithm works by trying to eliminate one variable at a
@@ -23453,23 +23723,23 @@
 The @code{poly} function takes a polynomial and a variable as
 arguments, and returns a vector of polynomial coefficients (constant
 coefficient first).  For example, @samp{poly(x^3 + 2 x, x)} returns
-@cite{[0, 2, 0, 1]}.  If the input is not a polynomial in @cite{x},
+@expr{[0, 2, 0, 1]}.  If the input is not a polynomial in @expr{x},
 the call to @code{poly} is left in symbolic form.  If the input does
-not involve the variable @cite{x}, the input is returned in a list
+not involve the variable @expr{x}, the input is returned in a list
 of length one, representing a polynomial with only a constant
-coefficient.  The call @samp{poly(x, x)} returns the vector @cite{[0, 1]}.
+coefficient.  The call @samp{poly(x, x)} returns the vector @expr{[0, 1]}.
 The last element of the returned vector is guaranteed to be nonzero;
-note that @samp{poly(0, x)} returns the empty vector @cite{[]}.
-Note also that @cite{x} may actually be any formula; for example,
-@samp{poly(sin(x)^2 - sin(x) + 3, sin(x))} returns @cite{[3, -1, 1]}.
+note that @samp{poly(0, x)} returns the empty vector @expr{[]}.
+Note also that @expr{x} may actually be any formula; for example,
+@samp{poly(sin(x)^2 - sin(x) + 3, sin(x))} returns @expr{[3, -1, 1]}.
 
 @cindex Coefficients of polynomial
 @cindex Degree of polynomial
-To get the @cite{x^k} coefficient of polynomial @cite{p}, use
-@samp{poly(p, x)_(k+1)}.  To get the degree of polynomial @cite{p},
+To get the @expr{x^k} coefficient of polynomial @expr{p}, use
+@samp{poly(p, x)_(k+1)}.  To get the degree of polynomial @expr{p},
 use @samp{vlen(poly(p, x)) - 1}.  For example, @samp{poly((x+1)^4, x)}
 returns @samp{[1, 4, 6, 4, 1]}, so @samp{poly((x+1)^4, x)_(2+1)}
-gives the @cite{x^2} coefficient of this polynomial, 6.
+gives the @expr{x^2} coefficient of this polynomial, 6.
 
 @ignore
 @starindex
@@ -23494,13 +23764,13 @@
 is considered trivial.
 
 For example, @samp{gpoly((x-2)^2, x)} returns @samp{[x, [4, -4, 1], 1]},
-since the expanded form of this polynomial is @cite{4 - 4 x + x^2}.
+since the expanded form of this polynomial is @expr{4 - 4 x + x^2}.
 
 The term @var{x} may itself be a polynomial in @var{var}.  This is
 done to reduce the size of the @var{c} vector.  For example,
 @samp{gpoly(x^4 + x^2 - 1, x)} returns @samp{[x^2, [-1, 1, 1], 1]},
-since a quadratic polynomial in @cite{x^2} is easier to solve than
-a quartic polynomial in @cite{x}.
+since a quadratic polynomial in @expr{x^2} is easier to solve than
+a quartic polynomial in @expr{x}.
 
 A few more examples of the kinds of polynomials @code{gpoly} can
 discover:
@@ -23517,7 +23787,7 @@
 
 The @code{poly} and @code{gpoly} functions accept a third integer argument
 which specifies the largest degree of polynomial that is acceptable.
-If this is @cite{n}, then only @var{c} vectors of length @cite{n+1}
+If this is @expr{n}, then only @var{c} vectors of length @expr{n+1}
 or less will be returned.  Otherwise, the @code{poly} or @code{gpoly}
 call will remain in symbolic form.  For example, the equation solver
 can handle quartics and smaller polynomials, so it calls
@@ -23549,7 +23819,7 @@
 Thus @samp{plead(p,x)} is equivalent to @samp{poly(p,x)_vlen(poly(p,x))},
 though again more efficient.  In particular, @samp{plead((2x+1)^10, x)}
 returns 1024 without expanding out the list of coefficients.  The
-value of @code{plead(p,x)} will be zero only if @cite{p = 0}.
+value of @code{plead(p,x)} will be zero only if @expr{p = 0}.
 
 @ignore
 @starindex
@@ -23618,7 +23888,7 @@
 The @kbd{a R} (@code{calc-find-root}) [@code{root}] command finds a
 numerical solution (or @dfn{root}) of an equation.  (This command treats
 inequalities the same as equations.  If the input is any other kind
-of formula, it is interpreted as an equation of the form @cite{X = 0}.)
+of formula, it is interpreted as an equation of the form @expr{X = 0}.)
 
 The @kbd{a R} command requires an initial guess on the top of the
 stack, and a formula in the second-to-top position.  It prompts for a
@@ -23704,22 +23974,25 @@
 with the minimum value itself.
 
 Note that this command looks for a @emph{local} minimum.  Many functions
-have more than one minimum; some, like @c{$x \sin x$}
-@cite{x sin(x)}, have infinitely
-many.  In fact, there is no easy way to define the ``global'' minimum
-of @c{$x \sin x$}
-@cite{x sin(x)} but Calc can still locate any particular local minimum
+have more than one minimum; some, like 
+@texline @tmath{x \sin x},
+@infoline @expr{x sin(x)}, 
+have infinitely many.  In fact, there is no easy way to define the
+``global'' minimum of 
+@texline @tmath{x \sin x}
+@infoline @expr{x sin(x)} 
+but Calc can still locate any particular local minimum
 for you.  Calc basically goes downhill from the initial guess until it
 finds a point at which the function's value is greater both to the left
 and to the right.  Calc does not use derivatives when minimizing a function.
 
 If your initial guess is an interval and it looks like the minimum
 occurs at one or the other endpoint of the interval, Calc will return
-that endpoint only if that endpoint is closed; thus, minimizing @cite{17 x}
-over @cite{[2..3]} will return @cite{[2, 38]}, but minimizing over
-@cite{(2..3]} would report no minimum found.  In general, you should
+that endpoint only if that endpoint is closed; thus, minimizing @expr{17 x}
+over @expr{[2..3]} will return @expr{[2, 38]}, but minimizing over
+@expr{(2..3]} would report no minimum found.  In general, you should
 use closed intervals to find literally the minimum value in that
-range of @cite{x}, or open intervals to find the local minimum, if
+range of @expr{x}, or open intervals to find the local minimum, if
 any, that happens to lie in that range.
 
 Most functions are smooth and flat near their minimum values.  Because
@@ -23781,9 +24054,9 @@
 
 @noindent
 The @kbd{a F} command fits a set of data to a @dfn{model formula},
-such as @cite{y = m x + b} where @cite{m} and @cite{b} are parameters
+such as @expr{y = m x + b} where @expr{m} and @expr{b} are parameters
 to be determined.  For a typical set of measured data there will be
-no single @cite{m} and @cite{b} that exactly fit the data; in this
+no single @expr{m} and @expr{b} that exactly fit the data; in this
 case, Calc chooses values of the parameters that provide the closest
 possible fit.
 
@@ -23806,46 +24079,50 @@
 @cindex Linear regression
 @cindex Least-squares fits
 The @kbd{a F} (@code{calc-curve-fit}) [@code{fit}] command attempts
-to fit a set of data (@cite{x} and @cite{y} vectors of numbers) to a
-straight line, polynomial, or other function of @cite{x}.  For the
+to fit a set of data (@expr{x} and @expr{y} vectors of numbers) to a
+straight line, polynomial, or other function of @expr{x}.  For the
 moment we will consider only the case of fitting to a line, and we
 will ignore the issue of whether or not the model was in fact a good
 fit for the data.
 
-In a standard linear least-squares fit, we have a set of @cite{(x,y)}
-data points that we wish to fit to the model @cite{y = m x + b}
-by adjusting the parameters @cite{m} and @cite{b} to make the @cite{y}
+In a standard linear least-squares fit, we have a set of @expr{(x,y)}
+data points that we wish to fit to the model @expr{y = m x + b}
+by adjusting the parameters @expr{m} and @expr{b} to make the @expr{y}
 values calculated from the formula be as close as possible to the actual
-@cite{y} values in the data set.  (In a polynomial fit, the model is
-instead, say, @cite{y = a x^3 + b x^2 + c x + d}.  In a multilinear fit,
-we have data points of the form @cite{(x_1,x_2,x_3,y)} and our model is
-@cite{y = a x_1 + b x_2 + c x_3 + d}.  These will be discussed later.)
-
-In the model formula, variables like @cite{x} and @cite{x_2} are called
-the @dfn{independent variables}, and @cite{y} is the @dfn{dependent
-variable}.  Variables like @cite{m}, @cite{a}, and @cite{b} are called
+@expr{y} values in the data set.  (In a polynomial fit, the model is
+instead, say, @expr{y = a x^3 + b x^2 + c x + d}.  In a multilinear fit,
+we have data points of the form @expr{(x_1,x_2,x_3,y)} and our model is
+@expr{y = a x_1 + b x_2 + c x_3 + d}.  These will be discussed later.)
+
+In the model formula, variables like @expr{x} and @expr{x_2} are called
+the @dfn{independent variables}, and @expr{y} is the @dfn{dependent
+variable}.  Variables like @expr{m}, @expr{a}, and @expr{b} are called
 the @dfn{parameters} of the model.
 
 The @kbd{a F} command takes the data set to be fitted from the stack.
 By default, it expects the data in the form of a matrix.  For example,
-for a linear or polynomial fit, this would be a @c{$2\times N$}
-@asis{2xN} matrix where
-the first row is a list of @cite{x} values and the second row has the
-corresponding @cite{y} values.  For the multilinear fit shown above,
-the matrix would have four rows (@cite{x_1}, @cite{x_2}, @cite{x_3}, and
-@cite{y}, respectively).
-
-If you happen to have an @c{$N\times2$}
-@asis{Nx2} matrix instead of a @c{$2\times N$}
-@asis{2xN} matrix,
-just press @kbd{v t} first to transpose the matrix.
+for a linear or polynomial fit, this would be a 
+@texline @tmath{2\times N}
+@infoline 2xN
+matrix where the first row is a list of @expr{x} values and the second
+row has the corresponding @expr{y} values.  For the multilinear fit
+shown above, the matrix would have four rows (@expr{x_1}, @expr{x_2},
+@expr{x_3}, and @expr{y}, respectively).
+
+If you happen to have an 
+@texline @tmath{N\times2}
+@infoline Nx2
+matrix instead of a 
+@texline @tmath{2\times N}
+@infoline 2xN
+matrix, just press @kbd{v t} first to transpose the matrix.
 
 After you type @kbd{a F}, Calc prompts you to select a model.  For a
 linear fit, press the digit @kbd{1}.
 
 Calc then prompts for you to name the variables.  By default it chooses
-high letters like @cite{x} and @cite{y} for independent variables and
-low letters like @cite{a} and @cite{b} for parameters.  (The dependent
+high letters like @expr{x} and @expr{y} for independent variables and
+low letters like @expr{a} and @expr{b} for parameters.  (The dependent
 variable doesn't need a name.)  The two kinds of variables are separated
 by a semicolon.  Since you generally care more about the names of the
 independent variables than of the parameters, Calc also allows you to
@@ -23874,17 +24151,17 @@
 @noindent
 is on the stack and we wish to do a simple linear fit.  Type
 @kbd{a F}, then @kbd{1} for the model, then @key{RET} to use
-the default names.  The result will be the formula @cite{3 + 2 x}
+the default names.  The result will be the formula @expr{3 + 2 x}
 on the stack.  Calc has created the model expression @kbd{a + b x},
-then found the optimal values of @cite{a} and @cite{b} to fit the
+then found the optimal values of @expr{a} and @expr{b} to fit the
 data.  (In this case, it was able to find an exact fit.)  Calc then
-substituted those values for @cite{a} and @cite{b} in the model
+substituted those values for @expr{a} and @expr{b} in the model
 formula.
 
 The @kbd{a F} command puts two entries in the trail.  One is, as
 always, a copy of the result that went to the stack; the other is
 a vector of the actual parameter values, written as equations:
-@cite{[a = 3, b = 2]}, in case you'd rather read them in a list
+@expr{[a = 3, b = 2]}, in case you'd rather read them in a list
 than pick them out of the formula.  (You can type @kbd{t y}
 to move this vector to the stack; see @ref{Trail Commands}.
 
@@ -23930,17 +24207,20 @@
 @end tex
 
 @noindent
-which is clearly zero if @cite{a + b x} exactly fits all data points,
-and increases as various @cite{a + b x_i} values fail to match the
-corresponding @cite{y_i} values.  There are several reasons why the
-summand is squared, one of them being to ensure that @c{$\chi^2 \ge 0$}
-@cite{chi^2 >= 0}.
-Least-squares fitting simply chooses the values of @cite{a} and @cite{b}
-for which the error @c{$\chi^2$}
-@cite{chi^2} is as small as possible.
+which is clearly zero if @expr{a + b x} exactly fits all data points,
+and increases as various @expr{a + b x_i} values fail to match the
+corresponding @expr{y_i} values.  There are several reasons why the
+summand is squared, one of them being to ensure that 
+@texline @tmath{\chi^2 \ge 0}.
+@infoline @expr{chi^2 >= 0}.
+Least-squares fitting simply chooses the values of @expr{a} and @expr{b}
+for which the error 
+@texline @tmath{\chi^2}
+@infoline @expr{chi^2} 
+is as small as possible.
 
 Other kinds of models do the same thing but with a different model
-formula in place of @cite{a + b x_i}.
+formula in place of @expr{a + b x_i}.
 
 @tex
 \bigskip
@@ -23953,9 +24233,9 @@
 is always one independent variable and one dependent variable.
 
 A prefix of zero or plain @kbd{C-u} is a compromise; Calc takes two
-items from the stack, an @var{n}-row matrix of @cite{x} values, and a
-vector of @cite{y} values.  If there is only one independent variable,
-the @cite{x} values can be either a one-row matrix or a plain vector,
+items from the stack, an @var{n}-row matrix of @expr{x} values, and a
+vector of @expr{y} values.  If there is only one independent variable,
+the @expr{x} values can be either a one-row matrix or a plain vector,
 in which case the @kbd{C-u} prefix is the same as a @w{@kbd{C-u 2}} prefix.
 
 @node Polynomial and Multilinear Fits, Error Estimates for Fits, Linear Fits, Curve Fitting
@@ -23974,15 +24254,15 @@
 
 Note that since the constant and linear terms are enough to fit the
 data exactly, it's no surprise that Calc chose a tiny contribution
-for @cite{x^2}.  (The fact that it's not exactly zero is due only
+for @expr{x^2}.  (The fact that it's not exactly zero is due only
 to roundoff error.  Since our data are exact integers, we could get
 an exact answer by typing @kbd{m f} first to get fraction mode.
-Then the @cite{x^2} term would vanish altogether.  Usually, though,
+Then the @expr{x^2} term would vanish altogether.  Usually, though,
 the data being fitted will be approximate floats so fraction mode
 won't help.)
 
 Doing the @kbd{a F 2} fit on the data set with 14 instead of 13
-gives a much larger @cite{x^2} contribution, as Calc bends the
+gives a much larger @expr{x^2} contribution, as Calc bends the
 line slightly to improve the fit.
 
 @example
@@ -24000,7 +24280,7 @@
 @end example
 
 The actual coefficients we get with a precision of 12, like
-@cite{0.0416666663588}, clearly suffer from loss of precision.
+@expr{0.0416666663588}, clearly suffer from loss of precision.
 It is a good idea to increase the working precision to several
 digits beyond what you need when you do a fitting operation.
 Or, if your data are exact, use fraction mode to get exact
@@ -24023,8 +24303,8 @@
 @end tex
 
 Another generalization of the linear model is to assume the
-@cite{y} values are a sum of linear contributions from several
-@cite{x} values.  This is a @dfn{multilinear} fit, and it is also
+@expr{y} values are a sum of linear contributions from several
+@expr{x} values.  This is a @dfn{multilinear} fit, and it is also
 selected by the @kbd{1} digit key.  (Calc decides whether the fit
 is linear or multilinear by counting the rows in the data matrix.)
 
@@ -24039,9 +24319,9 @@
 @end example
 
 @noindent
-the command @kbd{a F 1 @key{RET}} will call the first row @cite{x} and the
-second row @cite{y}, and will fit the values in the third row to the
-model @cite{a + b x + c y}.
+the command @kbd{a F 1 @key{RET}} will call the first row @expr{x} and the
+second row @expr{y}, and will fit the values in the third row to the
+model @expr{a + b x + c y}.
 
 @example
 8. + 3. x + 0.5 y
@@ -24056,20 +24336,20 @@
 
 Yet another variation is @dfn{homogeneous} linear models, in which
 the constant term is known to be zero.  In the linear case, this
-means the model formula is simply @cite{a x}; in the multilinear
-case, the model might be @cite{a x + b y + c z}; and in the polynomial
-case, the model could be @cite{a x + b x^2 + c x^3}.  You can get
+means the model formula is simply @expr{a x}; in the multilinear
+case, the model might be @expr{a x + b y + c z}; and in the polynomial
+case, the model could be @expr{a x + b x^2 + c x^3}.  You can get
 a homogeneous linear or multilinear model by pressing the letter
 @kbd{h} followed by a regular model key, like @kbd{1} or @kbd{2}.
 
 It is certainly possible to have other constrained linear models,
-like @cite{2.3 + a x} or @cite{a - 4 x}.  While there is no single
+like @expr{2.3 + a x} or @expr{a - 4 x}.  While there is no single
 key to select models like these, a later section shows how to enter
 any desired model by hand.  In the first case, for example, you
 would enter @kbd{a F ' 2.3 + a x}.
 
 Another class of models that will work but must be entered by hand
-are multinomial fits, e.g., @cite{a + b x + c y + d x^2 + e y^2 + f x y}.
+are multinomial fits, e.g., @expr{a + b x + c y + d x^2 + e y^2 + f x y}.
 
 @node Error Estimates for Fits, Standard Nonlinear Models, Polynomial and Multilinear Fits, Curve Fitting
 @subsection Error Estimates for Fits
@@ -24096,9 +24376,11 @@
 or all be plain numbers.  Error forms can go anywhere but generally
 go on the numbers in the last row of the data matrix.  If the last
 row contains error forms
-`@var{y_i}@w{ @t{+/-} }@c{$\sigma_i$}
-@var{sigma_i}', then the @c{$\chi^2$}
-@cite{chi^2}
+@texline `@var{y_i}@w{ @t{+/-} }@tmath{\sigma_i}', 
+@infoline `@var{y_i}@w{ @t{+/-} }@var{sigma_i}', 
+then the 
+@texline @tmath{\chi^2}
+@infoline @expr{chi^2}
 statistic is now,
 
 @ifinfo
@@ -24119,24 +24401,29 @@
 
 If there are error forms on other rows of the data matrix, all the
 errors for a given data point are combined; the square root of the
-sum of the squares of the errors forms the @c{$\sigma_i$}
-@cite{sigma_i} used for
-the data point.
+sum of the squares of the errors forms the 
+@texline @tmath{\sigma_i}
+@infoline @expr{sigma_i} 
+used for the data point.
 
 Both @kbd{a F} and @kbd{H a F} can accept error forms in the input
 matrix, although if you are concerned about error analysis you will
 probably use @kbd{H a F} so that the output also contains error
 estimates.
 
-If the input contains error forms but all the @c{$\sigma_i$}
-@cite{sigma_i} values are
-the same, it is easy to see that the resulting fitted model will be
-the same as if the input did not have error forms at all (@c{$\chi^2$}
-@cite{chi^2}
-is simply scaled uniformly by @c{$1 / \sigma^2$}
-@cite{1 / sigma^2}, which doesn't affect
-where it has a minimum).  But there @emph{will} be a difference
-in the estimated errors of the coefficients reported by @kbd{H a F}.
+If the input contains error forms but all the 
+@texline @tmath{\sigma_i}
+@infoline @expr{sigma_i} 
+values are the same, it is easy to see that the resulting fitted model
+will be the same as if the input did not have error forms at all 
+@texline (@tmath{\chi^2}
+@infoline (@expr{chi^2}
+is simply scaled uniformly by 
+@texline @tmath{1 / \sigma^2},
+@infoline @expr{1 / sigma^2}, 
+which doesn't affect where it has a minimum).  But there @emph{will} be
+a difference in the estimated errors of the coefficients reported by
+@kbd{H a F}. 
 
 Consult any text on statistical modeling of data for a discussion
 of where these error estimates come from and how they should be
@@ -24161,54 +24448,66 @@
 A vector of ``raw'' parameter values for the model.  These are the
 polynomial coefficients or other parameters as plain numbers, in the
 same order as the parameters appeared in the final prompt of the
-@kbd{I a F} command.  For polynomials of degree @cite{d}, this vector
-will have length @cite{M = d+1} with the constant term first.
-
-@item
-The covariance matrix @cite{C} computed from the fit.  This is
+@kbd{I a F} command.  For polynomials of degree @expr{d}, this vector
+will have length @expr{M = d+1} with the constant term first.
+
+@item
+The covariance matrix @expr{C} computed from the fit.  This is
 an @var{m}x@var{m} symmetric matrix; the diagonal elements
-@c{$C_{jj}$}
-@cite{C_j_j} are the variances @c{$\sigma_j^2$}
-@cite{sigma_j^2} of the parameters.
-The other elements are covariances @c{$\sigma_{ij}^2$}
-@cite{sigma_i_j^2} that describe the
-correlation between pairs of parameters.  (A related set of
-numbers, the @dfn{linear correlation coefficients} @c{$r_{ij}$}
-@cite{r_i_j},
-are defined as @c{$\sigma_{ij}^2 / \sigma_i \, \sigma_j$}
-@cite{sigma_i_j^2 / sigma_i sigma_j}.)
-
-@item
-A vector of @cite{M} ``parameter filter'' functions whose
+@texline @tmath{C_{jj}}
+@infoline @expr{C_j_j} 
+are the variances 
+@texline @tmath{\sigma_j^2}
+@infoline @expr{sigma_j^2} 
+of the parameters.  The other elements are covariances
+@texline @tmath{\sigma_{ij}^2} 
+@infoline @expr{sigma_i_j^2} 
+that describe the correlation between pairs of parameters.  (A related
+set of numbers, the @dfn{linear correlation coefficients} 
+@texline @tmath{r_{ij}},
+@infoline @expr{r_i_j},
+are defined as 
+@texline @tmath{\sigma_{ij}^2 / \sigma_i \, \sigma_j}.)
+@infoline @expr{sigma_i_j^2 / sigma_i sigma_j}.)
+
+@item
+A vector of @expr{M} ``parameter filter'' functions whose
 meanings are described below.  If no filters are necessary this
 will instead be an empty vector; this is always the case for the
 polynomial and multilinear fits described so far.
 
 @item
-The value of @c{$\chi^2$}
-@cite{chi^2} for the fit, calculated by the formulas
-shown above.  This gives a measure of the quality of the fit;
-statisticians consider @c{$\chi^2 \approx N - M$}
-@cite{chi^2 = N - M} to indicate a moderately good fit
-(where again @cite{N} is the number of data points and @cite{M}
-is the number of parameters).
-
-@item
-A measure of goodness of fit expressed as a probability @cite{Q}.
+The value of 
+@texline @tmath{\chi^2}
+@infoline @expr{chi^2} 
+for the fit, calculated by the formulas shown above.  This gives a
+measure of the quality of the fit; statisticians consider
+@texline @tmath{\chi^2 \approx N - M}
+@infoline @expr{chi^2 = N - M} 
+to indicate a moderately good fit (where again @expr{N} is the number of
+data points and @expr{M} is the number of parameters).
+
+@item
+A measure of goodness of fit expressed as a probability @expr{Q}.
 This is computed from the @code{utpc} probability distribution
-function using @c{$\chi^2$}
-@cite{chi^2} with @cite{N - M} degrees of freedom.  A
+function using 
+@texline @tmath{\chi^2}
+@infoline @expr{chi^2} 
+with @expr{N - M} degrees of freedom.  A
 value of 0.5 implies a good fit; some texts recommend that often
-@cite{Q = 0.1} or even 0.001 can signify an acceptable fit.  In
-particular, @c{$\chi^2$}
-@cite{chi^2} statistics assume the errors in your inputs
+@expr{Q = 0.1} or even 0.001 can signify an acceptable fit.  In
+particular, 
+@texline @tmath{\chi^2}
+@infoline @expr{chi^2} 
+statistics assume the errors in your inputs
 follow a normal (Gaussian) distribution; if they don't, you may
-have to accept smaller values of @cite{Q}.
-
-The @cite{Q} value is computed only if the input included error
+have to accept smaller values of @expr{Q}.
+
+The @expr{Q} value is computed only if the input included error
 estimates.  Otherwise, Calc will report the symbol @code{nan}
-for @cite{Q}.  The reason is that in this case the @c{$\chi^2$}
-@cite{chi^2}
+for @expr{Q}.  The reason is that in this case the 
+@texline @tmath{\chi^2}
+@infoline @expr{chi^2}
 value has effectively been used to estimate the original errors
 in the input, and thus there is no redundant information left
 over to use for a confidence test.
@@ -24248,8 +24547,9 @@
 @item q
 Quadratic.  @i{a + b (x-c)^2 + d (x-e)^2}.
 @item g
-Gaussian.  @c{${a \over b \sqrt{2 \pi}} \exp\left( -{1 \over 2} \left( x - c \over b \right)^2 \right)$}
-@i{(a / b sqrt(2 pi)) exp(-0.5*((x-c)/b)^2)}.
+Gaussian.  
+@texline @tmath{{a \over b \sqrt{2 \pi}} \exp\left( -{1 \over 2} \left( x - c \over b \right)^2 \right)}.
+@infoline @i{(a / b sqrt(2 pi)) exp(-0.5*((x-c)/b)^2)}.
 @end table
 
 All of these models are used in the usual way; just press the appropriate
@@ -24260,12 +24560,12 @@
 
 All models except Gaussian and polynomials can generalize as shown to any
 number of independent variables.  Also, all the built-in models have an
-additive or multiplicative parameter shown as @cite{a} in the above table
+additive or multiplicative parameter shown as @expr{a} in the above table
 which can be replaced by zero or one, as appropriate, by typing @kbd{h}
 before the model key.
 
 Note that many of these models are essentially equivalent, but express
-the parameters slightly differently.  For example, @cite{a b^x} and
+the parameters slightly differently.  For example, @expr{a b^x} and
 the other two exponential models are all algebraic rearrangements of
 each other.  Also, the ``quadratic'' model is just a degree-2 polynomial
 with the parameters expressed differently.  Use whichever form best
@@ -24275,8 +24575,8 @@
 fitting, called @code{LIN}, @code{LOG}, @code{EXP}, and @code{PWR}.
 These correspond to Calc models @samp{a + b x}, @samp{a + b ln(x)},
 @samp{a exp(b x)}, and @samp{a x^b}, respectively.  In each case,
-@cite{a} is what the HP-48 identifies as the ``intercept,'' and
-@cite{b} is what it calls the ``slope.''
+@expr{a} is what the HP-48 identifies as the ``intercept,'' and
+@expr{b} is what it calls the ``slope.''
 
 @tex
 \bigskip
@@ -24287,13 +24587,13 @@
 formula, such as @kbd{m x - b}, as the model.  (Not all models
 will work, though---see the next section for details.)
 
-The model can also be an equation like @cite{y = m x + b}.
+The model can also be an equation like @expr{y = m x + b}.
 In this case, Calc thinks of all the rows of the data matrix on
 equal terms; this model effectively has two parameters
-(@cite{m} and @cite{b}) and two independent variables (@cite{x}
-and @cite{y}), with no ``dependent'' variables.  Model equations
-do not need to take this @cite{y =} form.  For example, the
-implicit line equation @cite{a x + b y = 1} works fine as a
+(@expr{m} and @expr{b}) and two independent variables (@expr{x}
+and @expr{y}), with no ``dependent'' variables.  Model equations
+do not need to take this @expr{y =} form.  For example, the
+implicit line equation @expr{a x + b y = 1} works fine as a
 model.
 
 When you enter a model, Calc makes an alphabetical list of all
@@ -24303,12 +24603,12 @@
 Calc assumes the dependent variable does not appear in the formula
 and thus does not need a name.
 
-For example, if the model formula has the variables @cite{a,mu,sigma,t,x},
+For example, if the model formula has the variables @expr{a,mu,sigma,t,x},
 and the data matrix has three rows (meaning two independent variables),
-Calc will use @cite{a,mu,sigma} as the default parameters, and the
-data rows will be named @cite{t} and @cite{x}, respectively.  If you
-enter an equation instead of a plain formula, Calc will use @cite{a,mu}
-as the parameters, and @cite{sigma,t,x} as the three independent
+Calc will use @expr{a,mu,sigma} as the default parameters, and the
+data rows will be named @expr{t} and @expr{x}, respectively.  If you
+enter an equation instead of a plain formula, Calc will use @expr{a,mu}
+as the parameters, and @expr{sigma,t,x} as the three independent
 variables.
 
 You can, of course, override these choices by entering something
@@ -24332,11 +24632,11 @@
 which are parameters.
 
 Models taken from the stack can also be expressed as vectors of
-two or three elements, @cite{[@var{model}, @var{vars}]} or
-@cite{[@var{model}, @var{vars}, @var{params}]}.  Each of @var{vars}
+two or three elements, @expr{[@var{model}, @var{vars}]} or
+@expr{[@var{model}, @var{vars}, @var{params}]}.  Each of @var{vars}
 and @var{params} may be either a variable or a vector of variables.
 (If @var{params} is omitted, all variables in @var{model} except
-those listed as @var{vars} are parameters.)@refill
+those listed as @var{vars} are parameters.)
 
 When you enter a model manually with @kbd{'}, Calc puts a 3-vector
 describing the model in the trail so you can get it back if you wish.
@@ -24364,14 +24664,16 @@
 returns results in the range from @i{-90} to 90 degrees (or the
 equivalent range in radians).  Suppose you had data that you
 believed to represent roughly three oscillations of a sine wave,
-so that the argument of the sine might go from zero to @c{$3\times360$}
-@i{3*360} degrees.
+so that the argument of the sine might go from zero to 
+@texline @tmath{3\times360}
+@infoline @i{3*360} 
+degrees.
 The above model would appear to be a good way to determine the
 true frequency and phase of the sine wave, but in practice it
 would fail utterly.  The righthand side of the actual model
-@samp{arcsin(y) = a t + b} will grow smoothly with @cite{t}, but
+@samp{arcsin(y) = a t + b} will grow smoothly with @expr{t}, but
 the lefthand side will bounce back and forth between @i{-90} and 90.
-No values of @cite{a} and @cite{b} can make the two sides match,
+No values of @expr{a} and @expr{b} can make the two sides match,
 even approximately.
 
 There is no good solution to this problem at present.  You could
@@ -24388,14 +24690,14 @@
 @noindent
 Calc's internal least-squares fitter can only handle multilinear
 models.  More precisely, it can handle any model of the form
-@cite{a f(x,y,z) + b g(x,y,z) + c h(x,y,z)}, where @cite{a,b,c}
-are the parameters and @cite{x,y,z} are the independent variables
+@expr{a f(x,y,z) + b g(x,y,z) + c h(x,y,z)}, where @expr{a,b,c}
+are the parameters and @expr{x,y,z} are the independent variables
 (of course there can be any number of each, not just three).
 
 In a simple multilinear or polynomial fit, it is easy to see how
 to convert the model into this form.  For example, if the model
-is @cite{a + b x + c x^2}, then @cite{f(x) = 1}, @cite{g(x) = x},
-and @cite{h(x) = x^2} are suitable functions.
+is @expr{a + b x + c x^2}, then @expr{f(x) = 1}, @expr{g(x) = x},
+and @expr{h(x) = x^2} are suitable functions.
 
 For other models, Calc uses a variety of algebraic manipulations
 to try to put the problem into the form
@@ -24405,15 +24707,15 @@
 @end smallexample
 
 @noindent
-where @cite{Y,A,B,C,F,G,H} are arbitrary functions.  It computes
-@cite{Y}, @cite{F}, @cite{G}, and @cite{H} for all the data points,
-does a standard linear fit to find the values of @cite{A}, @cite{B},
-and @cite{C}, then uses the equation solver to solve for @cite{a,b,c}
-in terms of @cite{A,B,C}.
+where @expr{Y,A,B,C,F,G,H} are arbitrary functions.  It computes
+@expr{Y}, @expr{F}, @expr{G}, and @expr{H} for all the data points,
+does a standard linear fit to find the values of @expr{A}, @expr{B},
+and @expr{C}, then uses the equation solver to solve for @expr{a,b,c}
+in terms of @expr{A,B,C}.
 
 A remarkable number of models can be cast into this general form.
 We'll look at two examples here to see how it works.  The power-law
-model @cite{y = a x^b} with two independent variables and two parameters
+model @expr{y = a x^b} with two independent variables and two parameters
 can be rewritten as follows:
 
 @example
@@ -24424,15 +24726,19 @@
 @end example
 
 @noindent
-which matches the desired form with @c{$Y = \ln(y)$}
-@cite{Y = ln(y)}, @c{$A = \ln(a)$}
-@cite{A = ln(a)},
-@cite{F = 1}, @cite{B = b}, and @c{$G = \ln(x)$}
-@cite{G = ln(x)}.  Calc thus computes
-the logarithms of your @cite{y} and @cite{x} values, does a linear fit
-for @cite{A} and @cite{B}, then solves to get @c{$a = \exp(A)$}
-@cite{a = exp(A)} and
-@cite{b = B}.
+which matches the desired form with 
+@texline @tmath{Y = \ln(y)},
+@infoline @expr{Y = ln(y)}, 
+@texline @tmath{A = \ln(a)},
+@infoline @expr{A = ln(a)},
+@expr{F = 1}, @expr{B = b}, and 
+@texline @tmath{G = \ln(x)}.
+@infoline @expr{G = ln(x)}.  
+Calc thus computes the logarithms of your @expr{y} and @expr{x} values,
+does a linear fit for @expr{A} and @expr{B}, then solves to get 
+@texline @tmath{a = \exp(A)} 
+@infoline @expr{a = exp(A)} 
+and @expr{b = B}.
 
 Another interesting example is the ``quadratic'' model, which can
 be handled by expanding according to the distributive law.
@@ -24443,27 +24749,27 @@
 @end example
 
 @noindent
-which matches with @cite{Y = y}, @cite{A = a + b c^2}, @cite{F = 1},
-@cite{B = -2 b c}, @cite{G = x} (the @i{-2} factor could just as easily
-have been put into @cite{G} instead of @cite{B}), @cite{C = b}, and
-@cite{H = x^2}.
+which matches with @expr{Y = y}, @expr{A = a + b c^2}, @expr{F = 1},
+@expr{B = -2 b c}, @expr{G = x} (the @i{-2} factor could just as easily
+have been put into @expr{G} instead of @expr{B}), @expr{C = b}, and
+@expr{H = x^2}.
 
 The Gaussian model looks quite complicated, but a closer examination
 shows that it's actually similar to the quadratic model but with an
-exponential that can be brought to the top and moved into @cite{Y}.
+exponential that can be brought to the top and moved into @expr{Y}.
 
 An example of a model that cannot be put into general linear
 form is a Gaussian with a constant background added on, i.e.,
-@cite{d} + the regular Gaussian formula.  If you have a model like
+@expr{d} + the regular Gaussian formula.  If you have a model like
 this, your best bet is to replace enough of your parameters with
 constants to make the model linearizable, then adjust the constants
 manually by doing a series of fits.  You can compare the fits by
 graphing them, by examining the goodness-of-fit measures returned by
 @kbd{I a F}, or by some other method suitable to your application.
 Note that some models can be linearized in several ways.  The
-Gaussian-plus-@var{d} model can be linearized by setting @cite{d}
-(the background) to a constant, or by setting @cite{b} (the standard
-deviation) and @cite{c} (the mean) to constants.
+Gaussian-plus-@var{d} model can be linearized by setting @expr{d}
+(the background) to a constant, or by setting @expr{b} (the standard
+deviation) and @expr{c} (the mean) to constants.
 
 To fit a model with constants substituted for some parameters, just
 store suitable values in those parameter variables, then omit them
@@ -24475,8 +24781,9 @@
 
 A last desperate step would be to use the general-purpose
 @code{minimize} function rather than @code{fit}.  After all, both
-functions solve the problem of minimizing an expression (the @c{$\chi^2$}
-@cite{chi^2}
+functions solve the problem of minimizing an expression (the 
+@texline @tmath{\chi^2}
+@infoline @expr{chi^2}
 sum) by adjusting certain parameters in the expression.  The @kbd{a F}
 command is able to use a vastly more efficient algorithm due to its
 special knowledge about linear chi-square sums, but the @kbd{a N}
@@ -24485,9 +24792,10 @@
 A compromise would be to pick out a few parameters without which the
 fit is linearizable, and use @code{minimize} on a call to @code{fit}
 which efficiently takes care of the rest of the parameters.  The thing
-to be minimized would be the value of @c{$\chi^2$}
-@cite{chi^2} returned as
-the fifth result of the @code{xfit} function:
+to be minimized would be the value of 
+@texline @tmath{\chi^2}
+@infoline @expr{chi^2} 
+returned as the fifth result of the @code{xfit} function:
 
 @smallexample
 minimize(xfit(gaus(a,b,c,d,x), x, [a,b,c], data)_5, d, guess)
@@ -24496,7 +24804,7 @@
 @noindent
 where @code{gaus} represents the Gaussian model with background,
 @code{data} represents the data matrix, and @code{guess} represents
-the initial guess for @cite{d} that @code{minimize} requires.
+the initial guess for @expr{d} that @code{minimize} requires.
 This operation will only be, shall we say, extraordinarily slow
 rather than astronomically slow (as would be the case if @code{minimize}
 were used by itself to solve the problem).
@@ -24507,17 +24815,17 @@
 
 The @kbd{I a F} [@code{xfit}] command is somewhat trickier when
 nonlinear models are used.  The second item in the result is the
-vector of ``raw'' parameters @cite{A}, @cite{B}, @cite{C}.  The
+vector of ``raw'' parameters @expr{A}, @expr{B}, @expr{C}.  The
 covariance matrix is written in terms of those raw parameters.
 The fifth item is a vector of @dfn{filter} expressions.  This
 is the empty vector @samp{[]} if the raw parameters were the same
-as the requested parameters, i.e., if @cite{A = a}, @cite{B = b},
+as the requested parameters, i.e., if @expr{A = a}, @expr{B = b},
 and so on (which is always true if the model is already linear
 in the parameters as written, e.g., for polynomial fits).  If the
 parameters had to be rearranged, the fifth item is instead a vector
 of one formula per parameter in the original model.  The raw
 parameters are expressed in these ``filter'' formulas as
-@samp{fitdummy(1)} for @cite{A}, @samp{fitdummy(2)} for @cite{B},
+@samp{fitdummy(1)} for @expr{A}, @samp{fitdummy(2)} for @expr{B},
 and so on.
 
 When Calc needs to modify the model to return the result, it replaces
@@ -24537,30 +24845,33 @@
 nontrivial filter functions.
 
 Things are also complicated when the input contains error forms.
-Suppose there are three independent and dependent variables, @cite{x},
-@cite{y}, and @cite{z}, one or more of which are error forms in the
+Suppose there are three independent and dependent variables, @expr{x},
+@expr{y}, and @expr{z}, one or more of which are error forms in the
 data.  Calc combines all the error values by taking the square root
-of the sum of the squares of the errors.  It then changes @cite{x}
-and @cite{y} to be plain numbers, and makes @cite{z} into an error
-form with this combined error.  The @cite{Y(x,y,z)} part of the
+of the sum of the squares of the errors.  It then changes @expr{x}
+and @expr{y} to be plain numbers, and makes @expr{z} into an error
+form with this combined error.  The @expr{Y(x,y,z)} part of the
 linearized model is evaluated, and the result should be an error
-form.  The error part of that result is used for @c{$\sigma_i$}
-@cite{sigma_i} for
-the data point.  If for some reason @cite{Y(x,y,z)} does not return
-an error form, the combined error from @cite{z} is used directly
-for @c{$\sigma_i$}
-@cite{sigma_i}.  Finally, @cite{z} is also stripped of its error
-for use in computing @cite{F(x,y,z)}, @cite{G(x,y,z)} and so on;
+form.  The error part of that result is used for 
+@texline @tmath{\sigma_i}
+@infoline @expr{sigma_i} 
+for the data point.  If for some reason @expr{Y(x,y,z)} does not return 
+an error form, the combined error from @expr{z} is used directly for 
+@texline @tmath{\sigma_i}.
+@infoline @expr{sigma_i}.  
+Finally, @expr{z} is also stripped of its error
+for use in computing @expr{F(x,y,z)}, @expr{G(x,y,z)} and so on;
 the righthand side of the linearized model is computed in regular
 arithmetic with no error forms.
 
 (While these rules may seem complicated, they are designed to do
-the most reasonable thing in the typical case that @cite{Y(x,y,z)}
-depends only on the dependent variable @cite{z}, and in fact is
-often simply equal to @cite{z}.  For common cases like polynomials
+the most reasonable thing in the typical case that @expr{Y(x,y,z)}
+depends only on the dependent variable @expr{z}, and in fact is
+often simply equal to @expr{z}.  For common cases like polynomials
 and multilinear models, the combined error is simply used as the
-@c{$\sigma$}
-@cite{sigma} for the data point with no further ado.)
+@texline @tmath{\sigma}
+@infoline @expr{sigma} 
+for the data point with no further ado.)
 
 @tex
 \bigskip
@@ -24617,7 +24928,7 @@
 @samp{fitparam(2)}, and so on, and independent variables are renamed
 to @samp{fitvar(1)}, @samp{fitvar(2)}, etc.  The dependent variable
 is the highest-numbered @code{fitvar}.  For example, the power law
-model @cite{a x^b} is converted to @cite{y = a x^b}, then to
+model @expr{a x^b} is converted to @expr{y = a x^b}, then to
 
 @smallexample
 @group
@@ -24637,11 +24948,11 @@
 @end example
 
 @noindent
-where @var{Y} is a formula that describes the function @cite{Y(x,y,z)},
-@var{FGH} is the vector of formulas @cite{[F(x,y,z), G(x,y,z), H(x,y,z)]},
+where @var{Y} is a formula that describes the function @expr{Y(x,y,z)},
+@var{FGH} is the vector of formulas @expr{[F(x,y,z), G(x,y,z), H(x,y,z)]},
 and @var{abc} is the vector of parameter filters which refer to the
-raw parameters as @samp{fitdummy(1)} for @cite{A}, @samp{fitdummy(2)}
-for @cite{B}, etc.  While the number of raw parameters (the length of
+raw parameters as @samp{fitdummy(1)} for @expr{A}, @samp{fitdummy(2)}
+for @expr{B}, etc.  While the number of raw parameters (the length of
 the @var{FGH} vector) is usually the same as the number of original
 parameters (the length of the @var{abc} vector), this is not required.
 
@@ -24664,7 +24975,7 @@
 non-constant powers are converted to logs-and-exponentials form,
 and the distributive law is used to expand products of sums.
 Quotients are rewritten to use the @samp{fitinv} function, where
-@samp{fitinv(x)} represents @cite{1/x} while the @code{FitRules}
+@samp{fitinv(x)} represents @expr{1/x} while the @code{FitRules}
 are operating.  (The use of @code{fitinv} makes recognition of
 linear-looking forms easier.)  If you modify @code{FitRules}, you
 will probably only need to modify the rules for this phase.
@@ -24672,8 +24983,8 @@
 Phase two, whose rules can actually also apply during phases one
 and three, first rewrites @code{fitmodel} to a two-argument
 form @samp{fitmodel(@var{Y}, @var{model})}, where @var{Y} is
-initially zero and @var{model} has been changed from @cite{a=b}
-to @cite{a-b} form.  It then tries to peel off invertible functions
+initially zero and @var{model} has been changed from @expr{a=b}
+to @expr{a-b} form.  It then tries to peel off invertible functions
 from the outside of @var{model} and put them into @var{Y} instead,
 calling the equation solver to invert the functions.  Finally, when
 this is no longer possible, the @code{fitmodel} is changed to a
@@ -24719,7 +25030,7 @@
 @tindex hasfitvars
 Two functions which are useful in connection with @code{FitRules}
 are @samp{hasfitparams(x)} and @samp{hasfitvars(x)}, which check
-whether @cite{x} refers to any parameters or independent variables,
+whether @expr{x} refers to any parameters or independent variables,
 respectively.  Specifically, these functions return ``true'' if the
 argument contains any @code{fitparam} (or @code{fitvar}) function
 calls, and ``false'' otherwise.  (Recall that ``true'' means a
@@ -24767,48 +25078,48 @@
 @pindex calc-poly-interp
 @tindex polint
 The @kbd{a p} (@code{calc-poly-interp}) [@code{polint}] command does
-a polynomial interpolation at a particular @cite{x} value.  It takes
+a polynomial interpolation at a particular @expr{x} value.  It takes
 two arguments from the stack:  A data matrix of the sort used by
-@kbd{a F}, and a single number which represents the desired @cite{x}
+@kbd{a F}, and a single number which represents the desired @expr{x}
 value.  Calc effectively does an exact polynomial fit as if by @kbd{a F i},
-then substitutes the @cite{x} value into the result in order to get an
-approximate @cite{y} value based on the fit.  (Calc does not actually
+then substitutes the @expr{x} value into the result in order to get an
+approximate @expr{y} value based on the fit.  (Calc does not actually
 use @kbd{a F i}, however; it uses a direct method which is both more
 efficient and more numerically stable.)
 
-The result of @kbd{a p} is actually a vector of two values:  The @cite{y}
-value approximation, and an error measure @cite{dy} that reflects Calc's
+The result of @kbd{a p} is actually a vector of two values:  The @expr{y}
+value approximation, and an error measure @expr{dy} that reflects Calc's
 estimation of the probable error of the approximation at that value of
-@cite{x}.  If the input @cite{x} is equal to any of the @cite{x} values
-in the data matrix, the output @cite{y} will be the corresponding @cite{y}
-value from the matrix, and the output @cite{dy} will be exactly zero.
+@expr{x}.  If the input @expr{x} is equal to any of the @expr{x} values
+in the data matrix, the output @expr{y} will be the corresponding @expr{y}
+value from the matrix, and the output @expr{dy} will be exactly zero.
 
 A prefix argument of 2 causes @kbd{a p} to take separate x- and
 y-vectors from the stack instead of one data matrix.
 
-If @cite{x} is a vector of numbers, @kbd{a p} will return a matrix of
-interpolated results for each of those @cite{x} values.  (The matrix will
-have two columns, the @cite{y} values and the @cite{dy} values.)
-If @cite{x} is a formula instead of a number, the @code{polint} function
+If @expr{x} is a vector of numbers, @kbd{a p} will return a matrix of
+interpolated results for each of those @expr{x} values.  (The matrix will
+have two columns, the @expr{y} values and the @expr{dy} values.)
+If @expr{x} is a formula instead of a number, the @code{polint} function
 remains in symbolic form; use the @kbd{a "} command to expand it out to
 a formula that describes the fit in symbolic terms.
 
 In all cases, the @kbd{a p} command leaves the data vectors or matrix
-on the stack.  Only the @cite{x} value is replaced by the result.
+on the stack.  Only the @expr{x} value is replaced by the result.
 
 @kindex H a p
 @tindex ratint
 The @kbd{H a p} [@code{ratint}] command does a rational function
 interpolation.  It is used exactly like @kbd{a p}, except that it
 uses as its model the quotient of two polynomials.  If there are
-@cite{N} data points, the numerator and denominator polynomials will
-each have degree @cite{N/2} (if @cite{N} is odd, the denominator will
+@expr{N} data points, the numerator and denominator polynomials will
+each have degree @expr{N/2} (if @expr{N} is odd, the denominator will
 have degree one higher than the numerator).
 
 Rational approximations have the advantage that they can accurately
 describe functions that have poles (points at which the function's value
 goes to infinity, so that the denominator polynomial of the approximation
-goes to zero).  If @cite{x} corresponds to a pole of the fitted rational
+goes to zero).  If @expr{x} corresponds to a pole of the fitted rational
 function, then the result will be a division by zero.  If Infinite mode
 is enabled, the result will be @samp{[uinf, uinf]}.
 
@@ -24842,9 +25153,9 @@
 The choice of index variable is arbitrary, but it's best not to
 use a variable with a stored value.  In particular, while
 @code{i} is often a favorite index variable, it should be avoided
-in Calc because @code{i} has the imaginary constant @cite{(0, 1)}
+in Calc because @code{i} has the imaginary constant @expr{(0, 1)}
 as a value.  If you pressed @kbd{=} on a sum over @code{i}, it would
-be changed to a nonsensical sum over the ``variable'' @cite{(0, 1)}!
+be changed to a nonsensical sum over the ``variable'' @expr{(0, 1)}!
 If you really want to use @code{i} as an index variable, use
 @w{@kbd{s u i @key{RET}}} first to ``unstore'' this variable.
 (@xref{Storing Variables}.)
@@ -24878,7 +25189,7 @@
 and @samp{inf}, respectively.
 
 Infinite sums can sometimes be evaluated:  @samp{sum(.5^k, k, 1, inf)}
-returns @cite{1}.  This is done by evaluating the sum in closed
+returns @expr{1}.  This is done by evaluating the sum in closed
 form (to @samp{1. - 0.5^n} in this case), then evaluating this
 formula with @code{n} set to @code{inf}.  Calc's usual rules
 for ``infinite'' arithmetic can find the answer from there.  If
@@ -24916,31 +25227,32 @@
 but the sum from @samp{n} to @samp{n-2} may report a nonzero value
 if Calc used a closed form solution.
 
-Calc's logical predicates like @cite{a < b} return 1 for ``true''
+Calc's logical predicates like @expr{a < b} return 1 for ``true''
 and 0 for ``false.''  @xref{Logical Operations}.  This can be
 used to advantage for building conditional sums.  For example,
 @samp{sum(prime(k)*k^2, k, 1, 20)} is the sum of the squares of all
 prime numbers from 1 to 20; the @code{prime} predicate returns 1 if
 its argument is prime and 0 otherwise.  You can read this expression
-as ``the sum of @cite{k^2}, where @cite{k} is prime.''  Indeed,
+as ``the sum of @expr{k^2}, where @expr{k} is prime.''  Indeed,
 @samp{sum(prime(k)*k^2, k)} would represent the sum of @emph{all} primes
 squared, since the limits default to plus and minus infinity, but
 there are no such sums that Calc's built-in rules can do in
 closed form.
 
 As another example, @samp{sum((k != k_0) * f(k), k, 1, n)} is the
-sum of @cite{f(k)} for all @cite{k} from 1 to @cite{n}, excluding
-one value @cite{k_0}.  Slightly more tricky is the summand
+sum of @expr{f(k)} for all @expr{k} from 1 to @expr{n}, excluding
+one value @expr{k_0}.  Slightly more tricky is the summand
 @samp{(k != k_0) / (k - k_0)}, which is an attempt to describe
-the sum of all @cite{1/(k-k_0)} except at @cite{k = k_0}, where
-this would be a division by zero.  But at @cite{k = k_0}, this
-formula works out to the indeterminate form @cite{0 / 0}, which
+the sum of all @expr{1/(k-k_0)} except at @expr{k = k_0}, where
+this would be a division by zero.  But at @expr{k = k_0}, this
+formula works out to the indeterminate form @expr{0 / 0}, which
 Calc will not assume is zero.  Better would be to use
 @samp{(k != k_0) ? 1/(k-k_0) : 0}; the @samp{? :} operator does
-an ``if-then-else'' test:  This expression says, ``if @c{$k \ne k_0$}
-@cite{k != k_0},
-then @cite{1/(k-k_0)}, else zero.''  Now the formula @cite{1/(k-k_0)}
-will not even be evaluated by Calc when @cite{k = k_0}.
+an ``if-then-else'' test:  This expression says, ``if 
+@texline @tmath{k \ne k_0},
+@infoline @expr{k != k_0},
+then @expr{1/(k-k_0)}, else zero.''  Now the formula @expr{1/(k-k_0)}
+will not even be evaluated by Calc when @expr{k = k_0}.
 
 @cindex Alternating sums
 @kindex a -
@@ -24991,7 +25303,7 @@
 which @code{dnonzero} returns 0 or cannot decide is assumed ``false.''
 Note that this means that @w{@kbd{Z [ Z ]}} will execute the ``then''
 portion if its condition is provably true, but it will execute the
-``else'' portion for any condition like @cite{a = b} that is not
+``else'' portion for any condition like @expr{a = b} that is not
 provably true, even if it might be true.  Algebraic functions that
 have conditions as arguments, like @code{? :} and @code{&&}, remain
 unevaluated if the condition is neither provably true nor provably
@@ -25004,10 +25316,10 @@
 @tindex ==
 The @kbd{a =} (@code{calc-equal-to}) command, or @samp{eq(a,b)} function
 (which can also be written @samp{a = b} or @samp{a == b} in an algebraic
-formula) is true if @cite{a} and @cite{b} are equal, either because they
+formula) is true if @expr{a} and @expr{b} are equal, either because they
 are identical expressions, or because they are numbers which are
 numerically equal.  (Thus the integer 1 is considered equal to the float
-1.0.)  If the equality of @cite{a} and @cite{b} cannot be determined,
+1.0.)  If the equality of @expr{a} and @expr{b} cannot be determined,
 the comparison is left in symbolic form.  Note that as a command, this
 operation pops two values from the stack and pushes back either a 1 or
 a 0, or a formula @samp{a = b} if the values' equality cannot be determined.
@@ -25035,9 +25347,9 @@
 @tindex neq
 @tindex !=
 The @kbd{a #} (@code{calc-not-equal-to}) command, or @samp{neq(a,b)} or
-@samp{a != b} function, is true if @cite{a} and @cite{b} are not equal.
+@samp{a != b} function, is true if @expr{a} and @expr{b} are not equal.
 This also works with more than two arguments; @samp{a != b != c != d}
-tests that all four of @cite{a}, @cite{b}, @cite{c}, and @cite{d} are
+tests that all four of @expr{a}, @expr{b}, @expr{c}, and @expr{d} are
 distinct numbers.
 
 @kindex a <
@@ -25087,7 +25399,7 @@
 @end ignore
 @tindex >=
 The @kbd{a <} (@code{calc-less-than}) [@samp{lt(a,b)} or @samp{a < b}]
-operation is true if @cite{a} is less than @cite{b}.  Similar functions
+operation is true if @expr{a} is less than @expr{b}.  Similar functions
 are @kbd{a >} (@code{calc-greater-than}) [@samp{gt(a,b)} or @samp{a > b}],
 @kbd{a [} (@code{calc-less-equal}) [@samp{leq(a,b)} or @samp{a <= b}], and
 @kbd{a ]} (@code{calc-greater-equal}) [@samp{geq(a,b)} or @samp{a >= b}].
@@ -25121,8 +25433,8 @@
 @tindex &&
 The @kbd{a &} (@code{calc-logical-and}) [@samp{land(a,b)} or @samp{a && b}]
 function is true if both of its arguments are true, i.e., are
-non-zero numbers.  In this case, the result will be either @cite{a} or
-@cite{b}, chosen arbitrarily.  If either argument is zero, the result is
+non-zero numbers.  In this case, the result will be either @expr{a} or
+@expr{b}, chosen arbitrarily.  If either argument is zero, the result is
 zero.  Otherwise, the formula is left in symbolic form.
 
 @kindex a |
@@ -25132,7 +25444,7 @@
 The @kbd{a |} (@code{calc-logical-or}) [@samp{lor(a,b)} or @samp{a || b}]
 function is true if either or both of its arguments are true (nonzero).
 The result is whichever argument was nonzero, choosing arbitrarily if both
-are nonzero.  If both @cite{a} and @cite{b} are zero, the result is
+are nonzero.  If both @expr{a} and @expr{b} are zero, the result is
 zero.
 
 @kindex a !
@@ -25140,8 +25452,8 @@
 @tindex lnot
 @tindex !
 The @kbd{a !} (@code{calc-logical-not}) [@samp{lnot(a)} or @samp{!@: a}]
-function is true if @cite{a} is false (zero), or false if @cite{a} is
-true (nonzero).  It is left in symbolic form if @cite{a} is not a
+function is true if @expr{a} is false (zero), or false if @expr{a} is
+true (nonzero).  It is left in symbolic form if @expr{a} is not a
 number.
 
 @kindex a :
@@ -25157,9 +25469,9 @@
 @tindex :
 @cindex Arguments, not evaluated
 The @kbd{a :} (@code{calc-logical-if}) [@samp{if(a,b,c)} or @samp{a ? b :@: c}]
-function is equal to either @cite{b} or @cite{c} if @cite{a} is a nonzero
-number or zero, respectively.  If @cite{a} is not a number, the test is
-left in symbolic form and neither @cite{b} nor @cite{c} is evaluated in
+function is equal to either @expr{b} or @expr{c} if @expr{a} is a nonzero
+number or zero, respectively.  If @expr{a} is not a number, the test is
+left in symbolic form and neither @expr{b} nor @expr{c} is evaluated in
 any way.  In algebraic formulas, this is one of the few Calc functions
 whose arguments are not automatically evaluated when the function itself
 is evaluated.  The others are @code{lambda}, @code{quote}, and
@@ -25170,24 +25482,24 @@
 as three separate symbols.  Type something like @samp{a ? 3 : 4} or
 @samp{a?(3):4} instead.
 
-As a special case, if @cite{a} evaluates to a vector, then both @cite{b}
-and @cite{c} are evaluated; the result is a vector of the same length
-as @cite{a} whose elements are chosen from corresponding elements of
-@cite{b} and @cite{c} according to whether each element of @cite{a}
-is zero or nonzero.  Each of @cite{b} and @cite{c} must be either a
-vector of the same length as @cite{a}, or a non-vector which is matched
-with all elements of @cite{a}.
+As a special case, if @expr{a} evaluates to a vector, then both @expr{b}
+and @expr{c} are evaluated; the result is a vector of the same length
+as @expr{a} whose elements are chosen from corresponding elements of
+@expr{b} and @expr{c} according to whether each element of @expr{a}
+is zero or nonzero.  Each of @expr{b} and @expr{c} must be either a
+vector of the same length as @expr{a}, or a non-vector which is matched
+with all elements of @expr{a}.
 
 @kindex a @{
 @pindex calc-in-set
 @tindex in
 The @kbd{a @{} (@code{calc-in-set}) [@samp{in(a,b)}] function is true if
-the number @cite{a} is in the set of numbers represented by @cite{b}.
-If @cite{b} is an interval form, @cite{a} must be one of the values
-encompassed by the interval.  If @cite{b} is a vector, @cite{a} must be
+the number @expr{a} is in the set of numbers represented by @expr{b}.
+If @expr{b} is an interval form, @expr{a} must be one of the values
+encompassed by the interval.  If @expr{b} is a vector, @expr{a} must be
 equal to one of the elements of the vector.  (If any vector elements are
-intervals, @cite{a} must be in any of the intervals.)  If @cite{b} is a
-plain number, @cite{a} must be numerically equal to @cite{b}.
+intervals, @expr{a} must be in any of the intervals.)  If @expr{b} is a
+plain number, @expr{a} must be numerically equal to @expr{b}.
 @xref{Set Operations}, for a group of commands that manipulate sets
 of this sort.
 
@@ -25196,7 +25508,7 @@
 @end ignore
 @tindex typeof
 The @samp{typeof(a)} function produces an integer or variable which
-characterizes @cite{a}.  If @cite{a} is a number, vector, or variable,
+characterizes @expr{a}.  If @expr{a} is a number, vector, or variable,
 the result will be one of the following numbers:
 
 @example
@@ -25217,7 +25529,7 @@
 102  Matrix
 @end example
 
-Otherwise, @cite{a} is a formula, and the result is a variable which
+Otherwise, @expr{a} is a formula, and the result is a variable which
 represents the name of the top-level function call.
 
 @ignore
@@ -25232,15 +25544,15 @@
 @starindex
 @end ignore
 @tindex constant
-The @samp{integer(a)} function returns true if @cite{a} is an integer.
+The @samp{integer(a)} function returns true if @expr{a} is an integer.
 The @samp{real(a)} function
-is true if @cite{a} is a real number, either integer, fraction, or
-float.  The @samp{constant(a)} function returns true if @cite{a} is
+is true if @expr{a} is a real number, either integer, fraction, or
+float.  The @samp{constant(a)} function returns true if @expr{a} is
 any of the objects for which @code{typeof} would produce an integer
 code result except for variables, and provided that the components of
 an object like a vector or error form are themselves constant.
 Note that infinities do not satisfy any of these tests, nor do
-special constants like @code{pi} and @code{e}.@refill
+special constants like @code{pi} and @code{e}.
 
 @xref{Declarations}, for a set of similar functions that recognize
 formulas as well as actual numbers.  For example, @samp{dint(floor(x))}
@@ -25253,21 +25565,21 @@
 @end ignore
 @tindex refers
 The @samp{refers(a,b)} function is true if the variable (or sub-expression)
-@cite{b} appears in @cite{a}, or false otherwise.  Unlike the other
+@expr{b} appears in @expr{a}, or false otherwise.  Unlike the other
 tests described here, this function returns a definite ``no'' answer
 even if its arguments are still in symbolic form.  The only case where
-@code{refers} will be left unevaluated is if @cite{a} is a plain
-variable (different from @cite{b}).
+@code{refers} will be left unevaluated is if @expr{a} is a plain
+variable (different from @expr{b}).
 
 @ignore
 @starindex
 @end ignore
 @tindex negative
-The @samp{negative(a)} function returns true if @cite{a} ``looks'' negative,
-because it is a negative number, because it is of the form @cite{-x},
+The @samp{negative(a)} function returns true if @expr{a} ``looks'' negative,
+because it is a negative number, because it is of the form @expr{-x},
 or because it is a product or quotient with a term that looks negative.
 This is most useful in rewrite rules.  Beware that @samp{negative(a)}
-evaluates to 1 or 0 for @emph{any} argument @cite{a}, so it can only
+evaluates to 1 or 0 for @emph{any} argument @expr{a}, so it can only
 be stored in a formula if the default simplifications are turned off
 first with @kbd{m O} (or if it appears in an unevaluated context such
 as a rewrite rule condition).
@@ -25276,8 +25588,8 @@
 @starindex
 @end ignore
 @tindex variable
-The @samp{variable(a)} function is true if @cite{a} is a variable,
-or false if not.  If @cite{a} is a function call, this test is left
+The @samp{variable(a)} function is true if @expr{a} is a variable,
+or false if not.  If @expr{a} is a function call, this test is left
 in symbolic form.  Built-in variables like @code{pi} and @code{inf}
 are considered variables like any others by this test.
 
@@ -25285,7 +25597,7 @@
 @starindex
 @end ignore
 @tindex nonvar
-The @samp{nonvar(a)} function is true if @cite{a} is a non-variable.
+The @samp{nonvar(a)} function is true if @expr{a} is a non-variable.
 If its argument is a variable it is left unsimplified; it never
 actually returns zero.  However, since Calc's condition-testing
 commands consider ``false'' anything not provably true, this is
@@ -25310,15 +25622,15 @@
 @cindex Linearity testing
 The functions @code{lin}, @code{linnt}, @code{islin}, and @code{islinnt}
 check if an expression is ``linear,'' i.e., can be written in the form
-@cite{a + b x} for some constants @cite{a} and @cite{b}, and some
-variable or subformula @cite{x}.  The function @samp{islin(f,x)} checks
-if formula @cite{f} is linear in @cite{x}, returning 1 if so.  For
+@expr{a + b x} for some constants @expr{a} and @expr{b}, and some
+variable or subformula @expr{x}.  The function @samp{islin(f,x)} checks
+if formula @expr{f} is linear in @expr{x}, returning 1 if so.  For
 example, @samp{islin(x,x)}, @samp{islin(-x,x)}, @samp{islin(3,x)}, and
 @samp{islin(x y / 3 - 2, x)} all return 1.  The @samp{lin(f,x)} function
 is similar, except that instead of returning 1 it returns the vector
-@cite{[a, b, x]}.  For the above examples, this vector would be
-@cite{[0, 1, x]}, @cite{[0, -1, x]}, @cite{[3, 0, x]}, and
-@cite{[-2, y/3, x]}, respectively.  Both @code{lin} and @code{islin}
+@expr{[a, b, x]}.  For the above examples, this vector would be
+@expr{[0, 1, x]}, @expr{[0, -1, x]}, @expr{[3, 0, x]}, and
+@expr{[-2, y/3, x]}, respectively.  Both @code{lin} and @code{islin}
 generally remain unevaluated for expressions which are not linear,
 e.g., @samp{lin(2 x^2, x)} and @samp{lin(sin(x), x)}.  The second
 argument can also be a formula; @samp{islin(2 + 3 sin(x), sin(x))}
@@ -25326,19 +25638,19 @@
 
 The @code{linnt} and @code{islinnt} functions perform a similar check,
 but require a ``non-trivial'' linear form, which means that the
-@cite{b} coefficient must be non-zero.  For example, @samp{lin(2,x)}
-returns @cite{[2, 0, x]} and @samp{lin(y,x)} returns @cite{[y, 0, x]},
+@expr{b} coefficient must be non-zero.  For example, @samp{lin(2,x)}
+returns @expr{[2, 0, x]} and @samp{lin(y,x)} returns @expr{[y, 0, x]},
 but @samp{linnt(2,x)} and @samp{linnt(y,x)} are left unevaluated
 (in other words, these formulas are considered to be only ``trivially''
-linear in @cite{x}).
+linear in @expr{x}).
 
 All four linearity-testing functions allow you to omit the second
 argument, in which case the input may be linear in any non-constant
-formula.  Here, the @cite{a=0}, @cite{b=1} case is also considered
-trivial, and only constant values for @cite{a} and @cite{b} are
-recognized.  Thus, @samp{lin(2 x y)} returns @cite{[0, 2, x y]},
-@samp{lin(2 - x y)} returns @cite{[2, -1, x y]}, and @samp{lin(x y)}
-returns @cite{[0, 1, x y]}.  The @code{linnt} function would allow the
+formula.  Here, the @expr{a=0}, @expr{b=1} case is also considered
+trivial, and only constant values for @expr{a} and @expr{b} are
+recognized.  Thus, @samp{lin(2 x y)} returns @expr{[0, 2, x y]},
+@samp{lin(2 - x y)} returns @expr{[2, -1, x y]}, and @samp{lin(x y)}
+returns @expr{[0, 1, x y]}.  The @code{linnt} function would allow the
 first two cases but not the third.  Also, neither @code{lin} nor
 @code{linnt} accept plain constants as linear in the one-argument
 case: @samp{islin(2,x)} is true, but @samp{islin(2)} is false.
@@ -25347,8 +25659,8 @@
 @starindex
 @end ignore
 @tindex istrue
-The @samp{istrue(a)} function returns 1 if @cite{a} is a nonzero
-number or provably nonzero formula, or 0 if @cite{a} is anything else.
+The @samp{istrue(a)} function returns 1 if @expr{a} is a nonzero
+number or provably nonzero formula, or 0 if @expr{a} is anything else.
 Calls to @code{istrue} can only be manipulated if @kbd{m O} mode is
 used to make sure they are not evaluated prematurely.  (Note that
 declarations are used when deciding whether a formula is true;
@@ -25408,7 +25720,7 @@
 The @code{assign} function is undefined by itself in Calc, so an
 assignment formula such as a rewrite rule will be left alone by ordinary
 Calc commands.  But certain commands, like the rewrite system, interpret
-assignments in special ways.@refill
+assignments in special ways.
 
 For example, the rule @samp{sin(x)^2 := 1-cos(x)^2} says to replace
 every occurrence of the sine of something, squared, with one minus the
@@ -25451,7 +25763,7 @@
 (@code{calc-edit-variable}) command is an easy way to create or edit a
 rule set stored in a variable.  You may also wish to use @kbd{s p}
 (@code{calc-permanent-variable}) to save your rules permanently;
-@pxref{Operations on Variables}.@refill
+@pxref{Operations on Variables}.
 
 Rewrite rules are compiled into a special internal form for faster
 matching.  If you enter a rule set directly it must be recompiled
@@ -25468,10 +25780,10 @@
 @subsection Basic Rewrite Rules
 
 @noindent
-To match a particular formula @cite{x} with a particular rewrite rule
-@samp{@var{old} := @var{new}}, Calc compares the structure of @cite{x} with
+To match a particular formula @expr{x} with a particular rewrite rule
+@samp{@var{old} := @var{new}}, Calc compares the structure of @expr{x} with
 the structure of @var{old}.  Variables that appear in @var{old} are
-treated as @dfn{meta-variables}; the corresponding positions in @cite{x}
+treated as @dfn{meta-variables}; the corresponding positions in @expr{x}
 may contain any sub-formulas.  For example, the pattern @samp{f(x,y)}
 would match the expression @samp{f(12, a+1)} with the meta-variable
 @samp{x} corresponding to 12 and with @samp{y} corresponding to
@@ -25481,7 +25793,7 @@
 the pattern is a single meta-variable, it will match any expression.
 
 If a given meta-variable appears more than once in @var{old}, the
-corresponding sub-formulas of @cite{x} must be identical.  Thus
+corresponding sub-formulas of @expr{x} must be identical.  Thus
 the pattern @samp{f(x,x)} would match @samp{f(12, 12)} and
 @samp{f(a+1, a+1)} but not @samp{f(12, a+1)} or @samp{f(a+b, b+a)}.
 (@xref{Conditional Rewrite Rules}, for a way to match the latter.)
@@ -25525,14 +25837,14 @@
 the rule is accepted.  If the result is zero or if it is a symbolic
 formula that is not known to be nonzero, the rule is rejected.
 @xref{Logical Operations}, for a number of functions that return
-1 or 0 according to the results of various tests.@refill
-
-For example, the formula @samp{n > 0} simplifies to 1 or 0 if @cite{n}
+1 or 0 according to the results of various tests.
+
+For example, the formula @samp{n > 0} simplifies to 1 or 0 if @expr{n}
 is replaced by a positive or nonpositive number, respectively (or if
-@cite{n} has been declared to be positive or nonpositive).  Thus,
+@expr{n} has been declared to be positive or nonpositive).  Thus,
 the rule @samp{f(x,y) := g(y+x,x) :: x+y > 0} would apply to
 @samp{f(0, 4)} but not to @samp{f(-3, 2)} or @samp{f(12, a+1)}
-(assuming no outstanding declarations for @cite{a}).  In the case of
+(assuming no outstanding declarations for @expr{a}).  In the case of
 @samp{f(-3, 2)}, the condition can be shown not to be satisfied; in
 the case of @samp{f(12, a+1)}, the condition merely cannot be shown
 to be satisfied, but that is enough to reject the rule.
@@ -25562,12 +25874,12 @@
 matched.
 
 Certain conditions are handled as special cases by the rewrite rule
-system and are tested very efficiently:  Where @cite{x} is any
+system and are tested very efficiently:  Where @expr{x} is any
 meta-variable, these conditions are @samp{integer(x)}, @samp{real(x)},
-@samp{constant(x)}, @samp{negative(x)}, @samp{x >= y} where @cite{y}
+@samp{constant(x)}, @samp{negative(x)}, @samp{x >= y} where @expr{y}
 is either a constant or another meta-variable and @samp{>=} may be
 replaced by any of the six relational operators, and @samp{x % a = b}
-where @cite{a} and @cite{b} are constants.  Other conditions, like
+where @expr{a} and @expr{b} are constants.  Other conditions, like
 @samp{x >= y+1} or @samp{dreal(x)}, will be less efficient to check
 since Calc must bring the whole evaluator and simplifier into play.
 
@@ -25776,7 +26088,7 @@
 functions with rewrite conditions to test for this; @pxref{Logical
 Operations}.  These functions are not as convenient to use in rewrite
 rules, but they recognize more kinds of formulas as linear:
-@samp{x/z} is considered linear with @cite{b = 1/z} by @code{lin},
+@samp{x/z} is considered linear with @expr{b = 1/z} by @code{lin},
 but it will not match the above pattern because that pattern calls
 for a multiplication, not a division.
 
@@ -25796,7 +26108,7 @@
 @end example
 
 Note that this rule will @emph{not} match @samp{sin(x)^2 + 6 cos(x)^2}
-because one @cite{a} would have ``matched'' 1 while the other matched 6.
+because one @expr{a} would have ``matched'' 1 while the other matched 6.
 
 Calc automatically converts a rule like
 
@@ -25944,20 +26256,25 @@
 @end ignore
 @tindex import
 One kind of marker, @samp{import(x)}, takes the place of a whole
-rule.  Here @cite{x} is the name of a variable containing another
+rule.  Here @expr{x} is the name of a variable containing another
 rule set; those rules are ``spliced into'' the rule set that
 imports them.  For example, if @samp{[f(a+b) := f(a) + f(b),
 f(a b) := a f(b) :: real(a)]} is stored in variable @samp{linearF},
 then the rule set @samp{[f(0) := 0, import(linearF)]} will apply
 all three rules.  It is possible to modify the imported rules
 slightly:  @samp{import(x, v1, x1, v2, x2, @dots{})} imports
-the rule set @cite{x} with all occurrences of @c{$v_1$}
-@cite{v1}, as either
-a variable name or a function name, replaced with @c{$x_1$}
-@cite{x1} and
-so on.  (If @c{$v_1$}
-@cite{v1} is used as a function name, then @c{$x_1$}
-@cite{x1}
+the rule set @expr{x} with all occurrences of 
+@texline @tmath{v_1},
+@infoline @expr{v1}, 
+as either a variable name or a function name, replaced with 
+@texline @tmath{x_1}
+@infoline @expr{x1} 
+and so on.  (If 
+@texline @tmath{v_1}
+@infoline @expr{v1} 
+is used as a function name, then 
+@texline @tmath{x_1}
+@infoline @expr{x1}
 must be either a function name itself or a @w{@samp{< >}} nameless
 function; @pxref{Specifying Operators}.)  For example, @samp{[g(0) := 0,
 import(linearF, f, g)]} applies the linearity rules to the function
@@ -25972,7 +26289,7 @@
 @starindex
 @end ignore
 @tindex quote
-This pattern matches exactly @cite{x}; variable names in @cite{x} are
+This pattern matches exactly @expr{x}; variable names in @expr{x} are
 not interpreted as meta-variables.  The only flexibility is that
 numbers are compared for numeric equality, so that the pattern
 @samp{f(quote(12))} will match both @samp{f(12)} and @samp{f(12.0)}.
@@ -25986,10 +26303,10 @@
 @starindex
 @end ignore
 @tindex plain
-Here @cite{x} must be a function call @samp{f(x1,x2,@dots{})}.  This
-pattern matches a call to function @cite{f} with the specified
+Here @expr{x} must be a function call @samp{f(x1,x2,@dots{})}.  This
+pattern matches a call to function @expr{f} with the specified
 argument patterns.  No special knowledge of the properties of the
-function @cite{f} is used in this case; @samp{+} is not commutative or
+function @expr{f} is used in this case; @samp{+} is not commutative or
 associative.  Unlike @code{quote}, the arguments @samp{x1,x2,@dots{}}
 are treated as patterns.  If you wish them to be treated ``plainly''
 as well, you must enclose them with more @code{plain} markers:
@@ -26000,24 +26317,24 @@
 @starindex
 @end ignore
 @tindex opt
-Here @cite{x} must be a variable name.  This must appear as an
+Here @expr{x} must be a variable name.  This must appear as an
 argument to a function or an element of a vector; it specifies that
 the argument or element is optional.
 As an argument to @samp{+}, @samp{-}, @samp{*}, @samp{&&}, or @samp{||},
 or as the second argument to @samp{/} or @samp{^}, the value @var{def}
 may be omitted.  The pattern @samp{x + opt(y)} matches a sum by
-binding one summand to @cite{x} and the other to @cite{y}, and it
-matches anything else by binding the whole expression to @cite{x} and
-zero to @cite{y}.  The other operators above work similarly.@refill
+binding one summand to @expr{x} and the other to @expr{y}, and it
+matches anything else by binding the whole expression to @expr{x} and
+zero to @expr{y}.  The other operators above work similarly.
 
 For general miscellaneous functions, the default value @code{def}
 must be specified.  Optional arguments are dropped starting with
 the rightmost one during matching.  For example, the pattern
 @samp{f(opt(a,0), b, opt(c,b))} will match @samp{f(b)}, @samp{f(a,b)},
-or @samp{f(a,b,c)}.  Default values of zero and @cite{b} are
+or @samp{f(a,b,c)}.  Default values of zero and @expr{b} are
 supplied in this example for the omitted arguments.  Note that
-the literal variable @cite{b} will be the default in the latter
-case, @emph{not} the value that matched the meta-variable @cite{b}.
+the literal variable @expr{b} will be the default in the latter
+case, @emph{not} the value that matched the meta-variable @expr{b}.
 In other words, the default @var{def} is effectively quoted.
 
 @item condition(x,c)
@@ -26026,8 +26343,8 @@
 @end ignore
 @tindex condition
 @tindex ::
-This matches the pattern @cite{x}, with the attached condition
-@cite{c}.  It is the same as @samp{x :: c}.
+This matches the pattern @expr{x}, with the attached condition
+@expr{c}.  It is the same as @samp{x :: c}.
 
 @item pand(x,y)
 @ignore
@@ -26035,8 +26352,8 @@
 @end ignore
 @tindex pand
 @tindex &&&
-This matches anything that matches both pattern @cite{x} and
-pattern @cite{y}.  It is the same as @samp{x &&& y}.
+This matches anything that matches both pattern @expr{x} and
+pattern @expr{y}.  It is the same as @samp{x &&& y}.
 @pxref{Composing Patterns in Rewrite Rules}.
 
 @item por(x,y)
@@ -26045,8 +26362,8 @@
 @end ignore
 @tindex por
 @tindex |||
-This matches anything that matches either pattern @cite{x} or
-pattern @cite{y}.  It is the same as @w{@samp{x ||| y}}.
+This matches anything that matches either pattern @expr{x} or
+pattern @expr{y}.  It is the same as @w{@samp{x ||| y}}.
 
 @item pnot(x)
 @ignore
@@ -26054,7 +26371,7 @@
 @end ignore
 @tindex pnot
 @tindex !!!
-This matches anything that does not match pattern @cite{x}.
+This matches anything that does not match pattern @expr{x}.
 It is the same as @samp{!!! x}.
 
 @item cons(h,t)
@@ -26063,8 +26380,8 @@
 @end ignore
 @tindex cons (rewrites)
 This matches any vector of one or more elements.  The first
-element is matched to @cite{h}; a vector of the remaining
-elements is matched to @cite{t}.  Note that vectors of fixed
+element is matched to @expr{h}; a vector of the remaining
+elements is matched to @expr{t}.  Note that vectors of fixed
 length can also be matched as actual vectors:  The rule
 @samp{cons(a,cons(b,[])) := cons(a+b,[])} is equivalent
 to the rule @samp{[a,b] := [a+b]}.
@@ -26075,8 +26392,8 @@
 @end ignore
 @tindex rcons (rewrites)
 This is like @code{cons}, except that the @emph{last} element
-is matched to @cite{h}, with the remaining elements matched
-to @cite{t}.
+is matched to @expr{h}, with the remaining elements matched
+to @expr{t}.
 
 @item apply(f,args)
 @ignore
@@ -26084,7 +26401,7 @@
 @end ignore
 @tindex apply (rewrites)
 This matches any function call.  The name of the function, in
-the form of a variable, is matched to @cite{f}.  The arguments
+the form of a variable, is matched to @expr{f}.  The arguments
 of the function, as a vector of zero or more objects, are
 matched to @samp{args}.  Constants, variables, and vectors
 do @emph{not} match an @code{apply} pattern.  For example,
@@ -26152,7 +26469,7 @@
 
 @item plain(x)
 Special properties of and simplifications for the function call
-@cite{x} are not used.  One interesting case where @code{plain}
+@expr{x} are not used.  One interesting case where @code{plain}
 is useful is the rule, @samp{q(x) := quote(x)}, trying to expand a
 shorthand notation for the @code{quote} function.  This rule will
 not work as shown; instead of replacing @samp{q(foo)} with
@@ -26160,7 +26477,7 @@
 rule would be @samp{q(x) := plain(quote(x))}.
 
 @item cons(h,t)
-Where @cite{t} is a vector, this is converted into an expanded
+Where @expr{t} is a vector, this is converted into an expanded
 vector during rewrite processing.  Note that @code{cons} is a regular
 Calc function which normally does this anyway; the only way @code{cons}
 is treated specially by rewrites is that @code{cons} on the righthand
@@ -26168,11 +26485,11 @@
 have been turned off.
 
 @item rcons(t,h)
-Analogous to @code{cons} except putting @cite{h} at the @emph{end} of
-the vector @cite{t}.
+Analogous to @code{cons} except putting @expr{h} at the @emph{end} of
+the vector @expr{t}.
 
 @item apply(f,args)
-Where @cite{f} is a variable and @var{args} is a vector, this
+Where @expr{f} is a variable and @var{args} is a vector, this
 is converted to a function call.  Once again, note that @code{apply}
 is also a regular Calc function.
 
@@ -26181,7 +26498,7 @@
 @starindex
 @end ignore
 @tindex eval
-The formula @cite{x} is handled in the usual way, then the
+The formula @expr{x} is handled in the usual way, then the
 default simplifications are applied to it even if they have
 been turned off normally.  This allows you to treat any function
 similarly to the way @code{cons} and @code{apply} are always
@@ -26194,7 +26511,7 @@
 @starindex
 @end ignore
 @tindex evalsimp
-The formula @cite{x} has meta-variables substituted in the usual
+The formula @expr{x} has meta-variables substituted in the usual
 way, then algebraically simplified as if by the @kbd{a s} command.
 
 @item evalextsimp(x)
@@ -26202,7 +26519,7 @@
 @starindex
 @end ignore
 @tindex evalextsimp
-The formula @cite{x} has meta-variables substituted in the normal
+The formula @expr{x} has meta-variables substituted in the normal
 way, then ``extendedly'' simplified as if by the @kbd{a e} command.
 
 @item select(x)
@@ -26217,22 +26534,22 @@
 @starindex
 @end ignore
 @tindex let
-The expression @cite{x} is evaluated with meta-variables substituted.
+The expression @expr{x} is evaluated with meta-variables substituted.
 The @kbd{a s} command's simplifications are @emph{not} applied by
-default, but @cite{x} can include calls to @code{evalsimp} or
+default, but @expr{x} can include calls to @code{evalsimp} or
 @code{evalextsimp} as described above to invoke higher levels
 of simplification.  The
-result of @cite{x} is then bound to the meta-variable @cite{v}.  As
+result of @expr{x} is then bound to the meta-variable @expr{v}.  As
 usual, if this meta-variable has already been matched to something
 else the two values must be equal; if the meta-variable is new then
 it is bound to the result of the expression.  This variable can then
 appear in later conditions, and on the righthand side of the rule.
-In fact, @cite{v} may be any pattern in which case the result of
-evaluating @cite{x} is matched to that pattern, binding any
+In fact, @expr{v} may be any pattern in which case the result of
+evaluating @expr{x} is matched to that pattern, binding any
 meta-variables that appear in that pattern.  Note that @code{let}
 can only appear by itself as a condition, or as one term of an
 @samp{&&} which is a whole condition:  It cannot be inside
-an @samp{||} term or otherwise buried.@refill
+an @samp{||} term or otherwise buried.
 
 The alternate, equivalent form @samp{let(v, x)} is also recognized.
 Note that the use of @samp{:=} by @code{let}, while still being
@@ -26249,7 +26566,7 @@
 Note that, because the meta-variable @samp{ia} is otherwise unbound
 in this rule, the @code{let} condition itself always ``succeeds''
 because no matter what @samp{1/a} evaluates to, it can successfully
-be bound to @code{ia}.@refill
+be bound to @code{ia}.
 
 Here's another example, for integrating cosines of linear
 terms:  @samp{myint(cos(y),x) := sin(y)/b :: let([a,b,x] := lin(y,x))}.
@@ -26260,7 +26577,7 @@
 the coefficients @code{a} and @code{b} for use elsewhere in the rule.
 (It would have been possible to use @samp{sin(a x + b)/b} for the
 righthand side instead, but using @samp{sin(y)/b} avoids gratuitous
-rearrangement of the argument of the sine.)@refill
+rearrangement of the argument of the sine.)
 
 @ignore
 @starindex
@@ -26321,7 +26638,7 @@
 @starindex
 @end ignore
 @tindex remember
-Remember the match as described above, but only if condition @cite{c}
+Remember the match as described above, but only if condition @expr{c}
 is true.  For example, @samp{remember(n % 4 = 0)} in the above factorial
 rule remembers only every fourth result.  Note that @samp{remember(1)}
 is equivalent to @samp{remember}, and @samp{remember(0)} has no effect.
@@ -26883,7 +27200,7 @@
 
 Another subtle difference between @code{EvalRules} and regular rewrites
 concerns rules that rewrite a formula into an identical formula.  For
-example, @samp{f(n) := f(floor(n))} ``fails to match'' when @cite{n} is
+example, @samp{f(n) := f(floor(n))} ``fails to match'' when @expr{n} is
 already an integer.  But in @code{EvalRules} this case is detected only
 if the righthand side literally becomes the original formula before any
 further simplification.  This means that @samp{f(n) := f(floor(n))} will
@@ -26927,14 +27244,14 @@
 functions directly rather than going through the default simplifications.
 When it does this, @code{EvalRules} will not be able to override those
 functions.  For example, when you take the absolute value of the complex
-number @cite{(2, 3)}, Calc computes @samp{sqrt(2*2 + 3*3)} by calling
+number @expr{(2, 3)}, Calc computes @samp{sqrt(2*2 + 3*3)} by calling
 the multiplication, addition, and square root functions directly rather
 than applying the default simplifications to this formula.  So an
 @code{EvalRules} rule that (perversely) rewrites @samp{sqrt(13) := 6}
 would not apply.  (However, if you put Calc into symbolic mode so that
 @samp{sqrt(13)} will be left in symbolic form by the built-in square
 root function, your rule will be able to apply.  But if the complex
-number were @cite{(3,4)}, so that @samp{sqrt(25)} must be calculated,
+number were @expr{(3,4)}, so that @samp{sqrt(25)} must be calculated,
 then symbolic mode will not help because @samp{sqrt(25)} can be
 evaluated exactly to 5.)
 
@@ -27028,7 +27345,7 @@
 finding suitable cases.  Another solution would be to use the rule
 @samp{cos(x)^2 := 1 - sin(x)^2}, followed by algebraic simplification
 if necessary.  This rule will be the most effective way to do the job,
-but at the expense of making some changes that you might not desire.@refill
+but at the expense of making some changes that you might not desire.
 
 Another algebraic rewrite rule is @samp{exp(x+y) := exp(x) exp(y)}.
 To make this work with the @w{@kbd{j r}} command so that it can be
@@ -27036,10 +27353,10 @@
 you might wish to write the rule as @samp{select(exp(x+y)) :=
 select(exp(x) exp(y))}.  The @samp{select} markers will be
 ignored by the regular @kbd{a r} command
-(@pxref{Selections with Rewrite Rules}).@refill
+(@pxref{Selections with Rewrite Rules}).
 
 A surprisingly useful rewrite rule is @samp{a/(b-c) := a*(b+c)/(b^2-c^2)}.
-This will simplify the formula whenever @cite{b} and/or @cite{c} can
+This will simplify the formula whenever @expr{b} and/or @expr{c} can
 be made simpler by squaring.  For example, applying this rule to
 @samp{2 / (sqrt(2) + 3)} yields @samp{6:7 - 2:7 sqrt(2)} (assuming
 Symbolic Mode has been enabled to keep the square root from being
@@ -27059,17 +27376,19 @@
 @code{tri} to the value on the top of the stack.  @xref{Programming}.
 
 @cindex Quaternions
-The following rule set, contributed by @c{Fran\c cois}
-@asis{Francois} Pinard, implements
-@dfn{quaternions}, a generalization of the concept of complex numbers.
-Quaternions have four components, and are here represented by function
-calls @samp{quat(@var{w}, [@var{x}, @var{y}, @var{z}])} with ``real
-part'' @var{w} and the three ``imaginary'' parts collected into a
-vector.  Various arithmetical operations on quaternions are supported.
-To use these rules, either add them to @code{EvalRules}, or create a
-command based on @kbd{a r} for simplifying quaternion formulas.
-A convenient way to enter quaternions would be a command defined by
-a keyboard macro containing: @kbd{' quat($$$$, [$$$, $$, $]) @key{RET}}.
+The following rule set, contributed by 
+@texline Fran\c cois
+@infoline Francois
+Pinard, implements @dfn{quaternions}, a generalization of the concept of
+complex numbers.  Quaternions have four components, and are here
+represented by function calls @samp{quat(@var{w}, [@var{x}, @var{y},
+@var{z}])} with ``real part'' @var{w} and the three ``imaginary'' parts
+collected into a vector.  Various arithmetical operations on quaternions
+are supported.  To use these rules, either add them to @code{EvalRules},
+or create a command based on @kbd{a r} for simplifying quaternion
+formulas.  A convenient way to enter quaternions would be a command
+defined by a keyboard macro containing: @kbd{' quat($$$$, [$$$, $$, $])
+@key{RET}}.
 
 @smallexample
 [ quat(w, x, y, z) := quat(w, [x, y, z]),
@@ -27094,8 +27413,8 @@
 @end smallexample
 
 Quaternions, like matrices, have non-commutative multiplication.
-In other words, @cite{q1 * q2 = q2 * q1} is not necessarily true if
-@cite{q1} and @cite{q2} are @code{quat} forms.  The @samp{quat*quat}
+In other words, @expr{q1 * q2 = q2 * q1} is not necessarily true if
+@expr{q1} and @expr{q2} are @code{quat} forms.  The @samp{quat*quat}
 rule above uses @code{plain} to prevent Calc from rearranging the
 product.  It may also be wise to add the line @samp{[quat(), matrix]}
 to the @code{Decls} matrix, to ensure that Calc's other algebraic
@@ -27142,13 +27461,13 @@
 or @samp{u} (for ``micro'') followed by a name in the unit table.
 A substantial table of built-in units is provided with Calc;
 @pxref{Predefined Units}.  You can also define your own unit names;
-@pxref{User-Defined Units}.@refill
+@pxref{User-Defined Units}.
 
 Note that if the value part of a units expression is exactly @samp{1},
 it will be removed by the Calculator's automatic algebra routines:  The
 formula @samp{1 mm} is ``simplified'' to @samp{mm}.  This is only a
 display anomaly, however; @samp{mm} will work just fine as a
-representation of one millimeter.@refill
+representation of one millimeter.
 
 You may find that Algebraic Mode (@pxref{Algebraic Entry}) makes working
 with units expressions easier.  Otherwise, you will have to remember
@@ -27169,7 +27488,7 @@
 simplify to @samp{5.023 m}.  When different but compatible units are
 added, the righthand term's units are converted to match those of the
 lefthand term.  @xref{Simplification Modes}, for a way to have this done
-automatically at all times.@refill
+automatically at all times.
 
 Units simplification also handles quotients of two units with the same
 dimensionality, as in @w{@samp{2 in s/L cm}} to @samp{5.08 s/L}; fractional
@@ -27180,7 +27499,7 @@
 applied to units expressions, in which case
 the operation in question is applied only to the numeric part of the
 expression.  Finally, trigonometric functions of quantities with units
-of angle are evaluated, regardless of the current angular mode.@refill
+of angle are evaluated, regardless of the current angular mode.
 
 @kindex u c
 @pindex calc-convert-units
@@ -27261,7 +27580,7 @@
 absolute temperatures.  The value on the stack must be a simple units
 expression with units of temperature only.  This command would convert
 @samp{10 degC} to @samp{50 degF}, the equivalent temperature on the
-Fahrenheit scale.@refill
+Fahrenheit scale.
 
 @kindex u r
 @pindex calc-remove-units
@@ -27272,7 +27591,7 @@
 (@code{calc-extract-units}) command extracts only the units portion of a
 formula.  These commands essentially replace every term of the formula
 that does or doesn't (respectively) look like a unit name by the
-constant 1, then resimplify the formula.@refill
+constant 1, then resimplify the formula.
 
 @kindex u a
 @pindex calc-autorange-units
@@ -27397,12 +27716,12 @@
 
 The unit @code{e} stands for the elementary (electron) unit of charge;
 because algebra command could mistake this for the special constant
-@cite{e}, Calc provides the alternate unit name @code{ech} which is
+@expr{e}, Calc provides the alternate unit name @code{ech} which is
 preferable to @code{e}.
 
 The name @code{g} stands for one gram of mass; there is also @code{gf},
 one gram of force.  (Likewise for @kbd{lb}, pounds, and @kbd{lbf}.)
-Meanwhile, one ``@cite{g}'' of acceleration is denoted @code{ga}.
+Meanwhile, one ``@expr{g}'' of acceleration is denoted @code{ga}.
 
 The unit @code{ton} is a U.S. ton of @samp{2000 lb}, and @code{t} is
 a metric ton of @samp{1000 kg}.
@@ -27634,12 +27953,15 @@
 and @kbd{s ]} which decrease or increase a variable by one.
 
 All the arithmetic stores accept the Inverse prefix to reverse the
-order of the operands.  If @cite{v} represents the contents of the
-variable, and @cite{a} is the value drawn from the stack, then regular
-@w{@kbd{s -}} assigns @c{$v \coloneq v - a$}
-@cite{v := v - a}, but @kbd{I s -} assigns
-@c{$v \coloneq a - v$}
-@cite{v := a - v}.  While @kbd{I s *} might seem pointless, it is
+order of the operands.  If @expr{v} represents the contents of the
+variable, and @expr{a} is the value drawn from the stack, then regular
+@w{@kbd{s -}} assigns 
+@texline @tmath{v \coloneq v - a},
+@infoline @expr{v := v - a}, 
+but @kbd{I s -} assigns
+@texline @tmath{v \coloneq a - v}.
+@infoline @expr{v := a - v}.  
+While @kbd{I s *} might seem pointless, it is
 useful if matrix multiplication is involved.  Actually, all the
 arithmetic stores use formulas designed to behave usefully both
 forwards and backwards:
@@ -27666,7 +27988,7 @@
 
 The first six arithmetic stores can also be typed @kbd{s t +}, @kbd{s t -},
 etc.  The commands @kbd{s s +}, @kbd{s s -}, and so on are analogous
-arithmetic stores that don't remove the value @cite{a} from the stack.
+arithmetic stores that don't remove the value @expr{a} from the stack.
 
 All arithmetic stores report the new value of the variable in the
 Trail for your information.  They signal an error if the variable
@@ -27692,8 +28014,8 @@
 
 If the mapping function takes two or more arguments, the additional
 arguments are taken from the stack; the old value of the variable
-is provided as the first argument.  Thus @kbd{s m -} with @cite{a}
-on the stack computes @cite{v - a}, just like @kbd{s -}.  With the
+is provided as the first argument.  Thus @kbd{s m -} with @expr{a}
+on the stack computes @expr{v - a}, just like @kbd{s -}.  With the
 Inverse prefix, the variable's original value becomes the @emph{last}
 argument instead of the first.  Thus @kbd{I s m -} is also
 equivalent to @kbd{I s -}.
@@ -27716,7 +28038,7 @@
 contain no value at all.  If they appear in an algebraic formula they
 will be left alone even if you press @kbd{=} (@code{calc-evaluate}).
 The @kbd{s u} (@code{calc-unstore}) command returns a variable to the
-void state.@refill
+void state.
 
 The only variables with predefined values are the ``special constants''
 @code{pi}, @code{e}, @code{i}, @code{phi}, and @code{gamma}.  You are free
@@ -27728,8 +28050,7 @@
 normally void).
 
 Note that @code{var-pi} doesn't actually have 3.14159265359 stored
-in it, but rather a special magic value that evaluates to @c{$\pi$}
-@cite{pi}
+in it, but rather a special magic value that evaluates to @cpi{}
 at the current precision.  Likewise @code{var-e}, @code{var-i}, and
 @code{var-phi} evaluate according to the current precision or polar mode.
 If you recall a value from @code{pi} and store it back, this magic
@@ -27913,7 +28234,7 @@
 @code{FitRules}, @code{DistribRules}, and other built-in rewrite
 rules; and @code{PlotData@var{n}} variables generated
 by the graphics commands.  (You can still save these variables by
-explicitly naming them in an @kbd{s p} command.)@refill
+explicitly naming them in an @kbd{s p} command.)
 
 @kindex s i
 @pindex calc-insert-variables
@@ -27936,9 +28257,9 @@
 @cindex Variables, temporary assignment
 @cindex Temporary assignment to variables
 If you have an expression like @samp{a+b^2} on the stack and you wish to
-compute its value where @cite{b=3}, you can simply store 3 in @cite{b} and
+compute its value where @expr{b=3}, you can simply store 3 in @expr{b} and
 then press @kbd{=} to reevaluate the formula.  This has the side-effect
-of leaving the stored value of 3 in @cite{b} for future operations.
+of leaving the stored value of 3 in @expr{b} for future operations.
 
 The @kbd{s l} (@code{calc-let}) command evaluates a formula under a
 @emph{temporary} assignment of a variable.  It stores the value on the
@@ -27961,7 +28282,7 @@
 The @kbd{a b} (@code{calc-substitute}) command is another way to substitute
 a variable with a value in a formula.  It does an actual substitution
 rather than temporarily assigning the variable and evaluating.  For
-example, letting @cite{n=2} in @samp{f(n pi)} with @kbd{a b} will
+example, letting @expr{n=2} in @samp{f(n pi)} with @kbd{a b} will
 produce @samp{f(2 pi)}, whereas @kbd{s l} would give @samp{f(6.28)}
 since the evaluation step will also evaluate @code{pi}.
 
@@ -28145,8 +28466,8 @@
 the interval (whether the interval is open or closed is ignored).
 
 The ``x'' entry may also be a number, in which case Calc uses the
-sequence of ``x'' values @cite{x}, @cite{x+1}, @cite{x+2}, etc.
-(Generally the number 0 or 1 would be used for @cite{x} in this case.)
+sequence of ``x'' values @expr{x}, @expr{x+1}, @expr{x+2}, etc.
+(Generally the number 0 or 1 would be used for @expr{x} in this case.)
 
 The ``y'' entry may be any formula instead of a vector.  Calc effectively
 uses @kbd{N} (@code{calc-eval-num}) to evaluate variables in the formula;
@@ -28169,7 +28490,7 @@
 In this case the ``x'' vector or interval you specified is not directly
 visible in the graph.  For example, if ``x'' is the interval @samp{[0..360]}
 and ``y'' is the formula @samp{xy(sin(t), cos(t))}, the resulting graph
-will be a circle.@refill
+will be a circle.
 
 Also, ``x'' and ``y'' may each be variable names, in which case Calc
 looks for suitable vectors, intervals, or formulas stored in those
@@ -28224,9 +28545,11 @@
 the same length); either or both may instead be interval forms.  The
 ``z'' value must be a matrix with the same number of rows as elements
 in ``x'', and the same number of columns as elements in ``y''.  The
-result is a surface plot where @c{$z_{ij}$}
-@cite{z_ij} is the height of the point
-at coordinate @cite{(x_i, y_j)} on the surface.  The 3D graph will
+result is a surface plot where 
+@texline @tmath{z_{ij}}
+@infoline @expr{z_ij} 
+is the height of the point
+at coordinate @expr{(x_i, y_j)} on the surface.  The 3D graph will
 be displayed from a certain default viewpoint; you can change this
 viewpoint by adding a @samp{set view} to the @samp{*Gnuplot Commands*}
 buffer as described later.  See the GNUPLOT 3.0 documentation for a
@@ -28317,26 +28640,28 @@
 
 A numeric prefix argument on @kbd{g a} or @kbd{g f} changes the way
 stack entries are interpreted as curves.  With a positive prefix
-argument @cite{n}, the top @cite{n} stack entries are ``y'' values
-for @cite{n} different curves which share a common ``x'' value in
-the @cite{n+1}st stack entry.  (Thus @kbd{g a} with no prefix
+argument @expr{n}, the top @expr{n} stack entries are ``y'' values
+for @expr{n} different curves which share a common ``x'' value in
+the @expr{n+1}st stack entry.  (Thus @kbd{g a} with no prefix
 argument is equivalent to @kbd{C-u 1 g a}.)
 
 A prefix of zero or plain @kbd{C-u} means to take two stack entries,
 ``x'' and ``y'' as usual, but to interpret ``y'' as a vector of
 ``y'' values for several curves that share a common ``x''.
 
-A negative prefix argument tells Calc to read @cite{n} vectors from
-the stack; each vector @cite{[x, y]} describes an independent curve.
+A negative prefix argument tells Calc to read @expr{n} vectors from
+the stack; each vector @expr{[x, y]} describes an independent curve.
 This is the only form of @kbd{g a} that creates several curves at once
 that don't have common ``x'' values.  (Of course, the range of ``x''
 values covered by all the curves ought to be roughly the same if
 they are to look nice on the same graph.)
 
-For example, to plot @c{$\sin n x$}
-@cite{sin(n x)} for integers @cite{n}
+For example, to plot 
+@texline @tmath{\sin n x}
+@infoline @expr{sin(n x)} 
+for integers @expr{n}
 from 1 to 5, you could use @kbd{v x} to create a vector of integers
-(@cite{n}), then @kbd{V M '} or @kbd{V M $} to map @samp{sin(n x)}
+(@expr{n}), then @kbd{V M '} or @kbd{V M $} to map @samp{sin(n x)}
 across this vector.  The resulting vector of formulas is suitable
 for use as the ``y'' argument to a @kbd{C-u g a} or @kbd{C-u g f}
 command.
@@ -28346,11 +28671,11 @@
 The @kbd{g A} (@code{calc-graph-add-3d}) command adds a 3D curve
 to the graph.  It is not legal to intermix 2D and 3D curves in a
 single graph.  This command takes three arguments, ``x'', ``y'',
-and ``z'', from the stack.  With a positive prefix @cite{n}, it
-takes @cite{n+2} arguments (common ``x'' and ``y'', plus @cite{n}
+and ``z'', from the stack.  With a positive prefix @expr{n}, it
+takes @expr{n+2} arguments (common ``x'' and ``y'', plus @expr{n}
 separate ``z''s).  With a zero prefix, it takes three stack entries
 but the ``z'' entry is a vector of curve values.  With a negative
-prefix @cite{-n}, it takes @cite{n} vectors of the form @cite{[x, y, z]}.
+prefix @expr{-n}, it takes @expr{n} vectors of the form @expr{[x, y, z]}.
 The @kbd{g A} command works by adding a @code{splot} (surface-plot)
 command to the @samp{*Gnuplot Commands*} buffer.
 
@@ -28469,13 +28794,13 @@
 graphs created by @kbd{g a} that don't specify the resolution explicitly.
 With a negative prefix argument, this command changes or displays
 the default value (initially 5) used for 3D graphs created by @kbd{g A}.
-Note that a 3D setting of 5 means that a total of @cite{5^2 = 25} points
+Note that a 3D setting of 5 means that a total of @expr{5^2 = 25} points
 will be computed for the surface.
 
 Data values in the graph of a function are normally computed to a
 precision of five digits, regardless of the current precision at the
 time. This is usually more than adequate, but there are cases where
-it will not be.  For example, plotting @cite{1 + x} with @cite{x} in the
+it will not be.  For example, plotting @expr{1 + x} with @expr{x} in the
 interval @samp{[0 ..@: 1e-6]} will round all the data points down
 to 1.0!  Putting the command @samp{set precision @var{n}} in the
 @samp{*Gnuplot Commands*} buffer will cause the data to be computed
@@ -28621,8 +28946,10 @@
 picture of the graph composed of characters like @code{-} and @code{|}
 to a buffer called @samp{*Gnuplot Trail*}, which Calc then displays.
 The graph is made the same size as the Emacs screen, which on most
-dumb terminals will be @c{$80\times24$}
-@asis{80x24} characters.  The graph is displayed in
+dumb terminals will be 
+@texline @tmath{80\times24}
+@infoline 80x24
+characters.  The graph is displayed in
 an Emacs ``recursive edit''; type @kbd{q} or @kbd{M-# M-#} to exit
 the recursive edit and return to Calc.  Note that the @code{dumb}
 device is present only in GNUPLOT 3.0 and later versions.
@@ -28824,8 +29151,8 @@
 it appears on the screen, including line numbers if they are enabled.
 
 A numeric prefix argument to @kbd{C-k} or @kbd{M-k} affects the number
-of lines killed.  A positive argument kills the current line and @cite{n-1}
-lines below it.  A negative argument kills the @cite{-n} lines above the
+of lines killed.  A positive argument kills the current line and @expr{n-1}
+lines below it.  A negative argument kills the @expr{-n} lines above the
 current line.  Again this mirrors the behavior of the standard Emacs
 @kbd{C-k} command.  Although a whole line is always deleted, @kbd{C-k}
 with no argument copies only the number itself into the kill ring, whereas
@@ -28868,9 +29195,9 @@
 
 A numeric prefix argument grabs the specified number of lines around
 point, ignoring the mark.  A positive prefix grabs from point to the
-@cite{n}th following newline (so that @kbd{M-1 M-# g} grabs from point
+@expr{n}th following newline (so that @kbd{M-1 M-# g} grabs from point
 to the end of the current line); a negative prefix grabs from point
-back to the @cite{n+1}st preceding newline.  In these cases the text
+back to the @expr{n+1}st preceding newline.  In these cases the text
 that is grabbed is exactly the same as the text that @kbd{C-k} would
 delete given that prefix argument.
 
@@ -28926,12 +29253,13 @@
 will be split up into columns of width @var{n}; each column is parsed
 separately as a matrix element.  If a line contained
 @w{@samp{2 +/- 3 4 +/- 5}}, then grabbing with a prefix argument of 8
-would correctly split the line into two error forms.@refill
+would correctly split the line into two error forms.
 
 @xref{Matrix Functions}, to see how to pull the matrix apart into its
-constituent rows and columns.  (If it is a @c{$1\times1$}
-@asis{1x1} matrix, just hit @kbd{v u}
-(@code{calc-unpack}) twice.)
+constituent rows and columns.  (If it is a 
+@texline @tmath{1\times1}
+@infoline 1x1
+matrix, just hit @kbd{v u} (@code{calc-unpack}) twice.)
 
 @kindex M-# :
 @kindex M-# _
@@ -28984,7 +29312,7 @@
 
 With a prefix argument, @kbd{y} inserts several numbers, one per line.
 A positive argument inserts the specified number of values from the top
-of the stack.  A negative argument inserts the @cite{n}th value from the
+of the stack.  A negative argument inserts the @expr{n}th value from the
 top of the stack.  An argument of zero inserts the entire stack.  Note
 that @kbd{y} with an argument of 1 is slightly different from @kbd{y}
 with no argument; the former always copies full lines, whereas the
@@ -28999,7 +29327,7 @@
 display style (@pxref{Vector and Matrix Formats}) or change the current
 display language (@pxref{Language Modes}) before doing this.  Also, note
 that this command replaces a linear region of text (as grabbed by
-@kbd{M-# g}), not a rectangle (as grabbed by @kbd{M-# r}).@refill
+@kbd{M-# g}), not a rectangle (as grabbed by @kbd{M-# r}).
 
 If the editing buffer is in overwrite (as opposed to insert) mode,
 and the @kbd{C-u} prefix was not used, then the yanked number will
@@ -29187,7 +29515,7 @@
 @item INV *
 is the same as @key{y^x}.
 @item INV /
-is the same as @key{INV y^x} (the @cite{x}th root of @cite{y}).
+is the same as @key{INV y^x} (the @expr{x}th root of @expr{y}).
 @item HYP/INV 1
 are the same as @key{SIN} / @kbd{INV SIN}.
 @item HYP/INV 2
@@ -29253,7 +29581,7 @@
 prefix keys.
 
 @key{IMAG} multiplies the number on the stack by the imaginary
-number @cite{i = (0, 1)}.
+number @expr{i = (0, 1)}.
 
 @key{RE} extracts the real part a complex number.  @kbd{INV RE}
 extracts the imaginary part.
@@ -29266,8 +29594,9 @@
 
 @key{INV GCD} computes the LCM (least common multiple) function.
 
-@key{INV FACT} is the gamma function.  @c{$\Gamma(x) = (x-1)!$}
-@cite{gamma(x) = (x-1)!}.
+@key{INV FACT} is the gamma function.  
+@texline @tmath{\Gamma(x) = (x-1)!}.
+@infoline @expr{gamma(x) = (x-1)!}.
 
 @key{PERM} is the number-of-permutations function, which is on the
 @kbd{H k c} key in normal Calc.
@@ -29382,13 +29711,13 @@
 For example, you could simulate @key{MAP^} using @key{MAP$} with
 the formula @samp{x^y}.
 
-The @kbd{"x"} key pushes the variable name @cite{x} onto the
-stack.  To build the formula @cite{x^2 + 6}, you would use the
+The @kbd{"x"} key pushes the variable name @expr{x} onto the
+stack.  To build the formula @expr{x^2 + 6}, you would use the
 key sequence @kbd{"x" 2 y^x 6 +}.  This formula would then be
 suitable for use with the @key{MAP$} key described above.
 With @key{INV}, @key{HYP}, or @key{INV} and @key{HYP}, the
-@kbd{"x"} key pushes the variable names @cite{y}, @cite{z}, and
-@cite{t}, respectively.
+@kbd{"x"} key pushes the variable names @expr{y}, @expr{z}, and
+@expr{t}, respectively.
 
 @node Keypad Modes Menu, , Keypad Vectors Menu, Keypad Mode
 @section Modes Menu
@@ -29553,7 +29882,7 @@
 @end example
 
 @noindent
-The formula @cite{n>2} will be pushed onto the Calc stack, and
+The formula @expr{n>2} will be pushed onto the Calc stack, and
 the top of stack will be copied back into the editing buffer.
 This means that spaces will appear around the @samp{>} symbol
 to match Calc's usual display style:
@@ -29681,8 +30010,7 @@
 
 Embedded buffers remember active formulas for as long as they
 exist in Emacs memory.  Suppose you have an embedded formula
-which is @c{$\pi$}
-@cite{pi} to the normal 12 decimal places, and then
+which is @cpi{} to the normal 12 decimal places, and then
 type @w{@kbd{C-u 5 d n}} to display only five decimal places.
 If you then type @kbd{d n}, all 12 places reappear because the
 full number is still there on the Calc stack.  More surprisingly,
@@ -29820,9 +30148,9 @@
 @end example
 
 @noindent
-records @cite{5} as the stored value of @code{foo} for the
+records @expr{5} as the stored value of @code{foo} for the
 purposes of Embedded mode operations in the current buffer.  It
-does @emph{not} actually store @cite{5} as the ``global'' value
+does @emph{not} actually store @expr{5} as the ``global'' value
 of @code{foo}, however.  Regular Calc operations, and Embedded
 formulas in other buffers, will not see this assignment.
 
@@ -29891,7 +30219,7 @@
 mode.  Then, we have to find a way to get Embedded mode to notice
 the change.  The @kbd{M-# u} or @kbd{M-# =}
 (@code{calc-embedded-update-formula}) command is a convenient way
-to do this.@refill
+to do this.
 
 @example
 foo := 6
@@ -30458,7 +30786,7 @@
 Press shift-@kbd{X} (or the standard Emacs key sequence @kbd{C-x e}) to
 execute your keyboard macro by replaying the recorded keystrokes.
 @xref{Keyboard Macros, , , emacs, the Emacs Manual}, for further
-information.@refill
+information.
 
 When you use @kbd{X} to invoke a keyboard macro, the entire macro is
 treated as a single command by the undo and trail features.  The stack
@@ -30504,7 +30832,7 @@
 just the @key{RET} key as in this example) will be something like
 @samp{calc-User-n}.  The keyboard macro will now be available as both
 @kbd{z n} and @kbd{M-x calc-User-n}.  You can backspace and enter a more
-descriptive command name if you wish.@refill
+descriptive command name if you wish.
 
 Macros defined by @kbd{Z K} act like single commands; they are executed
 in the same way as by the @kbd{X} key.  If you wish to define the macro
@@ -30522,7 +30850,7 @@
 the macro definition into full Emacs command names, like @code{calc-pop}
 and @code{calc-add}.  Type @kbd{M-# M-#} to finish editing and update
 the definition stored on the key, or, to cancel the edit, type
-@kbd{M-# x}.@refill
+@kbd{M-# x}.
 
 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
@@ -30536,13 +30864,13 @@
 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.@refill
+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.@refill
+control characters into the buffer.
 
 @kindex M-# m
 @pindex read-kbd-macro
@@ -30646,7 +30974,7 @@
 computes two to a nonnegative integer power.  First, we push 1 on the
 stack and then swap the integer argument back to the top.  The @kbd{Z <}
 pops that argument leaving the 1 back on top of the stack.  Then, we
-repeat a multiply-by-two step however many times.@refill
+repeat a multiply-by-two step however many times.
 
 Once again, the keyboard macro is executed as it is being entered.
 In this case it is especially important to set up reasonable initial
@@ -30666,7 +30994,7 @@
 innermost enclosing @kbd{Z <} @dots{} @kbd{Z >} loop and continues
 after the @kbd{Z >}.  If the object is false, the @kbd{Z /} has no
 effect.  Thus @kbd{@var{cond} Z /} is similar to @samp{if (@var{cond}) break;}
-in the C language.@refill
+in the C language.
 
 @kindex Z (
 @kindex Z )
@@ -30680,7 +31008,7 @@
 a temporary internal counter and initializes it with the value @var{init}.
 The @kbd{Z (} command then repeatedly pushes the counter value onto the
 stack and executes @var{body} and @var{step}, adding @var{step} to the
-counter each time until the loop finishes.@refill
+counter each time until the loop finishes.
 
 @cindex Summations (by keyboard macros)
 By default, the loop finishes when the counter becomes greater than (or
@@ -30880,7 +31208,7 @@
 new function in an algebraic formula.  Suppose we enter @kbd{yow @key{RET}}.
 Then the new function can be invoked by pushing two numbers on the
 stack and typing @kbd{z m} or @kbd{x spam}, or by entering the algebraic
-formula @samp{yow(x,y)}.@refill
+formula @samp{yow(x,y)}.
 
 The fourth prompt is for the function's argument list.  This is used to
 associate values on the stack with the variables that appear in the formula.
@@ -30891,9 +31219,9 @@
 @samp{b} (respectively) in the formula, then simplify the formula and
 push the result on the stack.  In other words, @kbd{10 @key{RET} 100 z m}
 would replace the 10 and 100 on the stack with the number 210, which is
-@cite{a + 2 b} with @cite{a=10} and @cite{b=100}.  Likewise, the formula
-@samp{yow(10, 100)} will be evaluated by substituting @cite{a=10} and
-@cite{b=100} in the definition.
+@expr{a + 2 b} with @expr{a=10} and @expr{b=100}.  Likewise, the formula
+@samp{yow(10, 100)} will be evaluated by substituting @expr{a=10} and
+@expr{b=100} in the definition.
 
 You can rearrange the order of the names before pressing @key{RET} to
 control which stack positions go to which variables in the formula.  If
@@ -30911,12 +31239,12 @@
 The final prompt is a y-or-n question concerning what to do if symbolic
 arguments are given to your function.  If you answer @kbd{y}, then
 executing @kbd{z m} (using the original argument list @samp{(a b)}) with
-arguments @cite{10} and @cite{x} will leave the function in symbolic
+arguments @expr{10} and @expr{x} will leave the function in symbolic
 form, i.e., @samp{yow(10,x)}.  On the other hand, if you answer @kbd{n},
 then the formula will always be expanded, even for non-constant
 arguments: @samp{10 + 2 x}.  If you never plan to feed algebraic
 formulas to your new function, it doesn't matter how you answer this
-question.@refill
+question.
 
 If you answered @kbd{y} to this question you can still cause a function
 call to be expanded by typing @kbd{a "} (@code{calc-expand-formula}).
@@ -30931,7 +31259,7 @@
 key onto the stack.  Actually, it pushes a nameless function that
 specifies both the argument list and the defining formula.  You will get
 an error message if the key is undefined, or if the key was not defined
-by a @kbd{Z F} command.@refill
+by a @kbd{Z F} command.
 
 The @kbd{Z E} (@code{calc-user-define-edit}) command on a key that has
 been defined by a formula uses a variant of the @code{calc-edit} command
@@ -30951,7 +31279,7 @@
 used as a function definition.  For example, the formula @samp{deriv(a^2,v)}
 which might be used to define a new function @samp{dsqr(a,v)} will be
 ``simplified'' to 0 immediately upon entry since @code{deriv} considers
-@cite{a} to be constant with respect to @cite{v}.  Turning off
+@expr{a} to be constant with respect to @expr{v}.  Turning off
 default simplifications cures this problem:  The definition will be stored
 in symbolic form without ever activating the @code{deriv} function.  Press
 @kbd{m D} to turn the default simplifications back on afterwards.
@@ -31049,7 +31377,7 @@
 @code{expt}, @code{=}, @code{<}, @code{>}, @code{<=}, @code{>=},
 @code{/=}, @code{1+}, @code{1-}, @code{logand}, @code{logior}, @code{logxor},
 @code{logandc2}, @code{lognot}.  Also, @code{~=} is an abbreviation for
-@code{math-nearly-equal}, which is useful in implementing Taylor series.@refill
+@code{math-nearly-equal}, which is useful in implementing Taylor series.
 
 For other functions @var{func}, if a function by the name
 @samp{calcFunc-@var{func}} exists it is used, otherwise if a function by the
@@ -31057,13 +31385,13 @@
 is defined as a function it is used, otherwise @samp{calcFunc-@var{func}} is
 used on the assumption that this is a to-be-defined math function.  Also, if
 the function name is quoted as in @samp{('integerp a)} the function name is
-always used exactly as written (but not quoted).@refill
+always used exactly as written (but not quoted).
 
 Variable names have @samp{var-} prepended to them unless they appear in
 the function's argument list or in an enclosing @code{let}, @code{let*},
 @code{for}, or @code{foreach} form,
 or their names already contain a @samp{-} character.  Thus a reference to
-@samp{foo} is the same as a reference to @samp{var-foo}.@refill
+@samp{foo} is the same as a reference to @samp{var-foo}.
 
 A few other Lisp extensions are available in @code{defmath} definitions:
 
@@ -31081,18 +31409,18 @@
 a synonym of @code{setq}.)  Specifically, the first argument of
 @code{setq} can be an @code{nth}, @code{elt}, @code{car}, or @code{cdr} form,
 in which case the effect is to store into the specified
-element of a list.  Thus, @samp{(setq (elt m i j) x)} stores @cite{x}
+element of a list.  Thus, @samp{(setq (elt m i j) x)} stores @expr{x}
 into one element of a matrix.
 
 @item
 A @code{for} looping construct is available.  For example,
 @samp{(for ((i 0 10)) body)} executes @code{body} once for each
-binding of @cite{i} from zero to 10.  This is like a @code{let}
-form in that @cite{i} is temporarily bound to the loop count
+binding of @expr{i} from zero to 10.  This is like a @code{let}
+form in that @expr{i} is temporarily bound to the loop count
 without disturbing its value outside the @code{for} construct.
 Nested loops, as in @samp{(for ((i 0 10) (j 0 (1- i) 2)) body)},
-are also available.  For each value of @cite{i} from zero to 10,
-@cite{j} counts from 0 to @cite{i-1} in steps of two.  Note that
+are also available.  For each value of @expr{i} from zero to 10,
+@expr{j} counts from 0 to @expr{i-1} in steps of two.  Note that
 @code{for} has the same general outline as @code{let*}, except
 that each element of the header is a list of three or four
 things, not just two.
@@ -31100,8 +31428,8 @@
 @item
 The @code{foreach} construct loops over elements of a list.
 For example, @samp{(foreach ((x (cdr v))) body)} executes
-@code{body} with @cite{x} bound to each element of Calc vector
-@cite{v} in turn.  The purpose of @code{cdr} here is to skip over
+@code{body} with @expr{x} bound to each element of Calc vector
+@expr{v} in turn.  The purpose of @code{cdr} here is to skip over
 the initial @code{vec} symbol in the vector.
 
 @item
@@ -31112,7 +31440,7 @@
 
 @item
 The @code{return} function prematurely returns from the enclosing
-function.  For example, @samp{(return (+ x y))} returns @cite{x+y}
+function.  For example, @samp{(return (+ x y))} returns @expr{x+y}
 as the value of a function.  You can use @code{return} anywhere
 inside the body of the function.
 @end itemize
@@ -31464,7 +31792,7 @@
 
 In this example, the command @code{calc-foo} will evaluate the expression
 @samp{foo(a,b)} if executed with no argument, or @samp{foo(a,b,n)} if
-executed with a numeric prefix argument of @cite{n}.
+executed with a numeric prefix argument of @expr{n}.
 
 The other code string allowed is @samp{"m"} (unrelated to the usual @samp{"m"}
 code as used with @code{defun}).  It uses the numeric prefix argument as the
@@ -31501,7 +31829,7 @@
 The argument must not be an incomplete vector, interval, or complex number.
 (This is rarely needed since the Calculator itself will never call your
 function with an incomplete argument.  But there is nothing stopping your
-own Lisp code from calling your function with an incomplete argument.)@refill
+own Lisp code from calling your function with an incomplete argument.)
 
 @item integer
 @findex integer
@@ -31665,8 +31993,9 @@
 @end ignore
 @tindex mysin
 A somewhat limited sine function could be defined as follows, using the
-well-known Taylor series expansion for @c{$\sin x$}
-@samp{sin(x)}:
+well-known Taylor series expansion for 
+@texline @tmath{\sin x}:
+@infoline @samp{sin(x)}:
 
 @smallexample
 (defmath mysin ((float (anglep x)))
@@ -31688,8 +32017,7 @@
 @end smallexample
 
 The actual @code{sin} function in Calc works by first reducing the problem
-to a sine or cosine of a nonnegative number less than @c{$\pi \over 4$}
-@cite{pi/4}.  This
+to a sine or cosine of a nonnegative number less than @cpiover{4}.  This
 ensures that the Taylor series will converge quickly.  Also, the calculation
 is carried out with two extra digits of precision to guard against cumulative
 round-off in @samp{sum}.  Finally, complex arguments are allowed and handled
@@ -31724,10 +32052,9 @@
 series as before, and @code{mycos-raw} is a function analogous to
 @code{mysin-raw} for cosines.
 
-The strategy is to ensure that @cite{x} is nonnegative before calling
+The strategy is to ensure that @expr{x} is nonnegative before calling
 @code{mysin-raw}.  This function then recursively reduces its argument
-to a suitable range, namely, plus-or-minus @c{$\pi \over 4$}
-@cite{pi/4}.  Note that each
+to a suitable range, namely, plus-or-minus @cpiover{4}.  Note that each
 test, and particularly the first comparison against 7, is designed so
 that small roundoff errors cannot produce an infinite loop.  (Suppose
 we compared with @samp{(two-pi)} instead; if due to roundoff problems
@@ -31877,8 +32204,8 @@
 when the user has left Calc in symbolic mode or no-simplify mode.
 
 As another example, @samp{(equal (calc-eval '("$<$$") nil a b) "1")}
-checks if the number in string @cite{a} is less than the one in
-string @cite{b}.  Without using a list, the integer 1 might
+checks if the number in string @expr{a} is less than the one in
+string @expr{b}.  Without using a list, the integer 1 might
 come out in a variety of formats which would be hard to test for
 conveniently: @code{"1"}, @code{"8#1"}, @code{"00001"}.  (But
 see ``Predicates'' mode, below.)
@@ -32218,13 +32545,13 @@
 are that the number 0.0 is always stored as @samp{(float 0 0)}, and,
 except for the 0.0 case, the rightmost base-10 digit of @var{mant} is
 always nonzero.  (If the rightmost digit is zero, the number is
-rearranged by dividing @var{mant} by ten and incrementing @var{exp}.)@refill
+rearranged by dividing @var{mant} by ten and incrementing @var{exp}.)
 
 Rectangular complex numbers are stored in the form @samp{(cplx @var{re}
 @var{im})}, where @var{re} and @var{im} are each real numbers, either
 integers, fractions, or floats.  The value is @samp{@var{re} + @var{im}i}.
 The @var{im} part is nonzero; complex numbers with zero imaginary
-components are converted to real numbers automatically.@refill
+components are converted to real numbers automatically.
 
 Polar complex numbers are stored in the form @samp{(polar @var{r}
 @var{theta})}, where @var{r} is a positive real value and @var{theta}
@@ -32233,13 +32560,13 @@
 or @samp{(-pi ..@: pi)} radians, according to the current angular mode.
 If the angle is 0 the value is converted to a real number automatically.
 (If the angle is 180 degrees, the value is usually also converted to a
-negative real number.)@refill
+negative real number.)
 
 Hours-minutes-seconds forms are stored as @samp{(hms @var{h} @var{m}
 @var{s})}, where @var{h} is an integer or an integer-valued float (i.e.,
 a float with @samp{@var{exp} >= 0}), @var{m} is an integer or integer-valued
 float in the range @w{@samp{[0 ..@: 60)}}, and @var{s} is any real number
-in the range @samp{[0 ..@: 60)}.@refill
+in the range @samp{[0 ..@: 60)}.
 
 Date forms are stored as @samp{(date @var{n})}, where @var{n} is
 a real number that counts days since midnight on the morning of
@@ -32293,7 +32620,7 @@
 which represent units are not stored in any special way; they are units
 only because their names appear in the units table.  If the value
 cell contains a string, it is parsed to get the variable's value when
-the variable is used.@refill
+the variable is used.
 
 A Lisp list with any other symbol as the first element is a function call.
 The symbols @code{+}, @code{-}, @code{*}, @code{/}, @code{%}, @code{^},
@@ -32313,7 +32640,7 @@
 wish to return multiple values.  (The latter case is allowed only for
 functions which are the outer-level call in an expression whose value is
 about to be pushed on the stack; this feature is considered obsolete
-and is not used by any built-in Calc functions.)@refill
+and is not used by any built-in Calc functions.)
 
 @node Interactive Lisp Functions, Stack Lisp Functions, Data Type Formats, Internals
 @subsubsection Interactive Functions
@@ -32349,7 +32676,7 @@
 previously void); or @samp{(eval @var{undo} @var{redo} @var{args} @dots{})},
 which means that to undo requires calling the function @samp{(@var{undo}
 @var{args} @dots{})} and, if the undo is later redone, calling
-@samp{(@var{redo} @var{args} @dots{})}.@refill
+@samp{(@var{redo} @var{args} @dots{})}.
 @end defun
 
 @defun calc-record-why msg args
@@ -32364,7 +32691,7 @@
 (such as @code{integerp} or @code{numvecp}) which the arguments did not
 satisfy; it is expanded to a suitable string such as ``Expected an
 integer.''  The @code{reject-arg} function calls @code{calc-record-why}
-automatically; @pxref{Predicates}.@refill
+automatically; @pxref{Predicates}.
 @end defun
 
 @defun calc-is-inverse
@@ -32391,7 +32718,7 @@
 end up at level @var{n}, the next-to-last at level @var{n}+1, etc.
 The elements of @var{vals} are assumed to be valid Calc objects, and
 are not evaluated, rounded, or renormalized in any way.  If @var{vals}
-is an empty list, nothing happens.@refill
+is an empty list, nothing happens.
 
 The stack elements are pushed without any sub-formula selections.
 You can give an optional third argument to this function, which must
@@ -32410,7 +32737,7 @@
 element will be next-to-last, etc.  If @var{n} or @var{m} are out of
 range, the command is aborted with a suitable error message.  If @var{n}
 is zero, the function returns an empty list.  The stack elements are not
-evaluated, rounded, or renormalized.@refill
+evaluated, rounded, or renormalized.
 
 If any stack elements contain selections, and selections have not
 been disabled by the @kbd{j e} (@code{calc-enable-selections}) command,
@@ -32506,7 +32833,7 @@
 argument to apply the operator over many stack entries.  If the prefix
 argument @var{arg} is @code{nil}, this uses @code{calc-enter-result}
 as outlined above.  Otherwise, it maps the function over several stack
-elements; @pxref{Prefix Arguments}.  For example,@refill
+elements; @pxref{Prefix Arguments}.  For example,
 
 @smallexample
 (defun calc-zeta (arg)
@@ -32527,7 +32854,7 @@
 the binary function @var{func} is reduced across the top @var{arg}
 stack elements; when the argument is negative, the function is
 mapped between the next-to-top @i{-@var{arg}} stack elements and the
-top element.@refill
+top element.
 @end defun
 
 @defun calc-stack-size
@@ -32541,7 +32868,7 @@
 will be the @samp{.} line.  If @var{n} is from 1 to the current stack size,
 this will be the beginning of the first line of that stack entry's display.
 If line numbers are enabled, this will move to the first character of the
-line number, not the stack entry itself.@refill
+line number, not the stack entry itself.
 @end defun
 
 @defun calc-substack-height n
@@ -32551,7 +32878,7 @@
 one line long (i.e., no matrices are displayed), the return value will
 be equal @var{n}+1 as long as @var{n} is in range.  (Note that in Big
 mode, the return value includes the blank lines that separate stack
-entries.)@refill
+entries.)
 @end defun
 
 @defun calc-refresh
@@ -32560,7 +32887,7 @@
 display radix, which might change the appearance of existing stack
 entries.  (During a keyboard macro invoked by the @kbd{X} key, refreshing
 is suppressed, but a flag is set so that the entire stack will be refreshed
-rather than just the top few elements when the macro finishes.)@refill
+rather than just the top few elements when the macro finishes.)
 @end defun
 
 @node Predicates, Computational Lisp Functions, Stack Lisp Functions, Internals
@@ -32739,7 +33066,7 @@
 by checking whether @samp{@var{x} - @var{y}} is @code{negp}.  In
 @code{defmath}, the expression @samp{(< x y)} will automatically be
 converted to @samp{(lessp x y)}; expressions involving @code{>}, @code{<=},
-and @code{>=} are similarly converted in terms of @code{lessp}.@refill
+and @code{>=} are similarly converted in terms of @code{lessp}.
 @end defun
 
 @defun beforep x y
@@ -32771,7 +33098,7 @@
 Returns true if @var{x} and @var{n} are numerically equal, where @var{n}
 is a fixnum which is not a multiple of 10.  This will automatically be
 used by @code{defmath} in place of the more general @code{math-equal}
-whenever possible.@refill
+whenever possible.
 @end defun
 
 @defun nearly-equal x y
@@ -32808,7 +33135,7 @@
 Abort the current function evaluation due to unacceptable argument values.
 This calls @samp{(calc-record-why @var{pred} @var{val})}, then signals a
 Lisp error which @code{normalize} will trap.  The net effect is that the
-function call which led here will be left in symbolic form.@refill
+function call which led here will be left in symbolic form.
 @end defun
 
 @defun inexact-value
@@ -32819,7 +33146,7 @@
 @code{sin} function will call @code{inexact-value}, which will cause your
 function to be left unsimplified.  You may instead wish to call
 @samp{(normalize (list 'calcFunc-sin 5))}, which in Symbolic Mode will
-return the formula @samp{sin(5)} to your function.@refill
+return the formula @samp{sin(5)} to your function.
 @end defun
 
 @defun overflow
@@ -32840,13 +33167,13 @@
 the documentation refers to the @code{calc-sqrt} [@code{sqrt}] command,
 this means @code{calc-sqrt} is an interactive stack-based square-root
 command and @code{sqrt} (which @code{defmath} expands to @code{calcFunc-sqrt})
-is the actual Lisp function for taking square roots.@refill
+is the actual Lisp function for taking square roots.
 
 The functions @code{math-add}, @code{math-sub}, @code{math-mul},
 @code{math-div}, @code{math-mod}, and @code{math-neg} are not included
 in this list, since @code{defmath} allows you to write native Lisp
 @code{+}, @code{-}, @code{*}, @code{/}, @code{%}, and unary @code{-},
-respectively, instead.@refill
+respectively, instead.
 
 @defun normalize val
 (Full form: @code{math-normalize}.)
@@ -32857,12 +33184,12 @@
 small.  All the various data types are similarly converted to their standard
 forms.  Variables are left alone, but function calls are actually evaluated
 in formulas.  For example, normalizing @samp{(+ 2 (calcFunc-abs -4))} will
-return 6.@refill
+return 6.
 
 If a function call fails, because the function is void or has the wrong
 number of parameters, or because it returns @code{nil} or calls
 @code{reject-arg} or @code{inexact-result}, @code{normalize} returns
-the formula still in symbolic form.@refill
+the formula still in symbolic form.
 
 If the current Simplification Mode is ``none'' or ``numeric arguments
 only,'' @code{normalize} will act appropriately.  However, the more
@@ -32871,13 +33198,13 @@
 which calls @code{normalize} and possibly some other routines, such
 as @code{simplify} or @code{simplify-units}.  Programs generally will
 never call @code{calc-normalize} except when popping or pushing values
-on the stack.@refill
+on the stack.
 @end defun
 
 @defun evaluate-expr expr
 Replace all variables in @var{expr} that have values with their values,
 then use @code{normalize} to simplify the result.  This is what happens
-when you press the @kbd{=} key interactively.@refill
+when you press the @kbd{=} key interactively.
 @end defun
 
 @defmac with-extra-prec n body
@@ -32948,7 +33275,7 @@
 Compare the numbers @var{x} and @var{y}, and return @i{-1} if
 @samp{(lessp @var{x} @var{y})}, 1 if @samp{(lessp @var{y} @var{x})},
 0 if @samp{(math-equal @var{x} @var{y})}, or 2 if the order is
-undefined or cannot be determined.@refill
+undefined or cannot be determined.
 @end defun
 
 @defun numdigs n
@@ -33000,13 +33327,13 @@
 @defun idivmod x y
 Divide integer @var{x} by integer @var{y}; return a cons cell whose
 @code{car} is @samp{(quotient @var{x} @var{y})} and whose @code{cdr}
-is @samp{(imod @var{x} @var{y})}.@refill
+is @samp{(imod @var{x} @var{y})}.
 @end defun
 
 @defun pow x y
 Compute @var{x} to the power @var{y}.  In @code{defmath} code, this can
 also be written @samp{(^ @var{x} @var{y})} or
-@w{@samp{(expt @var{x} @var{y})}}.@refill
+@w{@samp{(expt @var{x} @var{y})}}.
 @end defun
 
 @defun abs-approx x
@@ -33030,7 +33357,7 @@
 @code{pi-over-2}, @code{pi-over-4}, @code{pi-over-180}, @code{sqrt-two-pi},
 @code{e}, @code{sqrt-e}, @code{ln-2}, and @code{ln-10}.  Each function
 returns a floating-point value in the current precision, and each uses
-caching so that all calls after the first are essentially free.@refill
+caching so that all calls after the first are essentially free.
 @end defun
 
 @defmac math-defcache @var{func} @var{initial} @var{form}
@@ -33045,7 +33372,7 @@
 two least significant digits is stored in the cache.  For example,
 calling @samp{(pi)} with a precision of 30 computes @samp{pi} to 34
 digits, rounds it down to 32 digits for future use, then rounds it
-again to 30 digits for use in the present request.@refill
+again to 30 digits for use in the present request.
 @end defmac
 
 @findex half-circle
@@ -33072,7 +33399,7 @@
 
 @defun div-mod a b m
 Divide @var{a} by @var{b}, modulo @var{m}.  This returns @code{nil} if
-there is no solution, or if any of the arguments are not integers.@refill
+there is no solution, or if any of the arguments are not integers.
 @end defun
 
 @defun pow-mod a b m
@@ -33147,7 +33474,7 @@
 @var{iters} parameter is the number of Fermat iterations to use, in the
 case that this is necessary.  If @code{prime-test} returns ``maybe,''
 you can call it again with the same @var{n} to get a greater certainty;
-@code{prime-test} remembers where it left off.@refill
+@code{prime-test} remembers where it left off.
 @end defun
 
 @defun to-simple-fraction f
@@ -33198,7 +33525,7 @@
 produce lists of more than two dimensions.  Note that the object
 @samp{[[1, 2, 3], [4, 5]]} is a vector of vectors not all the same size,
 and is treated by this and other Calc routines as a plain vector of two
-elements.@refill
+elements.
 @end defun
 
 @defun dimension-error
@@ -33246,7 +33573,7 @@
 For example, @samp{(map-vec-2 'math-add v 1)} returns the vector @var{v}
 with each element increased by one.  Note that using @samp{'+} would not
 work here, since @code{defmath} does not expand function names everywhere,
-just where they are in the function position of a Lisp expression.@refill
+just where they are in the function position of a Lisp expression.
 @end defun
 
 @defun reduce-vec f v
@@ -33296,7 +33623,7 @@
 element of the result matrix will be @code{eq} to the corresponding
 element of @var{m}, but none of the @code{cons} cells that make up
 the structure of the matrix will be @code{eq}.  If @var{m} is a plain
-vector, this is the same as @code{copy-sequence}.@refill
+vector, this is the same as @code{copy-sequence}.
 @end defun
 
 @defun swap-rows m r1 r2
@@ -33305,7 +33632,7 @@
 function changes @var{m} itself rather than building up a new result
 matrix.  The return value is @var{m}, i.e., @samp{(eq (swap-rows m 1 2) m)}
 is true, with the side effect of exchanging the first two rows of
-@var{m}.@refill
+@var{m}.
 @end defun
 
 @node Symbolic Lisp Functions, Formatting Lisp Functions, Vector Lisp Functions, Internals
@@ -33443,7 +33770,7 @@
 implemented by temporarily binding the variable @code{math-living-dangerously}
 to @code{t} (using a @code{let} form) and calling @code{simplify}.
 Dangerous simplification rules are written to check this variable
-before taking any action.@refill
+before taking any action.
 @end defun
 
 @defun simplify-units expr
@@ -33465,7 +33792,7 @@
 if it returns a result @code{equal} to the original @code{expr}, it is
 ignored and Calc goes on to try the next simplification rule that applies.
 If the function body returns something different, that new formula is
-substituted for @var{expr} in the original formula.@refill
+substituted for @var{expr} in the original formula.
 
 At each point in the formula, rules are tried in the order of the
 original calls to @code{math-defsimplify}; the search stops after the
@@ -33498,7 +33825,7 @@
 This is really a pair of rules written with one @code{math-defsimplify}
 for convenience; the first replaces @samp{arcsinh(-x)} with
 @samp{-arcsinh(x)}, and the second, which is safe only for real @samp{x},
-replaces @samp{arcsinh(sinh(x))} with @samp{x}.@refill
+replaces @samp{arcsinh(sinh(x))} with @samp{x}.
 @end defmac
 
 @defun common-constant-factor expr
@@ -33533,7 +33860,7 @@
 rational numbers.  This is the fraction composed of the GCD of the
 numerators of @var{a} and @var{b}, over the GCD of the denominators.
 It is used by @code{common-constant-factor}.  Note that the standard
-@code{gcd} function uses the LCM to combine the denominators.@refill
+@code{gcd} function uses the LCM to combine the denominators.
 @end defun
 
 @defun map-tree func expr many
@@ -33548,7 +33875,7 @@
 @var{func} functions may @emph{not} make destructive changes to
 @var{expr}.  If a third argument @var{many} is provided, it is an
 integer which says how many times @var{func} may be applied; the
-default, as described above, is infinitely many times.@refill
+default, as described above, is infinitely many times.
 @end defun
 
 @defun compile-rewrites rules
@@ -33665,14 +33992,14 @@
 cosines of more complicated arguments.  An integration rule should return
 @code{nil} if it can't do the integral; if several rules are defined for
 the same function, they are tried in order until one returns a non-@code{nil}
-result.@refill
+result.
 @end defmac
 
 @defmac math-defintegral-2 funcs body
 Define a rule for integrating a function or functions of two arguments.
 This is exactly analogous to @code{math-defintegral}, except that @var{body}
 is written as the body of a function with two arguments, @var{u} and
-@var{v}.@refill
+@var{v}.
 @end defmac
 
 @defun solve-for lhs rhs var full
@@ -33685,7 +34012,7 @@
 which return a rearranged equation or a functional inverse, respectively.
 If @var{full} is non-@code{nil}, a full solution including dummy signs
 and dummy integers will be produced.  User-defined inverses are provided
-as properties in a manner similar to derivatives:@refill
+as properties in a manner similar to derivatives:
 
 @smallexample
 (put 'calcFunc-ln 'math-inverse
@@ -33721,12 +34048,12 @@
 @code{expr-contains} uses @code{equal} to test for matches, whereas
 @code{calc-find-sub-formula} uses @code{eq}.  In the formula
 @samp{f(a, a)}, the two @samp{a}s will be @code{equal} but not
-@code{eq} to each other.@refill
+@code{eq} to each other.
 @end defun
 
 @defun expr-contains-count expr var
 Returns the number of occurrences of @var{var} as a subexpression
-of @var{expr}, or @code{nil} if there are no occurrences.@refill
+of @var{expr}, or @code{nil} if there are no occurrences.
 @end defun
 
 @defun expr-depends expr var
@@ -33744,7 +34071,7 @@
 Returns a copy of @var{expr}, with all occurrences of @var{old} replaced
 by @var{new}.  This treats @code{lambda} forms specially with respect
 to the dummy argument variables, so that the effect is always to return
-@var{expr} evaluated at @var{old} = @var{new}.@refill
+@var{expr} evaluated at @var{old} = @var{new}.
 @end defun
 
 @defun multi-subst expr old new
@@ -33763,7 +34090,7 @@
 @defun expr-height expr
 Returns the ``height'' of @var{expr}, which is the deepest level to
 which function calls are nested.  (Note that @samp{@var{a} + @var{b}}
-counts as a function call.)  For primitive objects, this returns zero.@refill
+counts as a function call.)  For primitive objects, this returns zero.
 @end defun
 
 @defun polynomial-p expr var
@@ -33775,7 +34102,7 @@
 (@code{calc-expand}), would consist of a sum of terms in which @var{var}
 appears only raised to nonnegative integer powers.  Note that if
 @var{var} does not occur in @var{expr}, then @var{expr} is considered
-a polynomial of degree 0.@refill
+a polynomial of degree 0.
 @end defun
 
 @defun is-polynomial expr var degree loose
@@ -33797,7 +34124,7 @@
 themselves.  For example, @samp{sin(x) x^2 + cos(x)} is a loose
 polynomial with coefficients @samp{((calcFunc-cos x) 0 (calcFunc-sin
 x))}.  The result will never be @code{nil} in loose mode, since any
-expression can be interpreted as a ``constant'' loose polynomial.@refill
+expression can be interpreted as a ``constant'' loose polynomial.
 @end defun
 
 @defun polynomial-base expr pred
@@ -33810,7 +34137,7 @@
 The default predicate uses @samp{(polynomial-p mpb-top-expr @var{subexpr})};
 you can use @var{pred} to specify additional conditions.  Or, you could
 have @var{pred} build up a list of every suitable @var{subexpr} that
-is found.@refill
+is found.
 @end defun
 
 @defun poly-simplify poly
@@ -33822,7 +34149,7 @@
 Mix two polynomial lists @var{a} and @var{b} (in the form returned by
 @code{is-polynomial}) in a linear combination with coefficient expressions
 @var{ac} and @var{bc}.  The result is a (not necessarily simplified)
-polynomial list representing @samp{@var{ac} @var{a} + @var{bc} @var{b}}.@refill
+polynomial list representing @samp{@var{ac} @var{a} + @var{bc} @var{b}}.
 @end defun
 
 @defun poly-mul a b
@@ -33835,7 +34162,7 @@
 list @var{poly} applied to variable @var{var}.  The @kbd{a c}
 (@code{calc-collect}) command uses @code{is-polynomial} to turn an
 expression into a coefficient list, then @code{build-polynomial-expr}
-to turn the list back into an expression in regular form.@refill
+to turn the list back into an expression in regular form.
 @end defun
 
 @defun check-unit-name var
@@ -33852,7 +34179,7 @@
 Return true if @var{expr} contains any variables which can be
 interpreted as units.  If @var{sub-exprs} is @code{t}, the entire
 expression is searched.  If @var{sub-exprs} is @code{nil}, this
-checks whether @var{expr} is directly a units expression.@refill
+checks whether @var{expr} is directly a units expression.
 @end defun
 
 @defun single-units-in-expr-p expr
@@ -33867,7 +34194,7 @@
 is @code{nil}, use Calc's native base units.  Otherwise, @var{which}
 can specify a units system, which is a list of two-element lists,
 where the first element is a Calc base symbol name and the second
-is an expression to substitute for it.@refill
+is an expression to substitute for it.
 @end defun
 
 @defun remove-units expr
@@ -33903,7 +34230,7 @@
 not have the form of a valid expression, return a list of the form
 @samp{(error @var{pos} @var{msg})} where @var{pos} is an integer index
 into @var{str} of the general location of the error, and @var{msg} is
-a string describing the problem.@refill
+a string describing the problem.
 @end defun
 
 @defun read-exprs str
@@ -33922,14 +34249,14 @@
 If @var{prompt} is given, it is the prompt string to use; the default
 is ``Algebraic:''.  If @var{no-norm} is @code{t}, the formulas will
 be returned exactly as parsed; otherwise, they will be passed through
-@code{calc-normalize} first.@refill
+@code{calc-normalize} first.
 
 To support the use of @kbd{$} characters in the algebraic entry, use
 @code{let} to bind @code{calc-dollar-values} to a list of the values
 to be substituted for @kbd{$}, @kbd{$$}, and so on, and bind
 @code{calc-dollar-used} to 0.  Upon return, @code{calc-dollar-used}
 will have been changed to the highest number of consecutive @kbd{$}s
-that actually appeared in the input.@refill
+that actually appeared in the input.
 @end defun
 
 @defun format-number a
@@ -33945,7 +34272,7 @@
 complex number format, and point character, are ignored to ensure the
 result will be re-readable.  The @var{prec} parameter is normally 0; if
 you pass a large integer like 1000 instead, the expression will be
-surrounded by parentheses unless it is a plain number or variable name.@refill
+surrounded by parentheses unless it is a plain number or variable name.
 @end defun
 
 @defun format-nice-expr a width
@@ -33964,7 +34291,7 @@
 contain newline characters to separate the lines.  The @var{w}
 parameter, if given, is the target window size for which to format
 the expressions.  If @var{w} is omitted, the width of the Calculator
-window is used.@refill
+window is used.
 @end defun
 
 @defun compose-expr a prec
@@ -34012,7 +34339,7 @@
 @defun comp-first-char c
 If composition @var{c} is a ``flat'' composition, return the first
 (leftmost) character of the composition as an integer.  Otherwise,
-return @code{nil}.@refill
+return @code{nil}.
 @end defun
 
 @defun comp-last-char c
@@ -34192,7 +34519,7 @@
 to the appropriate file name.  You may also need to change the variables
 @code{calc-gnuplot-plot-command} and @code{calc-gnuplot-print-command} in
 order to get correct displays and hardcopies, respectively, of your
-plots.@refill
+plots.
 
 @ifinfo
 @example
@@ -34207,7 +34534,7 @@
 @TeX{} typesetting program (this is a free program by Donald Knuth
 at Stanford University) as well as the @file{texindex} program and
 @file{texinfo.tex} file, both of which can be obtained from the FSF
-as part of the @code{texinfo} package.@refill
+as part of the @code{texinfo} package.
 
 To print the Calc manual in one huge 470 page tome, you will need the
 source code to this manual, @file{calc.texi}, available as part of the
@@ -34253,7 +34580,7 @@
 @code{".emacs"} as a substring, 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.@refill
+Calc is invoked.
 
 @ifinfo
 @example
@@ -35194,21 +35521,21 @@
 @enumerate
 @c 1
 @item
-Positive prefix arguments apply to @cite{n} stack entries.
-Negative prefix arguments apply to the @cite{-n}th stack entry.
+Positive prefix arguments apply to @expr{n} stack entries.
+Negative prefix arguments apply to the @expr{-n}th stack entry.
 A prefix of zero applies to the entire stack.  (For @key{LFD} and
 @kbd{M-@key{DEL}}, the meaning of the sign is reversed.)
 
 @c 2
 @item
-Positive prefix arguments apply to @cite{n} stack entries.
+Positive prefix arguments apply to @expr{n} stack entries.
 Negative prefix arguments apply to the top stack entry
-and the next @cite{-n} stack entries.
+and the next @expr{-n} stack entries.
 
 @c 3
 @item
-Positive prefix arguments rotate top @cite{n} stack entries by one.
-Negative prefix arguments rotate the entire stack by @cite{-n}.
+Positive prefix arguments rotate top @expr{n} stack entries by one.
+Negative prefix arguments rotate the entire stack by @expr{-n}.
 A prefix of zero reverses the entire stack.
 
 @c 4
@@ -35217,8 +35544,8 @@
 
 @c 5
 @item
-Positive prefix arguments specify a precision @cite{p}.
-Negative prefix arguments reduce the current precision by @cite{-p}.
+Positive prefix arguments specify a precision @expr{p}.
+Negative prefix arguments reduce the current precision by @expr{-p}.
 
 @c 6
 @item
@@ -35236,17 +35563,17 @@
 
 @c 9
 @item
-Positive prefix arguments specify a word size of @cite{w} bits, unsigned.
-Negative prefix arguments specify a word size of @cite{w} bits, signed.
+Positive prefix arguments specify a word size of @expr{w} bits, unsigned.
+Negative prefix arguments specify a word size of @expr{w} bits, signed.
 
 @c 10
 @item
-Prefix arguments specify the shift amount @cite{n}.  The @cite{w} argument
+Prefix arguments specify the shift amount @expr{n}.  The @expr{w} argument
 cannot be specified in the keyboard version of this command.
 
 @c 11
 @item
-From the keyboard, @cite{d} is omitted and defaults to zero.
+From the keyboard, @expr{d} is omitted and defaults to zero.
 
 @c 12
 @item
@@ -35259,16 +35586,16 @@
 
 @c 14
 @item
-A prefix argument, if any, is used for @cite{m} instead of taking
-@cite{m} from the stack.  @cite{M} may take any of these values:
+A prefix argument, if any, is used for @expr{m} instead of taking
+@expr{m} from the stack.  @expr{M} may take any of these values:
 @iftex
 {@advance@tableindent10pt
 @end iftex
 @table @asis
 @item Integer
-Random integer in the interval @cite{[0 .. m)}.
+Random integer in the interval @expr{[0 .. m)}.
 @item Float
-Random floating-point number in the interval @cite{[0 .. m)}.
+Random floating-point number in the interval @expr{[0 .. m)}.
 @item 0.0
 Gaussian with mean 1 and standard deviation 0.
 @item Error form
@@ -35308,20 +35635,21 @@
 
 @c 20
 @item
-With a prefix argument of 1, take a single @c{$@var{n}\times2$}
-@i{@var{N}x2} matrix from the
-stack instead of two separate data vectors.
+With a prefix argument of 1, take a single 
+@texline @tmath{@var{n}\times2}
+@infoline @i{@var{N}x2} 
+matrix from the stack instead of two separate data vectors.
 
 @c 21
 @item
-The row or column number @cite{n} may be given as a numeric prefix
-argument instead.  A plain @kbd{C-u} prefix says to take @cite{n}
-from the top of the stack.  If @cite{n} is a vector or interval,
+The row or column number @expr{n} may be given as a numeric prefix
+argument instead.  A plain @kbd{C-u} prefix says to take @expr{n}
+from the top of the stack.  If @expr{n} is a vector or interval,
 a subvector/submatrix of the input is created.
 
 @c 22
 @item
-The @cite{op} prompt can be answered with the key sequence for the
+The @expr{op} prompt can be answered with the key sequence for the
 desired function, or with @kbd{x} or @kbd{z} followed by a function name,
 or with @kbd{$} to take a formula from the top of the stack, or with
 @kbd{'} and a typed formula.  In the last two cases, the formula may
@@ -35336,7 +35664,7 @@
 One of the mapping direction keys @kbd{_} (horizontal, i.e., map
 by rows or reduce across), @kbd{:} (vertical, i.e., map by columns or
 reduce down), or @kbd{=} (map or reduce by rows) may be used before
-entering @cite{op}; these modify the function name by adding the letter
+entering @expr{op}; these modify the function name by adding the letter
 @code{r} for ``rows,'' @code{c} for ``columns,'' @code{a} for ``across,''
 or @code{d} for ``down.''
 
@@ -35374,7 +35702,7 @@
 @item -11
 (@var{2})  Float with integer mantissa.
 @item -12
-(@var{2})  Float with mantissa in @cite{[1 .. 10)}.
+(@var{2})  Float with mantissa in @expr{[1 .. 10)}.
 @item -13
 (@var{1})  Date form (using date numbers).
 @item -14
@@ -35388,13 +35716,13 @@
 
 @c 25
 @item
-A prefix argument specifies the size @cite{n} of the matrix.  With no
-prefix argument, @cite{n} is omitted and the size is inferred from
+A prefix argument specifies the size @expr{n} of the matrix.  With no
+prefix argument, @expr{n} is omitted and the size is inferred from
 the input vector.
 
 @c 26
 @item
-The prefix argument specifies the starting position @cite{n} (default 1).
+The prefix argument specifies the starting position @expr{n} (default 1).
 
 @c 27
 @item
@@ -35460,16 +35788,16 @@
 
 @c 39
 @item
-Answer for @cite{v} may also be of the form @cite{v = v_0} or
-@cite{v - v_0}.
+Answer for @expr{v} may also be of the form @expr{v = v_0} or
+@expr{v - v_0}.
 
 @c 40
 @item
-With a positive prefix argument, stack contains many @cite{y}'s and one
-common @cite{x}.  With a zero prefix, stack contains a vector of
-@cite{y}s and a common @cite{x}.  With a negative prefix, stack
-contains many @cite{[x,y]} vectors.  (For 3D plots, substitute
-@cite{z} for @cite{y} and @cite{x,y} for @cite{x}.)
+With a positive prefix argument, stack contains many @expr{y}'s and one
+common @expr{x}.  With a zero prefix, stack contains a vector of
+@expr{y}s and a common @expr{x}.  With a negative prefix, stack
+contains many @expr{[x,y]} vectors.  (For 3D plots, substitute
+@expr{z} for @expr{y} and @expr{x,y} for @expr{x}.)
 
 @c 41
 @item
@@ -35504,19 +35832,20 @@
 stack levels.  The notation @kbd{$3} refers to stack level three without
 causing that value to be removed from the stack.  Use @key{LFD} in place
 of @key{RET} to prevent evaluation; use @kbd{M-=} in place of @key{RET}
-to evaluate variables.@refill
+to evaluate variables.
 
 @c 47
 @item
 The variable is replaced by the formula shown on the right.  The
 Inverse flag reverses the order of the operands, e.g., @kbd{I s - x}
-assigns @c{$x \coloneq a-x$}
-@cite{x := a-x}.
+assigns 
+@texline @tmath{x \coloneq a-x}.
+@infoline @expr{x := a-x}.
 
 @c 48
 @item
 Press @kbd{?} repeatedly to see how to choose a model.  Answer the
-variables prompt with @cite{iv} or @cite{iv;pv} to specify
+variables prompt with @expr{iv} or @expr{iv;pv} to specify
 independent and parameter variables.  A positive prefix argument
 takes @i{@var{n}+1} vectors from the stack; a zero prefix takes a matrix
 and a vector from the stack.
--- a/man/cmdargs.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/cmdargs.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -1,8 +1,8 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 1985,86,87,93,94,95,97,2001,03,2004 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Command Arguments, X Resources, GNU Free Documentation License, Top
-@appendix Command Line Arguments
+@node Emacs Invocation, X Resources, GNU Free Documentation License, Top
+@appendix Command Line Arguments for Emacs Invocation
 @cindex command line arguments
 @cindex arguments (command line)
 @cindex options (command line)
@@ -204,17 +204,18 @@
 @item -batch
 @opindex --batch
 @itemx --batch
-Run Emacs in @dfn{batch mode}, which means that the text being edited is
-not displayed and the standard terminal interrupt characters such as
-@kbd{C-z} and @kbd{C-c} continue to have their normal effect.  Emacs in
-batch mode outputs to @code{stderr} only what would normally be displayed
-in the echo area under program control, and functions which would
-normally read from the minibuffer take their input from @code{stdin}.
+Run Emacs in @dfn{batch mode}.  Batch mode is used for running
+programs written in Emacs Lisp from shell scripts, makefiles, and so
+on.  You should also use the @samp{-l} option or @samp{-f} option, to
+invoke a Lisp program to do batch processing.
 
-Batch mode is used for running programs written in Emacs Lisp from
-shell scripts, makefiles, and so on.  Normally the @samp{-l} option
-or @samp{-f} option will be used as well, to invoke a Lisp program
-to do the batch processing.
+In batch mode, Emacs does not display the text being edited, and the
+standard terminal interrupt characters such as @kbd{C-z} and @kbd{C-c}
+continue to have their normal effect.  The functions @code{prin1},
+@code{princ} and @code{print} output to @code{stdout} instead of the
+echo area, while @code{message} and error messages output to
+@code{stderr}.  Functions that would normally read from the minibuffer
+take their input from @code{stdin} instead.
 
 @samp{--batch} implies @samp{-q} (do not load an init file).  It also
 causes Emacs to exit after processing all the command options.  In
--- a/man/custom.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/custom.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -27,6 +27,8 @@
 @menu
 * Minor Modes::		Each minor mode is one feature you can turn on
 			  independently of any others.
+* Easy Customization::
+                        Convenient way to browse and change user options.
 * Variables::		Many Emacs commands examine Emacs variables
 			  to decide what to do; by setting variables,
 			  you can control their functioning.
@@ -171,132 +173,28 @@
 The advantage of Transient Mark mode is that Emacs can display the
 region highlighted (currently only when using X).  @xref{Mark}.
 
-@node Variables
-@section Variables
-@cindex variable
-@cindex option, user
-@cindex user option
-
-  A @dfn{variable} is a Lisp symbol which has a value.  The symbol's
-name is also called the name of the variable.  A variable name can
-contain any characters that can appear in a file, but conventionally
-variable names consist of words separated by hyphens.  A variable can
-have a documentation string which describes what kind of value it should
-have and how the value will be used.
-
-  Lisp allows any variable to have any kind of value, but most variables
-that Emacs uses require a value of a certain type.  Often the value should
-always be a string, or should always be a number.  Sometimes we say that a
-certain feature is turned on if a variable is ``non-@code{nil},'' meaning
-that if the variable's value is @code{nil}, the feature is off, but the
-feature is on for @emph{any} other value.  The conventional value to use to
-turn on the feature---since you have to pick one particular value when you
-set the variable---is @code{t}.
-
-  Emacs uses many Lisp variables for internal record keeping, as any
-Lisp program must, but the most interesting variables for you are the
-ones that exist for the sake of customization.  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.  These
-variables are called @dfn{user options}.  Most user options are
-documented in this manual, and appear in the Variable Index
-(@pxref{Variable Index}).
-
-  One example of a variable which is a user option is @code{fill-column}, which
-specifies the position of the right margin (as a number of characters from
-the left margin) to be used by the fill commands (@pxref{Filling}).
-
-@menu
-* Examining::	        Examining or setting one variable's value.
-* Easy Customization::
-                        Convenient and easy customization of variables.
-* Hooks::	        Hook variables let you specify programs for parts
-		          of Emacs to run on particular occasions.
-* Locals::	        Per-buffer values of variables.
-* File Variables::      How files can specify variable values.
-@end menu
-
-@node Examining
-@subsection Examining and Setting Variables
-@cindex setting variables
+@node Easy Customization
+@section Easy Customization Interface
 
-@table @kbd
-@item C-h v @var{var} @key{RET}
-Display the value and documentation of variable @var{var}
-(@code{describe-variable}).
-@item M-x set-variable @key{RET} @var{var} @key{RET} @var{value} @key{RET}
-Change the value of variable @var{var} to @var{value}.
-@end table
-
-  To examine the value of a single variable, use @kbd{C-h v}
-(@code{describe-variable}), which reads a variable name using the
-minibuffer, with completion.  It displays both the value and the
-documentation of the variable.  For example,
-
-@example
-C-h v fill-column @key{RET}
-@end example
-
-@noindent
-displays something like this:
-
-@smallexample
-fill-column's value is 70
-
-Documentation:
-*Column beyond which automatic line-wrapping should happen.
-Automatically becomes buffer-local when set in any fashion.
-@end smallexample
-
-@noindent
-The star at the beginning of the documentation indicates that this
-variable is a user option.  @kbd{C-h v} is not restricted to user
-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,
-
-@example
-M-x set-variable @key{RET} fill-column @key{RET} 75 @key{RET}
-@end example
-
-@noindent
-sets @code{fill-column} to 75.
-
- @kbd{M-x set-variable} is limited to user option variables, but you can
-set any variable with a Lisp expression, using the function @code{setq}.
-Here is a @code{setq} expression to set @code{fill-column}:
-
-@example
-(setq fill-column 75)
-@end example
-
-  To execute an expression like this one, go to the @samp{*scratch*}
-buffer, type in the expression, and then type @kbd{C-j}.  @xref{Lisp
-Interaction}.
-
-  Setting variables, like all means of customizing Emacs except where
-otherwise stated, affects only the current Emacs session.
-
-@node Easy Customization
-@subsection Easy Customization Interface
+@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}).
 
 @findex customize
 @cindex customization buffer
-  A convenient way to find the user option variables that you want to
-change, and then change them, is with @kbd{M-x customize}.  This
-command creates a @dfn{customization buffer} with which you can browse
-through the Emacs user options in a logically organized structure,
-then edit and set their values.  You can also use the customization
-buffer to save settings permanently in your @file{~/.emacs} file
-(@pxref{Init File}).
+  You can browse interactively through the the user options and change
+some of them using @kbd{M-x customize}.  This command creates a
+@dfn{customization buffer}, which offers commands to navigate through
+a logically organized structure of the Emacs user options; you can
+also use it to edit and set their values, and to save settings
+permanently in your @file{~/.emacs} file (@pxref{Init File}).
 
-The appearance of the example buffers in the following is typically
-different under a window system where faces can be used to indicate the
-active fields and other features.
+  The appearance of the example buffers in this section is typically
+different under a window system, since faces are then used to indicate
+the active fields and other features.
 
 @menu
 * Groups: Customization Groups.
@@ -309,7 +207,7 @@
 @end menu
 
 @node Customization Groups
-@subsubsection Customization Groups
+@subsection Customization Groups
 @cindex customization groups
 
   For customization purposes, user options are organized into
@@ -389,7 +287,7 @@
 This is the way to set values in it.
 
 @node Changing an Option
-@subsubsection Changing an Option
+@subsection Changing an Option
 
   Here is an example of what a user option looks like in the
 customization buffer:
@@ -411,7 +309,7 @@
 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 variable.
+customizing the user option.
 
   The line after the @samp{[State]} line displays the beginning of the
 option's documentation string.  If there are more lines of
@@ -430,7 +328,7 @@
 @end smallexample
 
 @cindex setting option value
-  Editing the value does not actually set the option variable.  To do
+  Editing the value does not actually set the option.  To do
 that, you must @dfn{set} the option.  To do this, invoke the word
 @samp{[State]} and choose @samp{Set for Current Session}.
 
@@ -523,7 +421,7 @@
 @dfn{saving} the value changes it for future sessions as well.  To
 save the option, invoke @samp{[State]} and select the @samp{Save for
 Future Sessions} operation.  This works by writing code so as to set
-the option variable again each time you start Emacs (@pxref{Saving
+the option again, each time you start Emacs (@pxref{Saving
 Customizations}).
 
   You can also restore the option to its standard value by invoking
@@ -547,8 +445,8 @@
 
 @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 a variable
-and then reset the variable, which discards the customized value,
+customization buffer in this session.  If you customize an option
+and then reset it, which discards the customized value,
 you can get the customized value back again with this operation.
 @end table
 
@@ -583,7 +481,7 @@
 set, saved or reset.
 
 @node Saving Customizations
-@subsubsection Saving Customizations
+@subsection Saving Customizations
 
 @vindex custom-file
   The customization buffer normally saves customizations in
@@ -615,7 +513,7 @@
 customizations you might have on your init file.
 
 @node Face Customization
-@subsubsection Customizing Faces
+@subsection Customizing Faces
 @cindex customizing faces
 @cindex bold font
 @cindex italic font
@@ -676,7 +574,7 @@
 to clear out the attribute.
 
 @node Specific Customization
-@subsubsection Customizing Specific Items
+@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,
@@ -704,7 +602,7 @@
 @end table
 
 @findex customize-option
-  If you want to alter a particular user option variable with the
+  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
@@ -719,7 +617,7 @@
 @findex customize-group
   You can also set up the customization buffer with a specific group,
 using @kbd{M-x customize-group}.  The immediate contents of the chosen
-group, including option variables, faces, and other groups, all appear
+group, including user options, faces, and other groups, all appear
 as well.  However, these subgroups' own contents start out hidden.  You
 can show their contents in the usual way, by invoking @samp{[Show]}.
 
@@ -747,6 +645,111 @@
 saved.  Use @kbd{M-x customize-customized} to look at the options and
 faces that you have set but not saved.
 
+@node Variables
+@section Variables
+@cindex variable
+@cindex option, user
+@cindex user option
+
+  A @dfn{variable} is a Lisp symbol which has a value.  The symbol's
+name is also called the name of the variable.  A variable name can
+contain any characters that can appear in a file, but conventionally
+variable names consist of words separated by hyphens.  A variable can
+have a documentation string which describes what kind of value it should
+have and how the value will be used.
+
+  Lisp allows any variable to have any kind of value, but most variables
+that Emacs uses need a value of a certain type.  Often the value should
+always be a string, or should always be a number.  Sometimes we say that a
+certain feature is turned on if a variable is ``non-@code{nil},'' meaning
+that if the variable's value is @code{nil}, the feature is off, but the
+feature is on for @emph{any} other value.  The conventional value to use to
+turn on the feature---since you have to pick one particular value when you
+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.
+
+@menu
+* Examining::	        Examining or setting one variable's value.
+* Hooks::	        Hook variables let you specify programs for parts
+		          of Emacs to run on particular occasions.
+* Locals::	        Per-buffer values of variables.
+* File Variables::      How files can specify variable values.
+@end menu
+
+@node Examining
+@subsection Examining and Setting Variables
+@cindex setting variables
+
+@table @kbd
+@item C-h v @var{var} @key{RET}
+Display the value and documentation of variable @var{var}
+(@code{describe-variable}).
+@item M-x set-variable @key{RET} @var{var} @key{RET} @var{value} @key{RET}
+Change the value of variable @var{var} to @var{value}.
+@end table
+
+  To examine the value of a single variable, use @kbd{C-h v}
+(@code{describe-variable}), which reads a variable name using the
+minibuffer, with completion.  It displays both the value and the
+documentation of the variable.  For example,
+
+@example
+C-h v fill-column @key{RET}
+@end example
+
+@noindent
+displays something like this:
+
+@smallexample
+fill-column's value is 70
+
+Documentation:
+*Column beyond which automatic line-wrapping should happen.
+Automatically becomes buffer-local when set in any fashion.
+@end smallexample
+
+@noindent
+The star at the beginning of the documentation indicates that this
+variable is a user option.  @kbd{C-h v} is not restricted to user
+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,
+
+@example
+M-x set-variable @key{RET} fill-column @key{RET} 75 @key{RET}
+@end example
+
+@noindent
+sets @code{fill-column} to 75.
+
+ @kbd{M-x set-variable} is limited to user option variables, but you can
+set any variable with a Lisp expression, using the function @code{setq}.
+Here is a @code{setq} expression to set @code{fill-column}:
+
+@example
+(setq fill-column 75)
+@end example
+
+  To execute an expression like this one, go to the @samp{*scratch*}
+buffer, type in the expression, and then type @kbd{C-j}.  @xref{Lisp
+Interaction}.
+
+  Setting variables, like all means of customizing Emacs except where
+otherwise stated, affects only the current Emacs session.
+
 @node Hooks
 @subsection Hooks
 @cindex hook
@@ -961,7 +964,8 @@
   You can also specify the coding system for a file in this way: just
 specify a value for the ``variable'' named @code{coding}.  The ``value''
 must be a coding system name that Emacs recognizes.  @xref{Coding
-Systems}.
+Systems}.  @w{@samp{unibyte: t}} specifies unibyte loading for a
+particular Lisp file.  @xref{Enabling Multibyte}.
 
   The @code{eval} pseudo-variable, described below, can be specified in
 the first line as well.
@@ -1022,14 +1026,15 @@
 # End:
 @end example
 
-  Two ``variable names'' have special meanings in a local variables
+  Some ``variable names'' have special meanings in a local variables
 list: a value for the variable @code{mode} really sets the major mode,
 and a value for the variable @code{eval} is simply evaluated as an
-expression and the value is ignored.  @code{mode} and @code{eval} are
-not real variables; setting variables named @code{mode} and @code{eval}
-in any other context has no special meaning.  @emph{If @code{mode} is
-used to set a major mode, it should be the first ``variable'' in the
-list.}  Otherwise, the entries that precede it in the list of the local
+expression and the value is ignored.  @code{coding}, @code{unibyte},
+@code{mode} and @code{eval} are not real variables; setting variables
+named @code{coding}, @code{unibyte}, @code{mode} and @code{eval} in any
+other context has no special meaning.  @emph{If @code{mode} is used to
+set a major mode, it should be the first ``variable'' in the list.}
+Otherwise, the entries that precede it in the list of the local
 variables are likely to be ignored, since most modes kill all local
 variables as part of their initialization.
 
--- a/man/doclicense.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/doclicense.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -1,5 +1,5 @@
 @c -*-texinfo-*-
-@node GNU Free Documentation License, Command Arguments, Copying, Top
+@node GNU Free Documentation License, Emacs Invocation, Copying, Top
 @appendix GNU Free Documentation License
 @center Version 1.1, March 2000
 
--- a/man/emacs.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/emacs.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -148,7 +148,7 @@
 			  and strings).
 * Entering Emacs::      Starting Emacs from the shell.
 * Exiting::	        Stopping or killing Emacs.
-* Command Arguments::   Hairy startup options.
+* Emacs Invocation::    Hairy startup options.
 
 Fundamental Editing Commands
 * Basic::	        The most basic editing commands.
@@ -729,6 +729,8 @@
 
 * Minor Modes::		Each minor mode is one feature you can turn on
 			  independently of any others.
+* Easy Customization::
+                        Convenient way to browse and change user options.
 * Variables::		Many Emacs commands examine Emacs variables
 			  to decide what to do; by setting variables,
 			  you can control their functioning.
@@ -746,8 +748,6 @@
 Variables
 
 * Examining::	        Examining or setting one variable's value.
-* Easy Customization::
-                        Convenient and easy customization of variables.
 * Hooks::	        Hook variables let you specify programs for parts
 		          of Emacs to run on particular occasions.
 * Locals::	        Per-buffer values of variables.
--- a/man/entering.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/entering.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -29,7 +29,7 @@
 
   It is possible to specify files to be visited, Lisp files to be
 loaded, and functions to be called, by giving Emacs arguments in the
-shell command line.  @xref{Command Arguments}.  But we don't recommend
+shell command line.  @xref{Emacs Invocation}.  But we don't recommend
 doing this.  The feature exists mainly for compatibility with other
 editors.
 
--- a/man/frames.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/frames.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -910,9 +910,9 @@
 of dialogs.  This option has no effect if you have suppressed all dialog
 boxes with the option @code{use-dialog-box}.
 
-@vindex use-old-gtk-file-dialog
+@vindex x-use-old-gtk-file-dialog
   For Gtk+ version 2.4, you can make Emacs use the old file dialog
-by setting the variable @code{use-old-gtk-file-dialog} to a non-@code{nil}
+by setting the variable @code{x-use-old-gtk-file-dialog} to a non-@code{nil}
 value.  If Emacs is built with a Gtk+ version that has only one file dialog,
 the setting of this variable has no effect.
 
--- a/man/idlwave.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/idlwave.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,6 @@
 \input texinfo  @c -*-texinfo-*-
 @c %**start of header
-@setfilename idlwave
+@setfilename ../info/idlwave
 @settitle IDLWAVE User Manual
 @dircategory Emacs
 @direntry
@@ -896,7 +896,7 @@
 statements with special continuation indentation, especially if
 @code{idlwave-max-extra-continuation-indent} is small, the key
 @kbd{C-u @key{TAB}} will re-indent all lines in the current statement.
-Note that @code{idlwave-indent-to-open-paren}, if non-nil, overrides
+Note that @code{idlwave-indent-to-open-paren}, if non-@code{nil}, overrides
 the @code{idlwave-max-extra-continuation-indent} limit, for
 parentheses only, forcing them always to line up.
 
--- a/man/kmacro.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/kmacro.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -120,11 +120,6 @@
 indefinitely (until it gets an error or you type @kbd{C-g} or, on
 MS-DOS, @kbd{C-@key{BREAK}}).
 
-@kindex C-x C-k C-s
-@kindex C-x C-k C-k
-Alternatively, you can use @kbd{C-x C-k C-s} to start a keyboard macro,
-and @kbd{C-x C-k C-k...} to end and execute it.
-
   If you wish to repeat an operation at regularly spaced places in the
 text, define a macro and include as part of the macro the commands to move
 to the next place you want to use it.  For example, if you want to change
@@ -185,7 +180,7 @@
 a list of sequences of keys.  There is only one keyboard macro ring,
 shared by all buffers.
 
-  All commands which operates on the keyboard macro ring use the
+  All commands which operate on the keyboard macro ring use the
 same @kbd{C-x C-k} prefix.  Most of these commands can be executed and
 repeated immediately after each other without repeating the @kbd{C-x
 C-k} prefix.  For example,
@@ -207,12 +202,17 @@
 repeat the macro immediately by typing another @kbd{C-k}, or you can
 rotate the macro ring immediately by typing @kbd{C-n} or @kbd{C-p}.
 
+When a keyboard macro is being defined, @kbd{C-x C-k C-k} behaves like
+@kbd{C-x )} except that, immediately afterward, you can use most key
+bindings of this section without the @kbd{C-x C-k} prefix.  For
+instance, another @kbd{C-k} will re-execute the macro.
+
 @findex kmacro-cycle-ring-next
 @kindex C-x C-k C-n
 @findex kmacro-cycle-ring-previous
 @kindex C-x C-k C-p
   The commands @kbd{C-x C-k C-n} (@code{kmacro-cycle-ring-next}) and
-@kbd{C-x C-k C-p} (@code{kmacro-cycle-ring-previous}) rotates the
+@kbd{C-x C-k C-p} (@code{kmacro-cycle-ring-previous}) rotate the
 macro ring, bringing the next or previous keyboard macro to the head
 of the macro ring.  The definition of the new head macro is displayed
 in the echo area.  You can continue to rotate the macro ring
@@ -227,14 +227,14 @@
 @findex kmacro-view-macro-repeat
 @kindex C-x C-k C-v
 
-  The commands @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat})
+  The command @kbd{C-x C-k C-v} (@code{kmacro-view-macro-repeat})
 displays the last keyboard macro, or when repeated (with @kbd{C-v}),
 it displays the previous macro on the macro ring, just like @kbd{C-x
 C-k C-p}, but without actually rotating the macro ring.  If you enter
 @kbd{C-k} immediately after displaying a macro from the ring, that
 macro is executed, but still without altering the macro ring.
 
-  So while e.g. @kbd{C-x C-k C-p C-p C-k C-k} makes the 3rd previous
+  So while e.g. @kbd{C-x C-k C-p C-p C-p C-k C-k} makes the 3rd previous
 macro the current macro and executes it twice, @kbd{C-x C-k C-v C-v
 C-v C-k C-k} will display and execute the 3rd previous macro once and
 then the current macro once.
@@ -242,7 +242,7 @@
 @findex kmacro-delete-ring-head
 @kindex C-x C-k C-d
 
-  The commands @kbd{C-x C-k C-d} (@code{kmacro-delete-ring-head})
+  The command @kbd{C-x C-k C-d} (@code{kmacro-delete-ring-head})
 removes and deletes the macro currently at the head of the macro
 ring.  You can use this to delete a macro that didn't work as
 expected, or which you don't need anymore.
@@ -250,21 +250,24 @@
 @findex kmacro-swap-ring
 @kindex C-x C-k C-t
 
-  The commands @kbd{C-x C-k C-t} (@code{kmacro-swap-ring})
+  The command @kbd{C-x C-k C-t} (@code{kmacro-swap-ring})
 interchanges the head of the macro ring with the previous element on
 the macro ring.
 
 @findex kmacro-call-ring-2nd-repeat
 @kindex C-x C-k C-l
 
-  The commands @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat})
+  The command @kbd{C-x C-k C-l} (@code{kmacro-call-ring-2nd-repeat})
 executes the previous (rather than the head) element on the macro ring.
 
+@vindex kmacro-ring-max
+  The maximum number of macros stored in the keyboard macro ring is
+determined by the customizable variable @code{kmacro-ring-max}.
+
 @node Keyboard Macro Counter
 @section The Keyboard Macro Counter
 
-  Each keyboard macro has an associated counter which is automatically
-incremented on every repetition of the keyboard macro.  Normally, the
+  Each keyboard macro has an associated counter.  Normally, the
 macro counter is initialized to 0 when you start defining the macro,
 and incremented by 1 after each insertion of the counter value;
 that is, if you insert the macro counter twice while defining the
@@ -275,7 +278,7 @@
   The command @kbd{C-x C-k C-i} (@code{kmacro-insert-counter}) inserts
 the current value of the keyboard macro counter and increments the
 counter by 1.  You can use a numeric prefix argument to specify a
-different increment.  If you specify a @kbd{C-u} prefix, the last
+different increment.  If you just specify a @kbd{C-u} prefix, the last
 inserted counter value is repeated and the counter is not incremented.
 For example, if you enter the following sequence while defining a macro
 
@@ -288,30 +291,65 @@
 second execution of the macro @samp{3445} and @samp{6778} are
 inserted.
 
+  This command usually only makes sense while defining a keyboard macro.
+But its behavior when no keyboard macro is being defined or executed
+is predictable: it inserts and increments the counter of the head of
+the keyboard macro ring.
+
 @findex kmacro-set-counter
 @kindex C-x C-k C-c
   The command @kbd{C-x C-k C-c} (@code{kmacro-set-counter}) prompts
 for the initial value of the keyboard macro counter if you use it
-before you define a keyboard macro.  If you use it while defining a
-keyboard macro, you set the macro counter to the same (initial) value
-on each repetition of the macro.  If you specify a @kbd{C-u} prefix,
-the counter is reset to the value it had prior to the current
-repetition of the macro (undoing any increments so far in this
-repetition).
+before you define a keyboard macro.  If you use it before executing a
+keyboard macro, it resets that macro's counter.  If you use it while
+defining a keyboard macro, then the macro counter gets reset to that same
+value on each repetition of the macro.  Rather than having the command
+prompt for a value, you can also specify the value with a numeric
+prefix argument.  If you just specify a @kbd{C-u} prefix, the counter
+is reset to the value it had prior to the current repetition of the
+macro (undoing any increments so far in this repetition).  If you just
+specify a @kbd{C-u} prefix while no macro is being defined or executed,
+then the new value of the counter is essentially unpredictable.
 
 @findex kmacro-add-counter
 @kindex C-x C-k C-a
   The command @kbd{C-x C-k C-a} (@code{kmacro-add-counter}) prompts
-for a value to add to the macro counter.
+for a value to add to the macro counter.  You can also specify the
+value with a numeric prefix argument.  If you just specify a @kbd{C-u}
+prefix, the counter is reset to the last value inserted by any
+keyboard macro.  Usually, this will only make sense if that value was
+inserted during the current macro definition or repetition.
+
+  This command normally only makes sense while defining a keyboard macro.
+But its behavior when no keyboard macro is being defined or executed
+is predictable: it affects the counter of the head of the keyboard
+macro ring.
 
 @findex kmacro-set-format
 @kindex C-x C-k C-f
-  The command @kbd{C-x C-k C-f} (@code{kmacro-set-format}) prompts
-for the format to use when inserting the macro counter.  The default
-format is @samp{%d}.  If you set the counter format before you define a
-macro, that format is restored before each repetition of the macro.
-Consequently, any changes you make to the macro counter format while
-defining a macro are only active for the rest of the macro.
+  The command @kbd{C-x C-k C-f} (@code{kmacro-set-format}) prompts for
+the format to use when inserting the macro counter.  The default
+format is @samp{%d}, which means to insert the number in decimal
+without any padding.  You can exit with empty minibuffer to reset the
+format to this default.  You can specify any format string that the
+@code{format} function accepts and that makes sense with a single
+integer extra argument (@pxref{Formatting Strings,,, elisp, The Emacs
+Lisp Reference Manual}).  Do not put the format string inside double
+quotes when you insert it in the minibuffer.
+
+If you use this command while no keyboard macro is being defined or
+executed, the new format affects all subsequent macro definitions.
+Existing macros continue to use the format in effect when they were
+defined.  If you set the format while defining a keyboard macro, this
+affects the macro being defined from that point on, but it does not
+affect subsequent macros.  Execution of the macro will, at each step,
+use the format in effect at that step during its definition.  Changes
+to the macro format during execution of a macro, like the
+corresponding changes during its definition, have no effect on
+subsequent macros.
+
+The format set by @kbd{C-x C-k C-f} does not affect insertion of
+numbers stored in registers.
 
 @node Keyboard Macro Query
 @section Executing Macros with Variations
@@ -378,14 +416,13 @@
 @cindex binding keyboard macros
 @findex kmacro-bind-to-key
 @kindex C-x C-k b
-  You can also bind the last keyboard macro to a key, using
-@kbd{C-x C-k b} (@code{kmacro-bind-to-key}) followed by the
-key sequence you want the keyboard macro to be bound to.  You can
-bind to any key sequence in the global keymap, but since most key
-sequences already have other bindings, you should select the key
-sequence carefully.  If you try to bind to a key sequence with an
-existing binding (in any keymap), you will be asked if you really
-want to replace the existing binding of that key.
+  You can also bind the last keyboard macro (in its current form) to a
+key, using @kbd{C-x C-k b} (@code{kmacro-bind-to-key}) followed by the
+key sequence you want to bind.  You can bind to any key sequence in
+the global keymap, but since most key sequences already have other
+bindings, you should select the key sequence carefully.  If you try to
+bind to a key sequence with an existing binding (in any keymap), this
+command asks you for confirmation before replacing the existing binding.
 
 To avoid problems caused by overriding existing bindings, the key
 sequences @kbd{C-x C-k 0} through @kbd{C-x C-k 9} and @kbd{C-x C-k A}
--- a/man/misc.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/misc.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -1060,10 +1060,10 @@
 @item C-c C-c
 Send a literal @key{C-c} to the sub-shell.
 
-@item C-c C-x
-A prefix command to access the global @key{C-x} commands conveniently.
-For example, @kbd{C-c C-x o} invokes the global binding of
-@kbd{C-x o}, which is normally @samp{other-window}.
+@item C-c @var{char}
+This is equivalent to @kbd{C-x @var{char}} in normal Emacs.  For
+example, @kbd{C-c o} invokes the global binding of @kbd{C-x o}, which
+is normally @samp{other-window}.
 @end table
 
 @node Paging in Term
--- a/man/mule.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/mule.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -195,15 +195,15 @@
 characters.
 
   Emacs normally loads Lisp files as multibyte, regardless of whether
-you used @samp{--unibyte}.  This includes the Emacs initialization
-file, @file{.emacs}, and the initialization files of Emacs packages
-such as Gnus.  However, you can specify unibyte loading for a
-particular Lisp file, by putting @w{@samp{-*-unibyte: t;-*-}} in a
-comment on the first line.  Then that file is always loaded as unibyte
-text, even if you did not start Emacs with @samp{--unibyte}.  The
-motivation for these conventions is that it is more reliable to always
-load any particular Lisp file in the same way.  However, you can load
-a Lisp file as unibyte, on any one occasion, by typing @kbd{C-x
+you used @samp{--unibyte}.  This includes the Emacs initialization file,
+@file{.emacs}, and the initialization files of Emacs packages such as
+Gnus.  However, you can specify unibyte loading for a particular Lisp
+file, by putting @w{@samp{-*-unibyte: t;-*-}} in a comment on the first
+line (@pxref{File Variables}).  Then that file is always loaded as
+unibyte text, even if you did not start Emacs with @samp{--unibyte}.
+The motivation for these conventions is that it is more reliable to
+always load any particular Lisp file in the same way.  However, you can
+load a Lisp file as unibyte, on any one occasion, by typing @kbd{C-x
 @key{RET} c raw-text @key{RET}} immediately before loading it.
 
   The mode line indicates whether multibyte character support is enabled
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/man/org.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -0,0 +1,2045 @@
+\input texinfo
+@c %**start of header
+@setfilename ../info/org
+@settitle Org Mode Manual
+
+@set VERSION 3.03
+@set DATE December 2004
+
+@dircategory Emacs
+@direntry
+* Org Mode: (org.info).	Outline-based notes management and organizer 
+@end direntry
+
+@c Version and Contact Info
+@set MAINTAINERSITE @uref{http://www.astro.uva.nl/~dominik/Tools/org/,maintainers webpage}
+@set MAINTAINER Carsten Dominik
+@set MAINTAINEREMAIL @email{dominik@@science.uva.nl}
+@set MAINTAINERCONTACT @uref{mailto:dominik@@science.uva.nl,contact the maintainer}
+@c %**end of header
+@finalout
+
+@c Macro definitions
+
+@c Subheadings inside a table.  Need a difference between info and the rest.
+@macro tsubheading{text}
+@ifinfo
+@subsubheading \text\
+@end ifinfo
+@ifnotinfo
+@item @b{\text\}
+@end ifnotinfo
+@end macro
+
+@copying
+This manual is for Org-mode (version @value{VERSION}).
+
+Copyright @copyright{} 2004 Free Software Foundation
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.1 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
+and with the Back-Cover Texts as in (a) below.  A copy of the
+license is included in the section entitled ``GNU Free Documentation
+License.''
+
+(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
+this GNU Manual, like GNU software.  Copies published by the Free
+Software Foundation raise funds for GNU development.''
+@end quotation
+@end copying
+
+@titlepage
+@title Org Mode Manual
+
+@subtitle Release @value{VERSION}
+@author by Carsten Dominik
+
+@c The following two commands start the copyright page.
+@page
+@vskip 0pt plus 1filll
+@insertcopying
+@end titlepage
+
+@c Output the table of contents at the beginning.
+@contents
+
+@ifnottex
+@node Top, Introduction, (dir), (dir)
+@top Org Mode Manual
+
+@insertcopying
+@end ifnottex
+
+@menu
+* Introduction::                Getting started
+* Document Structure::          A tree works like your brain
+* TODO items::                  Every tree branch can be a TODO item
+* Tables::                      Pure magic for quick formatting
+* Hyperlinks::                  Notes in context
+* Timestamps::                  Assign date and time to items
+* Timeline and Agenda::         Use time-stamped items to produce an agenda
+* Exporting::                   Sharing and publishing of notes
+* Miscellaneous::               All the rest which did not fit elsewhere
+* Index::                       The fast road to specific information
+* Key Index::                   Key bindings and where they are described
+
+@detailmenu
+ --- The Detailed Node Listing ---
+
+Introduction
+
+* Summary::                     Brief summary of what Org-mode does
+* Installation::                How to install Org-mode
+
+Document Structure
+
+* Outlines::                    Org-mode is based on outline-mode
+* Headlines::                   How to typeset org-tree headlines
+* Visibility cycling::          Show ad hide, much simplified
+* Motion::                      Jumping to other headlines
+* Structure editing::           Changing sequence and level of headlines
+* Sparse trees::                Matches embedded in context
+
+TODO items
+
+* TODO basics::                 Marking and displaying TODO entries
+* Priorities::                  Some things are more important than others
+* TODO extensions::             Workflow and assignments
+
+Extended use of TODO keywords
+
+* Workflow states::             From TODO to DONE in steps
+* TODO types::                  I do this, Fred the rest
+* Per file keywords::           Different files, different requirements
+
+Tables
+
+* Built-in table editor::       Simple tables
+* table.el::                    Complex tables
+
+Hyperlinks
+
+* Links::                       URL-like links to the world
+* Remember::                    Org-trees store quick notes
+
+Timestamps
+
+* Time stamps::                 Assigning a time to a tree entry
+* Creating timestamps::         Commands which insert timestamps
+
+Timeline and Agenda
+
+* Timeline (single file)::      Time-sorted view for single file
+* Agenda (multiple files)::     Your weekly planner
+* Agenda commands::             Remote editing of org trees
+* Calendar/Diary integration::  Integrating Anniversaries and more
+
+Calendar/Diary integration
+
+* Diary to agenda::             Agenda incorporates the diary
+* Agenda to diary::             Diary incorporates the agenda
+
+Exporting
+
+* Export commands::             Commands which export and display
+* HTML formatting::             Interpretation of the buffer content
+* Export options::              How to influence exports
+* Comment lines::               Lines which will not be exported
+
+Miscellaneous
+
+* Completion::                  M-TAB knows what you need
+* Customization::               Adapting Org-mode to your taste
+* Tips and Tricks::             An author-imposed FAQ, sort of
+* Interaction::                 Other Emacs packages
+* Acknowledgments::             These people provided feedback and more
+* Bugs::                        Things which do not work perfectly
+
+@end detailmenu
+@end menu
+
+@node Introduction, Document Structure, Top, Top
+@chapter Introduction
+@cindex introduction
+
+@menu
+* Summary::                     Brief summary of what Org-mode does
+* Installation::                How to install Org-mode
+@end menu
+
+@node Summary, Installation, Introduction, Introduction
+@section Summary
+@cindex summary
+
+Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
+project planning with a fast and effective plain-text system.
+
+Org-mode develops organizational tasks around NOTES files that contain
+information about projects as plain text.  Org-mode is implemented on
+top of outline-mode, which makes it possible to keep the content of
+large files well structured.  Visibility cycling and structure editing
+help to work with the tree.  Tables are easily created with a built-in
+table editor.  Org-mode supports ToDo items, deadlines, time stamps,
+and scheduling.  It dynamically compiles entries into an agenda.
+Plain text URL-like links connect to websites, emails, usenet
+messages, BBDB entries, and any files related to the projects.  For
+printing and sharing of notes, an Org-mode file can be exported as a
+structured ASCII file, or as HTML.
+
+Org-mode keeps simple things simple.  Not every outline branch needs
+to be an action item, not every action item needs to have priority or
+scheduling information associated with it.  Org-mode can be used on
+different levels and in different ways, for example
+
+@example
+@r{@bullet{} as an outline extension with visibility cycling and structure editing}
+@r{@bullet{} as an ASCII system and table editor to take structured notes}
+@r{@bullet{} as a simple hypertext system, with HTML export}
+@r{@bullet{} as a TODO list editor}
+@r{@bullet{} as a full agenda and planner with deadlines and work scheduling}
+@end example
+
+@node Installation,  , Summary, Introduction
+@section Installation
+@cindex installation
+@cindex autoload
+@cindex global keybindings
+@cindex keybindings, global
+
+The instructions below assume that you have downloaded Org-mode from
+the web.  If Org-mode is part of the Emacs distribution or an XEmacs
+package, you only need to add to @file{.emacs} the last three Lisp
+lines below - all the rest will be taken care of automatically.
+
+Byte-compile @file{org.el} and put it on your load path.  If you'd
+like to use the Info documentation, copy the file @file{org} into the
+directory containing info files and run the command @code{install-info
+org}.
+
+Then copy the following lines into @file{.emacs}.  The last two lines
+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)
+(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)
+@end lisp
+
+@cindex org-mode, turning on
+@noindent
+This will put all files with extension @samp{.org} into Org-mode.  As
+an alternative, make the first line of a file look like this:
+
+@example
+MY PROJECTS    -*- mode: org; -*-
+@end example
+
+@noindent which will select Org-mode for this buffer no matter what
+the file's name is.
+
+@node Document Structure, TODO items, Introduction, Top
+@chapter Document Structure
+@cindex document structure
+@cindex structure of document
+
+Org-mode is based on outline mode and provides flexible commands to
+edit the structure of the document.
+
+@menu
+* Outlines::                    Org-mode is based on outline-mode
+* Headlines::                   How to typeset org-tree headlines
+* Visibility cycling::          Show ad hide, much simplified
+* Motion::                      Jumping to other headlines
+* Structure editing::           Changing sequence and level of headlines
+* Sparse trees::                Matches embedded in context
+@end menu
+
+@node Outlines, Headlines, Document Structure, Document Structure
+@section Outlines
+@cindex outlines
+@cindex outline-mode
+
+Org-mode is implemented on top of outline-mode.  Outlines allow to
+organize a document in a hierarchical structure, which (at least for
+me) is the best representation of notes and thoughts.  Overview over
+this structure is achieved by folding (hiding) large parts of the
+document to show only the general document structure and the parts
+currently being worked on.  Org-mode greatly simplifies the use of
+outlines by compressing the entire show/hide functionality into a
+single command @command{org-cycle}, which is bound to the @key{TAB}
+key.
+
+@node Headlines, Visibility cycling, Outlines, Document Structure
+@section Headlines
+@cindex headlines
+@cindex outline tree
+
+Headlines define the structure of an outline tree.  The Headlines in
+Org-mode start with one or more stars, for example
+
+@example
+* Top level headline
+** Second level
+*** 3rd level
+    some text
+*** 3rd level
+    more text
+* Another top level headline
+@end example
+
+@node Visibility cycling, Motion, Headlines, Document Structure
+@section Visibility cycling
+@cindex visibility cycling
+@cindex trees, visibility
+
+Outlines make it possible to hide parts of the text in the buffer.
+Org-mode uses a single command bound to the @key{TAB} key to change
+the visibility in the buffer.
+
+@cindex subtree visibility states
+@cindex folded, subtree visibility state
+@cindex children, subtree visibility state
+@cindex subtree, subtree visibility state
+@table @kbd
+@kindex @key{TAB}
+@item @key{TAB}
+Rotate current subtree between the states
+@example
+,-> FOLDED -> CHILDREN -> SUBTREE --.
+'-----------------------------------'
+@end example
+At the beginning of the buffer (or when called with @kbd{C-u}), this does
+the same as the command @kbd{S-@key{TAB}} below.
+
+@cindex global visibility states
+@cindex overview, global visibility state
+@cindex contents, global visibility state
+@cindex show all, global visibility state
+@kindex S-@key{TAB}
+@item S-@key{TAB}
+Rotate the entire buffer between the states
+@example
+,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
+'--------------------------------------'
+@end example
+Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
+
+@cindex show all, command
+@kindex C-c C-a
+@item C-c C-a
+Show all.
+@end table
+
+@node Motion, Structure editing, Visibility cycling, Document Structure
+@section Motion
+@cindex motion, between headlines
+@cindex jumping, to headlines
+The following commands jump to other headlines in the buffer.
+
+@table @kbd
+@kindex C-c C-n
+@item C-c C-n
+Next heading.
+@kindex C-c C-p
+@item C-c C-p
+Previous heading.
+@kindex C-c C-f
+@item C-c C-f
+Next heading same level.
+@kindex C-c C-b
+@item C-c C-b
+Previous heading same level.
+@kindex C-c C-u
+@item C-c C-u
+Backward to higher level heading.
+@kindex C-c C-j
+@item C-c C-j
+Jump to a different place without changing the current outline
+visibility.  Shows the document structure in a temporary buffer, where
+you can use visibility cycling (@key{TAB}) to find your destination.
+After pressing @key{RET}, the cursor moves to the selected location in
+the original buffer, and the headings hierarchy above it is made
+visible.
+@end table
+
+@node Structure editing, Sparse trees, Motion, Document Structure
+@section Structure editing
+@cindex structure editing
+@cindex headline, promotion and demotion
+@cindex promotion, of subtrees
+@cindex demotion, of subtrees
+@cindex subtree, cut and paste
+@cindex pasting, subtrees
+@cindex cutting, subtrees
+@cindex copying, subtrees
+
+@table @kbd
+@kindex M-@key{RET}
+@item M-@key{RET}
+Insert new heading with same level as current
+@kindex M-@key{left}
+@item M-@key{left}
+Promote current heading by one level
+@kindex M-@key{right}
+@item M-@key{right}
+Demote current heading by one level
+@kindex M-S-@key{left}
+@item M-S-@key{left}
+Promote the current subtree by one level
+@kindex M-S-@key{right}
+@item M-S-@key{right}
+Demote the current subtree by one level
+@kindex M-S-@key{up}
+@item M-S-@key{up}
+Move subtree up (swap with previous subtree of same level)
+@kindex M-S-@key{down}
+@item M-S-@key{down}
+Move subtree down (swap with next subtree of same level)
+@kindex C-c C-h C-w
+@item C-c C-h C-w
+Kill subtree, i.e. remove it from buffer but save in kill ring.
+@kindex C-c C-h M-w
+@item C-c C-h M-w
+Copy subtree to kill ring.
+@kindex C-c C-h C-y
+@item C-c C-h C-y
+Yank subtree from kill ring.  This does modify the level of subtree to
+make sure the tree fits in nicely at the yank position.  The yank
+level can also be specified with a prefix arg, or by yanking after a
+headline marker like @samp{****}.
+@end table
+
+@cindex region, active
+@cindex active region
+@cindex transient-mark-mode
+When there is an active region (transient-mark-mode), promotion and
+demotion work on all headlines in the region.  To select a region of
+headlines, it is best to place both point and mark at the beginning of a
+line, mark at the beginning of the first headline, and point at the line
+just after the last headline to change.  Note that when the cursor is
+inside a table (@pxref{Tables}), the Meta-Cursor keys have different
+functionality.
+
+@node Sparse trees,  , Structure editing, Document Structure
+@section Sparse trees
+@cindex sparse trees
+@cindex trees, sparse
+@cindex folding, sparse trees
+@cindex occur, command
+
+An important feature of Org-mode is the ability to construct
+@emph{sparse trees} for selected information in an outline tree.  A
+sparse tree means that the entire document is folded as much as
+possible, but the selected information is made visible along with the
+headline structure above it.  Just try it out and you will see
+immediately how it works.
+
+Org-mode contains several commands creating such trees.  The most
+basic one is @command{org-occur}:
+
+@table @kbd
+@kindex C-c /
+@item C-c /
+Occur.  Prompts for a regexp and shows a sparse tree with all matches.
+If the match is in a headline, the headline is made visible.  If the
+match is in the body of an entry, headline and body are made visible.
+In order to provide minimal context, also the full hierarchy of
+headlines above the match is shown, as well as the headline following
+the match.
+@end table
+
+Other commands are using this feature as well.  For example @kbd{C-c
+C-v} creates a sparse TODO tree (@pxref{TODO basics}).
+
+@node TODO items, Tables, Document Structure, Top
+@chapter TODO items
+@cindex TODO items
+
+Org-mode does not maintain TODO lists as a separate document.  TODO
+items are an integral part of the notes file, because TODO items
+usually come up while taking notes!  With Org-mode, you simply mark
+any entry in a tree as being a TODO item.  In this way, the
+information is not duplicated, and the entire context from which the
+item emerged is always present when you check.
+
+Of course, this technique causes TODO items to be scattered throughout
+your file.  Org-mode provides methods to give you an overview over all
+things you have to do.
+
+@menu
+* TODO basics::                 Marking and displaying TODO entries
+* Priorities::                  Some things are more important than others
+* TODO extensions::             Workflow and assignments
+@end menu
+
+@node TODO basics, Priorities, TODO items, TODO items
+@section Basic TODO functionality
+
+Any headline can become a TODO item by starting it with the word TODO,
+for example
+
+@example
+*** TODO Write letter to Sam Fortune
+@end example
+
+@noindent
+The most important commands to work with TODO entries are:
+
+@table @kbd
+@kindex C-c C-t
+@item C-c C-t
+Rotate the TODO state of the current item between
+@example
+,-> (unmarked) -> TODO -> DONE --.
+'--------------------------------'
+@end example
+@kindex C-c C-v
+@cindex sparse tree, for TODO
+@item C-c C-v
+View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}).  Folds
+the entire buffer, but shows all TODO items and the headings hierarchy
+above them.  With prefix arg, show also the DONE entries.
+@end table
+
+@node Priorities, TODO extensions, TODO basics, TODO items
+@section Priorities
+@cindex priorities
+
+If you use Org-mode extensively to organize your work, you may end up
+with a number of TODO entries so large that you'd like to prioritize
+them.  You can do this by placing a @emph{priority cookie} into the
+headline, like this
+
+@example
+*** TODO [#A] Write letter to Sam Fortune
+@end example
+
+@noindent
+With its standard setup, Org-mode supports priorities @samp{A},
+@samp{B}, and @samp{C}.  @samp{A} is the highest priority.  An entry
+without a cookie is treated as priority @samp{B}.  Priorities make a
+difference only in the multi-file agenda (@pxref{Agenda (multiple files)}).
+
+@table @kbd
+@kindex @kbd{C-c ,}
+@item @kbd{C-c ,}
+Set the priority of the current item.  The command prompts for a
+priority character @samp{A}, @samp{B} or @samp{C}.  When you press
+@key{SPC} instead, the priority cookie is removed from the headline.
+@kindex S-@key{up}
+@kindex S-@key{down}
+@item S-@key{up}
+@itemx S-@key{down}
+Increase/decrease priority of current item.  Note that these keys are
+also used to modify time stamps (@pxref{Creating timestamps}).
+@end table
+
+
+@node TODO extensions,  , Priorities, TODO items
+@section Extended use of TODO keywords
+@cindex extended TODO keywords
+
+The default implementation of TODO entries is just two states:  TODO
+and DONE.  You can, however, use the TODO feature for more
+complicated things by configuring the variables
+@code{org-todo-keywords} and @code{org-todo-interpretation}.  Using
+special setup, you can even use TODO keywords in different ways in
+different org files.
+
+@menu
+* Workflow states::             From TODO to DONE in steps
+* TODO types::                  I do this, Fred the rest
+* Per file keywords::           Different files, different requirements
+@end menu
+
+@node Workflow states, TODO types, TODO extensions, TODO extensions
+@subsection TODO keywords as workflow states
+@cindex TODO workflow
+@cindex workflow states as TODO keywords
+
+You can use TODO keywords to indicate different states in the process
+of working on an item, for example
+
+@lisp
+(setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
+      org-todo-interpretation 'sequence)
+@end lisp
+
+With this setup, the command @kbd{C-c C-t} will cycle an entry from
+TODO to FEEDBACK, then to VERIFY, and finally too DONE.  You may also
+use a prefix argument to quickly select a specific state.  For example
+@kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
+If you define many keywords, you can use in-buffer completion (see
+@ref{Completion}) to insert these words into the buffer.
+
+@node TODO types, Per file keywords, Workflow states, TODO extensions
+@subsection TODO keywords as types
+@cindex TODO types
+@cindex names as TODO keywords
+@cindex types as TODO keywords
+
+The second possibility is to use TODO keywords to indicate different
+types of action items.  For example, when you work with several people
+on a single project, you might want to assign action items to
+persons. 
+
+@lisp
+(setq org-todo-keywords '("Fred" "Sara" "Lucy" "Mike" "DONE")
+      org-todo-interpretation 'type)
+@end lisp
+
+In this case, different keywords do not indicate a sequence, but
+rather different levels.  This changes the behavior of the command
+@kbd{C-c C-t} slightly.  When used several times in succession, it
+will still cycle through all names.  But when when you return to the
+item after some time and execute @kbd{C-c C-t} again, it will switch
+from each name directly to DONE.  Use prefix arguments or completion
+to quickly select a specific name.
+
+@node Per file keywords,  , TODO types, TODO extensions
+@subsection Setting up TODO keywords for individual files
+@cindex keyword options
+@cindex per file keywords
+
+It can be very useful to use different aspects of the TODO mechanism
+in different files.  For this you need to add special lines to the
+file which set the keywords and interpretation for that file only.
+For example, to set one of the two examples discussed above, you
+need one of the following lines, starting in column zero anywhere in
+the file:
+
+@example
+#+SEQ_TODO: TODO FEEDBACK VERIFY DONE
+#+TYP_TODO: Fred Sara Lucy Mike DONE
+@end example
+
+@cindex Completing option keywords
+@kindex M-@key{TAB}
+@noindent To make sure you are using the correct keyword, type
+@samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
+
+@cindex DONE, final TODO keyword
+Remember that the last keyword must always mean that the
+item is DONE (you may use a different word, though).  After changing
+these lines, use @kbd{M-x normal-mode} to make the changes known to
+Org-mode.  Also note that in each file, only one of the two aspects
+of TODO keywords can be used.
+
+If you want to use very many keywords, for example when working with a
+large group of people, you may split the names over several lines:
+
+@example
+#+TYP_TODO: Fred Sara Lucy Mike
+#+TYP_TODO: Luis George Jules Jessica
+#+TYP_TODO: Kim Arnold Peter
+#+TYP_TODO: DONE
+@end example
+
+@node Tables, Hyperlinks, TODO items, Top
+@chapter Tables
+@cindex tables
+
+For taking notes, tables are an essential tool because they allow
+immediate and clear structuring of data.  Org-mode has a very fast and
+intuitive table editor built-in.  More complex tables can be created
+with the Emacs table.el package.
+
+@menu
+* Built-in table editor::       Simple tables
+* table.el::                    Complex tables
+@end menu
+
+@node Built-in table editor, table.el, Tables, Tables
+@section The built-in table editor
+@cindex table editor, builtin
+
+Org-mode makes it easy to format tables in plain ASCII.  Any line with
+@samp{|} as the first non-white character is considered part of a
+table.  @samp{|} is also the column separator.  A table might look
+like this:
+
+@example
+| Name  | Phone | Age |
+|-------+-------+-----|
+| Peter |  1234 |  17 |
+| Anna  |  4321 |  25 |
+@end example
+
+A table is re-aligned automatically each time you press @key{TAB} or
+@key{RET} inside the table.  @key{TAB} also moves to the next field
+(@key{RET} to the next row) and creates new table rows at the end of the
+table or before horizontal lines.  The indentation of the table is set
+by the first line.  Any line starting with @samp{|-} is considered as a
+horizontal separator line and will be expanded on the next re-align to
+span the whole table width.  So, to create the above table, you would
+only type
+
+@example
+|Name|Phone|Age
+|-
+@end example
+
+@noindent and then press @key{TAB} to align the table and start filling in
+fields.
+
+@table @kbd
+@tsubheading{Creation and conversion}
+@kindex C-c C-c
+@item C-c C-c
+Recognize @file{table.el} table.  Works when the cursor is in a
+table.el table
+
+@kindex C-c C-c
+@item C-c C-c
+Convert region to table.  Works when the cursor is not in an existing
+table, and when there is a region defined.  If every line contains at
+least one TAB character, the function assumes that the material is tab
+separated.  If not, lines are split at whitespace into fields.  You
+can use a prefix argument to indicate how many consecutive spaces are
+at least required to indicate a field separator (default: just one).
+
+@item M-x org-table-create
+Creates an empty Org-mode table.  However, it is much easier to just
+start typing, like @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}
+
+@tsubheading{Re-aligning and field motion}
+@kindex C-c C-c
+@item C-c C-c
+Re-align the table without moving the cursor.
+
+@kindex @key{TAB}
+@item @key{TAB}
+Re-align the table, move to the next field.  Creates a new row if
+necessary.
+
+@kindex S-@key{TAB}
+@item S-@key{TAB}
+Move to previous field.
+
+@kindex @key{RET}
+@item @key{RET}
+Re-align the table and move down to next row.  Creates a new row if
+necessary.  At the beginning or end of a line, @key{RET} still does
+NEWLINE, so it can be used to split a table.
+
+@kindex S-@key{RET}         
+@item S-@key{RET}         
+Copy from first non-empty
+ field above current field.
+
+@tsubheading{Column and row editing}
+@kindex M-@key{left}
+@kindex M-@key{right}
+@item M-@key{left}
+@itemx M-@key{right}
+Move the current column left/right
+
+@kindex M-S-@key{left}
+@item M-S-@key{left}
+Kill the current column.
+
+@kindex M-S-@key{right}
+@item M-S-@key{right}
+Insert a new column to the left of the cursor position.
+
+@kindex M-@key{up}
+@kindex M-@key{down}
+@item M-@key{up}
+@itemx M-@key{down}
+Move the current row up/down
+
+@kindex M-S-@key{up}
+@item M-S-@key{up}
+Kill the current row or horizontal line.
+
+@kindex M-S-@key{down}
+@item M-S-@key{down}
+Insert a new row above (with arg: below) the current row.
+
+@kindex C-c -
+@item C-c -
+Insert a horizontal line below current row. With prefix arg, line is
+created above the current line.
+
+@tsubheading{Regions}
+@kindex C-c C-h M-w
+@item C-c C-h M-w
+Copy an rectangular region from a table to a special clipboard.  Point
+and mark determine edge fields of the rectangle.  The process ignores
+horizontal separator lines.
+@kindex C-c C-h C-w
+@item C-c C-h C-w
+Copy an rectangular region from a table to a special clipboard, and
+blank all fields in the rectangle.
+@kindex C-c C-h C-y
+@item C-c C-h C-y
+Paste a rectangluar region into a table.
+The upper right corner ends up in the current field.  All involved fields
+will be overwritten.  If the rectangle does not fit into the present table,
+the table is enlarged as needed.  The process ignores horizontal separator
+lines.
+@kindex C-c C-q
+@item C-c C-q
+Wrap several fields in a column like a paragraph.  If there is an active
+region, and both point and mark are in the same column, the text in the
+column is wrapped to minimum width for the given number of lines.  A
+prefix ARG may be used to change the number of desired lines.  If there
+is no region, the current field is split at the cursor position and the
+text fragment to the right of the cursor is prepended to the field one
+line down. If there is no region, but you specify a prefix ARG, the
+current field gets blank, and the content is appended to the field
+above.
+
+@tsubheading{Calculations}
+@kindex C-c ?
+@item C-c ?
+Which table column is the cursor in?  Displays number >0 in echo
+area. 
+
+@cindex region, active
+@cindex active region
+@cindex transient-mark-mode
+@kindex C-c +
+@item C-c +
+Sum the numbers in the current column, or in the rectangle defined by
+the active region.  The result is displayed in the echo area and can
+be inserted with @kbd{C-y}.
+
+@cindex formula, in tables
+@cindex calculations, in tables
+@kindex C-c =
+@item C-c =
+Replace current field with the result of a formula.  Requires the
+Emacs calc package.  The formula can access the current field with
+@samp{$}, and the other fields in the current row
+with @samp{$1}, @samp{$2},...  For details see the documentation of the
+command @command{org-table-eval-formula}.
+
+@tsubheading{Miscellaneous}
+@kindex C-c |
+@item C-c |
+Toggle the visibility of vertical lines in tables.  The lines are
+still there, only made invisible with a text property.  Any @samp{|}
+added by hand will become invisible on the next align.
+Typographically it is good style to have no vertical lines in tables.
+
+@item M-x org-table-import
+Import a file as a table.  The table should be TAB- or whitespace
+separated.  Useful for example to import an Excel table or data from a
+database, because these programs generally can write TAB-separated text
+files.  This command works by inserting the file into the buffer and
+then converting the region to a table.  Any prefix argument is passed on
+to the converter, which uses it to determine the separator.
+
+@item M-x org-table-export
+Export the table as a TAB-separated file.  Useful for data exchange with
+for example Excel or database programs.
+
+@end table
+
+If you don't like the automatic table editor because it gets into your
+way in lines which you would like to start with @samp{|}, you can turn
+it off with
+@lisp
+(setq org-enable-table-editor nil)
+@end lisp
+@noindent The only table command which then still works is
+@kbd{C-c C-c} to do a manual re-align.
+
+@node table.el,  , Built-in table editor, Tables
+@section The @file{table.el} package
+@kindex C-c C-c
+@cindex table editor, table.el
+@cindex @file{table.el}
+
+More complex ASCII tables (with automatic line wrapping, column- and
+row-spanning, and alignment) can be created using the Emacs table
+package by Takaaki Ota (@uref{http://sourceforge.net/projects/table}).
+When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org-mode
+will call @command{table-recognize-table} and move the cursor into the
+table.  Inside a table, the keymap of Org-mode is inactive.  In order
+to execute org-related commands, leave the table.
+
+@table @kbd
+@kindex C-c #
+@item C-c #
+Insert a table.el table.  If there is already a table at point, this
+command converts it between the table.el format and the Org-mode
+format.  See the documentation string of the command
+@code{org-convert-table} for the restrictions under which this is
+possible.
+@end table
+
+@node Hyperlinks, Timestamps, Tables, Top
+@chapter Hyperlinks
+@cindex hyperlinks
+
+Just like HMTL, Org-mode provides links to other files, usenet
+articles, emails and much more.
+
+@menu
+* Links::                       URL-like links to the world
+* Remember::                    Org-trees store quick notes
+@end menu
+
+@node Links, Remember, Hyperlinks, Hyperlinks
+@section Links
+@cindex links
+@cindex GNUS links
+@cindex BBDB links
+@cindex VM links
+@cindex RMAIL links
+@cindex WANDERLUST links
+@cindex USENET links
+@cindex SHELL links
+
+Org-mode supports links to files, websites, usenet and email messages;
+and BBDB database entries.  Links are just plain-text URL-like locators.
+The following list shows examples for each link type.
+
+@example
+http://www.astro.uva.nl/~dominik         @r{on the web}
+file:/home/dominik/images/jupiter.jpg    @r{file, absolute path}
+file:papers/last.pdf                     @r{file, relative path}
+file:~/code/main.c:255                   @r{file, with line number}
+news:comp.emacs                          @r{Usenet link}
+mailto:adent@@galaxy.net                  @r{Mail link}
+vm:folder                                @r{VM folder link}
+vm:folder#id                             @r{VM message link}
+vm://myself@@some.where.org/folder#id     @r{VM on remote machine}
+wl:folder                                @r{WANDERLUST folder link}
+wl:folder#id                             @r{WANDERLUST message link}
+rmail:folder                             @r{RMAIL folder link}
+rmail:folder#id                          @r{RMAIL message link}
+gnus:group                               @r{GNUS group link}
+gnus:group#id                            @r{GNUS article link}
+bbdb:Richard Stallman                    @r{BBDB link}
+shell:ls *.org                           @r{A shell command}
+@end example
+
+A link may contain space characters and is terminated by the end of
+the line.  Therefore, there can be only one link per line (but see the
+variable @code{org-allow-space-in-links}).
+
+@cindex storing links
+@table @kbd
+@kindex C-c l
+@item C-c l
+Store a link to the current location.  This is a @emph{global} command
+which can be used in any buffer to create a link.  The link will be
+stored for later insertion into an Org-mode buffer (see below).  For VM,
+RMAIL, WANDERLUST, GNUS and BBDB buffers, the link will point to the
+current article/entry.  For W3 and W3M buffer, the link goes to the
+current URL.  For any other files, the link will just point to the file.
+The key binding @kbd{C-c l} is only a suggestion - see
+@ref{Installation}.
+
+@kindex C-c C-l
+@item C-c C-l
+Insert a link.  This prompts for a link to be inserted into the
+buffer.  You can just type a link, using one of the link type prefixes
+mentioned in the examples above.  Through completion, all links stored
+during the current session can be accessed.  When called with prefix
+arg, you can use file name completion to enter a file link.  Note that
+you don't have to use this command to insert a link.  Links in
+Org-mode are plain text, and you can type or paste them straight into
+the buffer.
+
+@cindex inserting links
+@kindex C-c C-o
+@item C-c C-o
+Open link at point.  This will launch a web browser for URLs (using
+@command{browse-url-at-point}), run vm/gnus/bbdb for the corresponding
+links, execute the command in a shell link, visit text files with
+Emacs and select a suitable application for non-text files.
+Classification of files is based on file extension only.  See option
+@code{org-file-apps}.  If there is no link at point, the current
+subtree will be searched for one.  If you want to override the default
+application and visit the file with Emacs, use a @kbd{C-u} prefix.
+If the cursor is on a time stamp, compiles the agenda for that date.
+
+@strong{IMPORTANT}: Be careful not to use any dangerous commands in a
+shell link.
+
+@kindex mouse-2
+@item mouse-2
+On links, @kbd{mouse-2} will open the link just like @kbd{C-c C-o} would.
+
+@kindex mouse-3
+@item mouse-3
+Like @kbd{mouse-2}, but force file links to be opened with Emacs.
+@end table
+
+@node Remember,  , Links, Hyperlinks
+@section Remember
+@cindex @file{remember.el}
+
+Another way to create org entries with links to other files is through
+the @emph{Remember} package by John Wiegley.  @emph{Remember} lets you
+store quick notes with little interruption of your work flow.  See
+@uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
+information.  The notes produced by @emph{Remember} can be stored in
+different ways, and Org-mode files are a good target.
+Org-mode allows to file away notes either to a default file, or
+directly to the correct location in your Org-mode outline tree.  The
+following customization will tell @emph{Remember} to use org files as
+target, and to create annotations compatible with Org-mode links.
+
+
+@c FIXME: The autoload will not be necessary when Org-mode is part of Emacs
+@example
+(autoload 'org-remember-annotation "org")
+(autoload 'org-remember-handler "org")
+(setq org-directory "~/path/to/my/orgfiles/")
+(setq org-default-notes-file "~/.notes")
+(setq remember-annotation-functions '(org-remember-annotation))
+(setq remember-handler-functions '(org-remember-handler))
+@end example
+
+When you compose a note with remember, you have to press @kbd{C-c C-c}
+to exit remember-mode and to file away the note.  The handler first
+prompts for a target file - if you press @key{RET}, the value of
+@code{org-default-notes-file} is used.  Then the command offers the
+headings tree of the selected file.  You can either immediately press
+@key{RET} to get the note appended to the file.  Or you can use
+vertical cursor motion (@key{up} and @key{down}) and visibility
+cycling (@key{TAB}) to find a better place.  Pressing @key{RET} or
+@key{left} or @key{right} leads to the following result.
+
+@multitable @columnfractions 0.2 0.1 0.7
+@item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
+@item buffer-start @tab @key{RET} @tab as level 2 heading at end of file
+@item on headline @tab @key{RET} @tab as sublevel of the heading at cursor
+@item             @tab @key{left}  @tab as same level, before current heading
+@item             @tab @key{right} @tab as same level, after current heading
+@item not on headline @tab @key{RET} 
+      @tab at cursor position, level taken from context.
+           Or use prefix arg to specify level manually.
+@end multitable
+
+So the fastest way to store the note is to press @kbd{C-c C-c @key{RET}
+@key{RET}} to append it to the default file.  But with little extra
+effort, you can push it directly to the correct location.
+
+Before inserting the text into a tree, the function ensures that the
+text has a headline, i.e. a first line that starts with a @samp{*}.
+If not, a headline is constructed from the current date and some
+additional data.  If the variable @code{org-adapt-indentation} is
+non-nil, the entire text is also indented so that it starts in the
+same column as the headline (after the asterixes).
+
+@node Timestamps, Timeline and Agenda, Hyperlinks, Top
+@chapter Timestamps
+
+Items can be labeled with timestamps to make them useful for project
+planning.
+
+@menu
+* Time stamps::                 Assigning a time to a tree entry
+* Creating timestamps::         Commands which insert timestamps
+@end menu
+
+
+@node Time stamps, Creating timestamps, Timestamps, Timestamps
+@section Time stamps, deadlines and scheduling
+@cindex time stamps
+@cindex deadlines
+@cindex scheduling
+
+A time stamp is a specification of a date (possibly with time) in a
+special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16
+Tue 09:39>}.  A time stamp can appear anywhere in the headline or body
+of an org-tree entry.  Its presence allows to show entries on specific
+dates in the agenda (@pxref{Agenda (multiple files)}).  We distinguish:
+
+@table @var
+@cindex timestamp
+@item TIMESTAMP
+A simple time stamp just assigns a date/time to an item.  In the
+timeline and agenda displays, the headline of the entry will be shown
+exactly on that date.
+
+@item TIMERANGE
+@cindex timerange
+Two time stamps connected by @samp{--} denote a time range.  The
+headline will be shown on the first and last day of the range, and on
+any dates that are displayed and fall in the range.  Here is an
+example:
+
+@example
+** Meeting in Amsterdam
+   <2004-08-23 Mon>--<2004-08-26 Thu>
+@end example
+
+@item DEADLINE
+@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
+@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:
+
+@example
+*** TODO write article about the Earth for the Guide
+    The editor in charge is bbdb:Ford Prefect
+    DEADLINE: <2004-02-29 Sun>
+@end example
+
+@item SCHEDULED
+@cindex scheduled
+If a time stamp is preceded by the word @samp{SCHEDULED:}, it means
+you are planning to start working on that task on the given date.  The
+headline will be listed under the given date.  In addition, a reminder
+that the scheduled date has passed will be present in the compilation
+for the @emph{current day}, until the entry is marked DONE.  I.e., the
+task will automatically be forwarded.
+@end table
+
+@node Creating timestamps,  , Time stamps, Timestamps
+@section Creating timestamps
+@cindex creating timestamps
+
+For Org-mode to recognize time stamps, they need to be in the specific
+format.  All commands listed below produce time stamps in the correct
+format.
+
+@table @kbd
+@kindex C-c .
+@item C-c .
+Prompt for a date and insert a corresponding time stamp.  When the
+cursor is at a previously used time stamp, it is updated to NOW.  When
+this command is used twice in succession, a time range is inserted.
+
+@kindex C-u C-c .
+@item C-u C-c .
+Like @kbd{C-c .}, but use the alternative format which contains date
+and time.
+
+@kindex C-c <
+@item C-c <
+Insert a time stamp corresponding to the cursor date in the Calendar.
+
+@kindex C-c >
+@item C-c >
+Access the Emacs calendar for the current date.  If there is a
+timestamp in the current line, goto the corresponding date
+instead.
+
+@kindex C-c C-o
+@item C-c C-o
+Access the agenda for the date given by the time stamp at point
+(@pxref{Agenda (multiple files)}).
+
+@kindex C-c C-d
+@item C-c C-d
+Insert @samp{DEADLINE} keyword along with a stamp.
+@kindex C-c C-w
+@cindex sparse tree, for deadlines
+@item C-c C-w
+Create a sparse tree with all deadlines that are either past-due, or
+which will become due within @code{org-deadline-warning-days}.
+With @kbd{C-u} prefix, show all deadlines in the file.  With a numeric
+prefix, check that many days.  For example, @kbd{C-1 C-c C-w} shows
+all deadlines due tomorrow.
+
+@kindex C-c C-s
+@item C-c C-s
+Insert @samp{SCHEDULED} keyword along with a stamp.
+
+@kindex S-@key{left}
+@kindex S-@key{right}
+@item S-@key{left}
+@itemx S-@key{right}
+Change date at cursor by one day.
+
+@kindex S-@key{up}
+@kindex S-@key{down}
+@item S-@key{up}
+@itemx S-@key{down}
+Change the item under the cursor in a timestamp.  The cursor can be on
+a year, month, day, hour or minute.  Note that if the cursor is not at
+a time stamp, these same keys modify the priority of an item
+(@pxref{Priorities}).
+
+@kindex C-c C-y
+@cindex evaluate time range
+@item C-c C-y
+Evaluate a time range by computing the difference between start and
+end.  With prefix arg, insert result after the time range (in a table:
+into the following column).
+@end table
+
+@cindex date, reading in minibuffer
+@cindex time, reading in minibuffer
+@cindex calendar, for selecting date
+When org prompts for a date/time, the function reading your input will
+replace anything you choose not to specify with the current date and
+time.  For details, see the documentation string of
+@command{org-read-date}.  Also, a calender will pop up to allow
+selecting a date.  The calendar can be fully controlled from the
+minibuffer, and a date can be selected with the following commands:
+
+@table @kbd
+@kindex <
+@item <
+Scroll calendar backwards by one month.
+@kindex >
+@item >
+Scroll calendar forwards by one month.
+@kindex mouse-1
+@item mouse-1
+Select date by clicking on it.
+@kindex S-@key{right}
+@item S-@key{right}
+One day forward.
+@kindex S-@key{left}
+@item S-@key{left}
+One day back.
+@kindex S-@key{down}
+@item S-@key{down}
+One week forward.
+@kindex S-@key{up}
+@item S-@key{up}
+One week back.
+@kindex M-S-@key{right}
+@item M-S-@key{right}
+One month forward.
+@kindex M-S-@key{left}
+@item M-S-@key{left}
+One month back.
+@kindex @key{RET}
+@item @key{RET}
+Choose date in calendar (only if nothing typed into minibuffer).
+@end table
+
+@node Timeline and Agenda, Exporting, Timestamps, Top
+@chapter Timeline and Agenda
+@cindex agenda
+
+We have already described three commands to filter important
+information in an org file into a sparse tree (@pxref{Sparse trees}):
+
+@cindex sparse trees
+@itemize @bullet
+@item
+The TODO tree, (@kbd{C-c C-v}), see @ref{TODO items}.
+@item
+The occur tree @kbd{C-c /}, see @ref{TODO items}.
+@item
+Checking upcoming deadlines with @kbd{C-c C-w}, see @ref{Creating
+timestamps}.
+@end itemize
+@noindent
+
+Instead of using the sparse trees, Org-mode can also collect and
+time-sort the important items into a separate buffer, which we call
+the @emph{timeline} of the org file.  It can also collect information
+from a @emph{list of files} and in this way provide an @emph{agenda}
+which covers all of your current projects, action items and
+appointments.
+
+@menu
+* Timeline (single file)::      Time-sorted view for single file
+* Agenda (multiple files)::     Your weekly planner
+* Agenda commands::             Remote editing of org trees
+* Calendar/Diary integration::  Integrating Anniversaries and more
+@end menu
+
+@node Timeline (single file), Agenda (multiple files), Timeline and Agenda, Timeline and Agenda
+@section Timeline for a single file
+@cindex single file summary
+@cindex agenda, for single file
+@cindex timeline, single file
+@cindex time-sorted view
+
+The timeline shows all time-stamped items in a single Org-mode file,
+in @emph{time-sorted view}.  The main purpose of this command is to
+give an overview over events in a project.
+
+@table @kbd
+@kindex C-c C-r
+@item C-c C-r
+Show a time-sorted view of the org file, with all time-stamped items
+of today or later.  When called with a @kbd{C-u} prefix, past dates
+will be included as well.  When called with two @kbd{C-u C-u}
+prefixes, all unfinished TODO entries (scheduled or not) are also
+listed under the current date.
+@end table
+@noindent
+
+The timeline is shown in a temporary buffer @file{*Org Agenda*}.  The
+commands available in the Agenda buffer are listed in @ref{Agenda
+commands}.
+
+@node Agenda (multiple files), Agenda commands, Timeline (single file), Timeline and Agenda
+@section Agenda from multiple files
+@cindex agenda, from multiple files
+
+An agenda can be compiled from one or more org files.  The main
+purpose of this command is to act like a planner, in order to show you
+what tasks are up for the current week, similar to a paper agenda.
+
+The Org-mode files to be processed in order to generate the agenda are
+listed in the variable @code{org-agenda-files}.  You can customize
+this variable, but the easiest way to maintain it is through the
+following commands
+
+@cindex files, adding to agenda list
+@table @kbd
+@kindex C-c [
+@item C-c [
+Add current file to the list of agenda files
+@kindex C-c ]
+@item C-c ]
+Remove current file from the list of agenda files.
+@end table
+@noindent
+The Org menu contains the list of all files and can be used to quickly
+visit any of them.
+
+The global command @command{org-agenda} compiles the agenda from all
+listed files.
+
+@table @kbd
+@cindex org-agenda, command
+@kindex C-c a
+@item C-c a
+Compile an agenda for the current week from a list of org files.  The
+agenda shows the entries for each day.  With a @kbd{C-u} prefix (or
+when the variable @code{org-agenda-include-all-todo} is @code{t}), all
+unfinished TODO items (also those without a date) are also listed at
+the beginning of the buffer, before the first date.@*
+The key binding @kbd{C-c a} is only a suggestion - see
+@ref{Installation}.
+@end table
+
+The commands available in the Agenda buffer are listed in
+@ref{Agenda commands}.
+
+@subsection Categories
+
+@cindex category
+In the agenda buffer, each entry is preceded by a @emph{category},
+which is derived from the file name.  You can also set the category of
+a file through file variables, for example by making the first line of
+the file look like this:
+
+@cindex file variables
+@example
+Planet Finder -*- mode: org; org-category: Cheops -*-
+@end example
+@noindent
+Or, like with TODO keywords (@pxref{Per file keywords}), you can
+insert a special line anywhere in the file:
+
+@example
+#+CATEGORY: Cheops
+@end example
+@noindent
+The display looks best if the category is no longer than 10 characters.
+
+
+@subsection Sorting of agenda items
+@cindex sorting, of agenda items
+@cindex priorities, of agenda items
+The entries for each day are sorted.  The default order is to first
+collect all items containing an explicit time-of-day specification.
+These entries will be shown at the beginning of the list, as a
+@emph{schedule} for the day.  After that, items remain grouped in
+categories, in the sequence given by @code{org-agenda-files}.  Within
+each category, items are sorted by priority (@pxref{Priorities}).
+
+A time-of-day specification looks like @samp{12:45} or @samp{3pm} and
+must appear in the headline.  For example, a timestamp in a headline
+that contains not only a date but also a time will trigger this
+mechanism.  Specifications of a time in diary entries are recognized
+as well, so the schedule will be mixed from diary entries and Org-mode
+files.
+
+The priority is a numerical quantity composed of the base priority
+(2000 for priority @samp{A}, 1000 for @samp{B}, and 0 for @samp{C}),
+plus additional increments for overdue scheduled or deadline items.
+
+Sorting can be customized using the variable
+@code{org-agenda-sorting-strategy}.
+
+@node Agenda commands, Calendar/Diary integration, Agenda (multiple files), Timeline and Agenda
+@section Commands in the agenda buffer
+
+Entries in the agenda buffer are linked back to the org file.  You are
+not allowed to edit the agenda buffer itself, but commands are provided
+to edit the org-files ``remotely'' from the agenda buffer.  In this
+way, all information is stored only once, and you don't risk that your
+agenda and note files diverge.
+
+Some commands can be executed with mouse clicks on agenda lines.  For
+the other commands, the cursor needs to be in the desired line.  Most
+commands are available for both timelines and the agenda.  The
+exceptions are marked.
+
+@table @kbd
+@tsubheading{View/GoTo org file}
+@kindex mouse-3
+@kindex @key{SPC}
+@item mouse-3
+@itemx @key{SPC} 
+Display the original location of the item in another window.
+
+@kindex l
+@item l
+Display original location and recenter that window.
+
+@kindex mouse-2
+@kindex @key{TAB}
+@item mouse-2
+@itemx @key{TAB}
+Go to the original location of the item in another window.
+
+@kindex @key{RET}
+@itemx @key{RET}
+Go to the original location of the item and delete other windows.
+
+@kindex f
+@item f
+Toggle follow mode.  In follow mode, as you move the cursor through
+the agenda buffer, the other window always shows the corresponding
+location in the org file.
+
+
+@tsubheading{Change display}
+@kindex o
+@item o
+Delete other windows.
+
+@kindex w
+@item w
+Toggle between weekly and daily view.
+
+@kindex d
+@item d
+Toggle the inclusion of diary entries.  See @ref{Calendar/Diary integration}.
+
+@kindex r
+@item r
+Recreate the agenda buffer, for example to reflect the changes
+after modification of the time stamps of items with S-@key{left} and
+S-@key{right}.
+
+@kindex @key{right}
+@item @key{right}
+Display the following @code{org-agenda-ndays} days.  For example, if
+the display covers a week, switch to the following week.  With prefix
+arg, go forward that many times @code{org-agenda-ndays} days.  Not
+available in timlines.
+
+@kindex @key{left}
+@item @key{left}
+Display the previous dates.  Not available in timelines.
+
+@kindex .
+@item .
+Goto today.
+
+@tsubheading{Remote editing}
+
+@item 0-9
+Digit argument.
+
+@kindex t
+@item t
+Change the TODO state of the item, both in the agenda and in the
+original org file.
+
+@kindex p
+@item p
+Set the priority for the current item.  Org-mode prompts for the
+priority character. If you reply with @key{SPC}, the priority cookie
+is removed from the entry.
+
+@kindex P
+@item p
+Display weighted priority of current item.
+
+@kindex +
+@item +
+Increase the priority of the current item.  The priority is changed in
+the original buffer, but the agenda is not resorted.  Use the @kbd{r}
+key for this.
+
+@kindex -
+@item -
+Decrease the priority of the current item.
+
+@kindex S-@key{right}
+@item S-@key{right}
+Change the time stamp associated with the current line by one day into
+the future.  With prefix argument, change it by that many days.  For
+example, @kbd{3 6 5 S-@key{right}} will change it by a year.  The
+stamp is changed in the original org file, but the change is not
+directly reflected in the agenda buffer.  Use the 
+@kbd{r} key to update the buffer.
+
+@kindex S-@key{left}
+@item S-@key{left}
+Change the time stamp associated with the current line by one day
+into the past.
+
+@kindex >
+@item >
+Change the time stamp associated with the current line to today.
+The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
+on my keyboard.
+
+@cindex diary entries, creating from agenda
+@kindex i
+@item i
+Insert a new entry into the diary.  Prompts for the type of entry
+(day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
+entry in the diary, just like @kbd{i d} etc. would do in the calendar.
+The date is taken from the cursor position.
+
+@tsubheading{Quit and Exit}
+@kindex q
+@item q
+Quit Agenda, remove the agenda buffer.
+
+@kindex x
+@cindex agenda files, removing buffers
+@item x
+Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
+for the compilation of the agenda.  Buffers created by the user to
+visit org files will not be removed.
+
+@end table
+
+@node Calendar/Diary integration,  , Agenda commands, Timeline and Agenda
+@section Calendar/Diary integration
+@cindex calendar integration
+@cindex diary integration
+
+Emacs contains the calendar and diary by Edward M. Reingold.  The
+calendar displays a three-month calendar with holidays from different
+countries and cultures.  The diary allows to keep track of
+anniversaries, lunar phases, sunrise/set, recurrent appointments
+(weekly, monthly) and more.  In this way, it is quite complementary to
+Org-mode.  It can be very useful to combine output from Org-mode with
+the diary.
+
+The interaction between Org-mode and diary works both ways: You can
+list entries from the diary in the Org-mode agenda, or you can display
+entries from the org agenda in the Emacs diary.
+
+@menu
+* Diary to agenda::             Agenda incorporates the diary
+* Agenda to diary::             Diary incorporates the agenda
+@end menu
+
+@node Diary to agenda, Agenda to diary, Calendar/Diary integration, Calendar/Diary integration
+@subsection Including the diary into the agenda
+@cindex diary to agenda
+
+In order to include entries from the Emacs diary into Org-mode's
+agenda, you only need to customize the variable
+
+@lisp
+(setq org-agenda-include-diary t)
+@end lisp
+@noindent
+
+@noindent After that, everything will happen automatically.
+
+@node Agenda to diary,  , Diary to agenda, Calendar/Diary integration
+@subsection Including the agenda into the diary
+
+If you prefer to use the Emacs diary as your main instrument and if
+you wish to include the Org-mode agenda into it, the following steps
+are necessary: Autoload the function @command{org-diary} as shown
+above under @ref{Installation}.  You also need to use @emph{fancy
+diary display} by setting in @file{.emacs}:
+
+@lisp
+(add-hook 'diary-display-hook 'fancy-diary-display)
+@end lisp
+
+Then include the following line into your @file{~/diary} file, in
+order to get the entries from all files listed in the variable
+@code{org-agenda-files}:
+
+@example
+&%%(org-diary)
+@end example
+@noindent
+You may also select specific files with
+
+@example
+&%%(org-diary) ~/path/to/some/org-file.org
+&%%(org-diary) ~/path/to/another/org-file.org
+@end example
+
+If you now launch the calendar and press @kbd{d} to display a diary,
+the headlines of entries containing a timestamp, date range, schedule,
+or deadline referring to the selected date will be listed.  Just like
+in Org-mode's agenda view, the diary for @emph{today} contains
+additional entries for overdue deadlines and scheduled items.  See
+also the documentation of the @command{org-diary} function.
+
+@node Exporting, Miscellaneous, Timeline and Agenda, Top
+@chapter Exporting
+@cindex exporting
+@cindex ASCII file
+@cindex HTML
+
+
+@cindex headline levels, for exporting
+For printing and sharing of notes, an Org-mode document can be
+exported as an ASCII file, or as HTML.  In the exported version, the
+first 3 outline levels will become headlines, defining a general
+document structure.  Additional levels will be exported as itemize
+lists.  If you want that transition to occur at a different level,
+specify it with a prefix argument.  For example,
+
+@example
+@kbd{M-1 M-x org-export-as-html}
+@end example
+@noindent
+creates only top level headlines and does the rest as items.
+
+@menu
+* Export commands::             Commands which export and display
+* HTML formatting::             Interpretation of the buffer content
+* Export options::              How to influence exports
+* Comment lines::               Lines which will not be exported
+@end menu
+
+@node Export commands, HTML formatting, Exporting, Exporting
+@section Export commands
+
+@cindex region, active
+@cindex active region
+@cindex transient-mark-mode
+@table @kbd
+@kindex C-c C-x a    
+@item C-c C-x a
+Export as ASCII file.  If there is an active region, only the region
+will be exported.  For an org file @file{myfile.org}, the ASCII file
+will be @file{myfile.txt}.  The file will be overwritten without
+warning.
+@kindex C-c C-x h    
+@item C-c C-x h
+Export as HTML file @file{myfile.html}.
+@kindex C-c C-x C-h  
+@item C-c C-x C-h
+Export as HTML file and open it with a browser.
+@kindex C-c C-x t
+@item C-c C-x t
+Insert template with export options, see below.
+@kindex C-c :
+@item C-c :
+Toggle fixed-width for line or region, see below.
+@end table
+
+@node HTML formatting, Export options, Export commands, Exporting
+@section HTML formatting
+
+Not all text is transferred literally to the exported HTML file.  The
+exporter implements the following interpretation:
+
+@itemize @bullet
+@cindex underlined text
+@cindex bold text
+@cindex italic text
+@item
+You can make words @b{*bold*}, @i{/italic/}, and _underlined_
+
+@cindex @TeX{} interpretation
+@item
+Simple @TeX{}-like math constructs are interpreted:
+
+@itemize @minus
+@item
+@samp{10^22} and @samp{J_n} are super- and subscripts.  You can quote
+@samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}
+@item
+@samp{\alpha} indicates a Greek letter, @samp{\to} an arrow.  You can
+use completion for these macros, just type @samp{\} and maybe a few
+letters, and press @kbd{M-@key{TAB}} to see possible completions.
+@end itemize
+
+@cindex tables, export to HTML
+@item
+Tables are transformed into HTML tables.
+
+@cindex fixed width
+@item
+Lines starting with @samp{:} are typeset in a fixed-width font, to
+allow quoting of computer code etc. 
+
+@cindex HTML tags
+@item
+If you want to include HTML tags which should be interpreted as such,
+mark them with a @samp{@@} like in @samp{@@<b>bold text@@</b>}.
+Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
+@samp{&gt;} in HTML export.
+@end itemize
+
+If these conversions conflict with your habits of typing ASCII text,
+they can all be turned off with corresponding variables.
+
+@node Export options, Comment lines, HTML formatting, Exporting
+@section Export options
+@cindex options, for export
+
+The exporter recognizes special lines in the buffer which provide
+additional information.  These lines may be put anywhere in the file.
+The whole set of lines can be inserted into the buffer with @kbd{C-c
+C-x t}.  For individual lines, a good way to make sure the keyword is
+correct it to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
+(@pxref{Completion}). 
+
+@example
+#+TITLE:     the title to be shown (default is the buffer name)
+#+AUTHOR:    the author (default taken from @code{user-full-name})
+#+EMAIL:     his/her email address (default from @code{user-mail-address})
+#+LANGUAGE:  language for HTML, e.g. @samp{en} (@code{org-export-default-language})
+#+TEXT:      Some descriptive text to be inserted at the beginning.
+#+TEXT:      Several lines may be given.
+#+OPTIONS:   H:2  num:t  toc:t  \n:nil  @:t  ::t  |:t  ^:t  *:nil  TeX:t
+@end example
+@noindent
+The OPTIONS line is a compact form to specify export settings.  Here
+you can
+@cindex headline levels
+@cindex section-numbers
+@cindex table of contents
+@cindex linebreak-preservation
+@cindex quoted html tags
+@cindex fixed-width sections
+@cindex tables
+@cindex @TeX{}-like syntax for sub- and superscripts
+@cindex emphasized text
+@cindex @TeX{} macros
+@example
+H:      @r{set the number of headline levels for export}
+num:    @r{turn on/off section-numbers}
+toc:    @r{turn on/off table of contents}
+\n:     @r{turn on/off linebreak-preservation}
+@@:      @r{turn on/off quoted html tags}
+::      @r{turn on/off fixed-width sections}
+|:      @r{turn on/off tables}
+^:      @r{turn on/off @TeX{}-like syntax for sub- and superscripts.}
+*:      @r{turn on/off emphasized text (bold, italic, underlined)}
+TeX:    @r{turn on/off @TeX{} macros}
+@end example
+
+@node Comment lines,  , Export options, Exporting
+@section Comment lines
+@cindex comment lines
+@cindex exporting, not
+
+Lines starting with @samp{#} in column zero are treated as comments
+and will never be exported.  Also entire subtrees starting with the
+word @samp{COMMENT} will never be exported.  Finally, any text before
+the first headline will not be exported either.
+
+@table @kbd
+@kindex C-c ;
+@item C-c ;
+Toggle the COMMENT keyword at the beginning of an entry.
+@end table
+
+@node Miscellaneous, Index, Exporting, Top
+@chapter Miscellaneous
+
+@menu
+* Completion::                  M-TAB knows what you need
+* Customization::               Adapting Org-mode to your taste
+* Tips and Tricks::             An author-imposed FAQ, sort of
+* Interaction::                 Other Emacs packages
+* Acknowledgments::             These people provided feedback and more
+* Bugs::                        Things which do not work perfectly
+@end menu
+
+@node Completion, Customization, Miscellaneous, Miscellaneous
+@section Completion
+@cindex complete @TeX{} symbols
+@cindex complete TODO keywords
+@cindex complete dictionary words
+@cindex complete option keywords
+
+Org-mode supports in-buffer completion.  This type of completion does
+not make use of the minibuffer.  You simply type a few letters into
+the buffer and use the key to complete text right there.
+
+@table @kbd
+@kindex M-@key{TAB}
+@item M-@key{TAB}
+Complete word at point
+@itemize @bullet
+@item
+At the beginning of a headline, complete TODO keywords.
+@item
+After @samp{\}, complete @TeX{} symbols supported by the exporter.
+@item
+After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
+@samp{OPTIONS} which set file-specific options for Org-mode.  When the
+option keyword is already complete, pressing @kbd{M-@key{TAB}} again
+will insert example settings for this keyword.
+@item
+Elsewhere, complete dictionary words using ispell.
+@end itemize
+@end table
+
+@node Customization, Tips and Tricks, Completion, Miscellaneous
+@section Customization
+@cindex customization
+@cindex options, for customization
+@cindex variables, for customization
+
+There is a large number of variables which can be used to customize
+Org-mode.  For the sake of compactness of the manual, we are not
+describing the variables here.  For an overview of customization
+variables, use @kbd{M-x org-customize}.  Or select @code{Browse Org
+Group} from the @code{Org->Customization} menu.
+
+@node Tips and Tricks, Interaction, Customization, Miscellaneous
+@section Tips and Tricks
+
+@itemize @bullet
+@cindex README files
+@item
+I find Org-mode very useful for the many @file{README} files I have
+scattered through my directories.  So I turn on @file{org-mode} for
+all @file{README} files with
+
+@example
+(add-to-list 'auto-mode-alist '("README$" . org-mode))
+@end example
+
+@ignore
+@cindex files, adding automatically
+@item
+If you would like to add all org files you ever create to the list of
+agenda files@footnote{Think twice.  Do you @emph{really} want this?},
+you could do so with
+
+@lisp
+(add-hook 'org-mode-hook 'org-add-file)
+@end lisp
+
+If you would like to add only a selection, for example everything
+except the @file{README} files, this could be achieved in the
+following way:
+
+@lisp
+(add-hook 'org-mode-hook
+          (lambda ()
+             (or (string-match "README\\'" (buffer-file-name))
+                 (org-add-file))))
+@end lisp
+@end ignore
+
+@cindex @code{make-indirect-buffer}
+@cindex indirect buffers
+@item
+It can be useful to have two different windows showing the same
+Org-mode file.  However, a problem here is that changes to the
+visibility in one window immediately affect the other window.  On
+Emacs (not on XEmacs because it uses the old outline-mode) a way out
+is the use of @emph{indirect buffers}, which visit the same file, but
+have separate settings, also for outline visibility.  See the
+documentation on the command @code{make-indirect-buffer}.
+
+@cindex URL, paste into buffer
+@item
+Paste URLs into Org-mode whenever this seems useful.  For example, if
+you are writing notes about a paper which is available on the web, put
+the corresponding URL there and a direct look at the paper is only a
+mouse click away.  If you have a local copy of the paper, use a
+file:path link.
+
+@cindex headline levels, for export
+@item
+If you plan to use ASCII or HTML export, make sure things you want to
+be exported as item lists are level 4 at least, even if that does mean
+there is a level jump.  For example
+
+@example
+* Todays top priorities
+**** TODO write a letter to xyz
+**** TODO Finish the paper
+**** Pick up kids at the school
+@end example
+
+Alternatively, if you need a specific value for the heading/item
+transition in a particular file, use the @samp{+OPTIONS} line to
+configure the @samp{H} switch.
+
+@example
++OPTIONS:   H:2; ...
+@end example
+
+@cindex exporting a subtree
+@item
+If you want to export a subtree, mark the subtree as region and then
+export.  Marking can be done with @kbd{C-c @@ C-x C-x}, for example.
+
+@cindex table, empty template
+@item
+To insert an empty table template, just type @samp{|-} and use
+@key{TAB}.
+
+@item
+In a table, to add a new column at the end, just type some text
+anywhere after the final @samp{|}.  Upon the next re-align, a new
+column will be created.
+
+@item
+In tables, @key{TAB} creates new rows before horizontal separator lines.  If
+the cursor is at @samp{Age} in the following table,
+
+@example
+| Name  | Phone | Age |
+|-------+-------+-----|
+|       |       |     |
+@end example
+
+the next @key{TAB} would create a second header line.  If you want
+instead to go to the first empty field below the horizontal line,
+press @key{down} (to get on the separator line) and then @key{TAB}.
+
+@cindex indentation, of tables
+@item
+To change the indentation of a table, just change the first line and
+realign with @key{TAB}.
+
+@end itemize
+
+
+@node Interaction, Acknowledgments, Tips and Tricks, Miscellaneous
+@section Interaction with other packages
+@cindex packages, interaction with other
+@cindex @file{planner.el}
+@cindex @file{remember.el}
+@cindex @file{table.el}
+@file{Org.el} can cooperate with the following packages:
+
+@table @asis
+@cindex @file{remember.el}
+@item @file{remember.el} by John Wiegley
+Org mode cooperates with remember, see @ref{Remember}.
+@cindex @file{plannner.el}
+@item @file{planner.el} by John Wiegley
+Planner is another tool to plan work and keep track of tasks.  Planner
+uses a multi-file approach with project pages and day pages.  Is based
+on Emacs-Wiki.  It can be useful to display the agenda entries
+resulting from org files in day-pages of the planner.  This can be
+done through the diary of the calendar: Integrate org files into the
+diary as described above, and then turn on the diary support of
+planner.
+@cindex @file{table.el}
+@item @file{table.el} by Takaaki Ota
+Org mode cooperates with table.el, see @ref{table.el}.
+@end table
+
+@c EmacsWiki
+@c organizer-mode
+@c todo-mode
+@c records mode
+
+@page  @c FIXME
+
+@node Acknowledgments, Bugs, Interaction, Miscellaneous
+@section Acknowledgments
+@cindex acknowledgments
+
+Org-mode was written by Carsten Dominik, who still maintains it at the
+Org-mode homepage
+@uref{http://www.astro.uva.nl/~dominik/Tools/org/}.  The following
+people have helped the development along with ideas, suggestions and
+patches. 
+
+@itemize @bullet
+@item
+Matthias Rempe (Oelde) provided ideas and suggestions, a patch
+introducing Windows NT/2000 support, and quality control.
+@item
+Kevin Rogers contributed code to access VM files on remote hosts.
+@item
+Juergen Vollmer contributed code generating the table of contents
+in HTML output, and other export improvements.
+@item
+Christian Egli converted the documentation into TeXInfo format.  He
+also showed me his plans for a multifile summary for Org-mode. Some of
+his ideas have found their way into the agenda.
+@item 
+Philip Rooke created the Org-mode reference card and did some
+beta-testing.
+@item
+Linking to VM/BBDB/GNUS was inspired by Tom Shannon's
+@file{organizer-mode.el}.
+@item
+Scheduling TODO items was inspired by John Wiegley's @file{planner.el}.
+@item
+Sacha Chua, the current maintainer of Planner suggested to take some
+linking code from Planner, which I did (for RMAIL and Wanderlust).
+@item
+Oliver Oppitz sent several useful suggestions.
+@item
+Carsten Wimmer suggested some changes and helped fix a bug in linking
+to GNUS.
+@end itemize
+
+@node Bugs,  , Acknowledgments, Miscellaneous
+@section Bugs
+@cindex bugs
+
+Here is a list of things which should work differently, but which I
+have found too hard to fix.
+
+@itemize @bullet
+@item 
+When the application called by @kbd{C-c C-o} to open a file link fails
+(for example because the application does not exits or refuses to open
+the file), it does so silently.  No error message is displayed.
+@item 
+Under XEmacs, if Org-mode entries are included into the diary, it is
+not possible to jump back from the diary to the org file.  Apparently,
+the text properties are lost when the fancy-diary-display is used.
+However, from Org-mode's agenda (created with @kbd{C-c C-r} or
+@kbd{M-x org-agenda}), things do work correctly.
+@item 
+Linux should also have a default viewer application, using mailcap.
+Maybe we can use GNUS or VM mime code?  Or dired's guessing commands?
+Any hints (or even patches) are appreciated.
+@item 
+When you write @samp{x = a /b/ c}, b will be exported in italics.
+@item 
+The exporters work well, but could be made more efficient.
+@end itemize
+
+@node Index, Key Index, Miscellaneous, Top
+@chapter Index
+
+@printindex cp
+
+@node Key Index,  , Index, Top
+@chapter Key Index
+
+@printindex ky
+
+@bye
+
+
+@ignore
+   arch-tag: 7893d1fe-cc57-4d13-b5e5-f494a1bcc7ac
+@end ignore
--- a/man/search.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/search.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000, 2001, 2004
+@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, 2004
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Search, Fixit, Display, Top
@@ -743,10 +743,11 @@
 matches any character that is not a word-constituent.
 
 @item \_<
-matches the empty string, but only at the beginning of a symbol.  A
-symbol is a sequence of one or more word or symbol constituent
-characters.  @samp{\_<} matches at the beginning of the buffer only if
-a symbol-constituent character follows.
+matches the empty string, but only at the beginning of a symbol.
+A symbol is a sequence of one or more symbol-constituent characters.
+A symbol-constituent character is a character whose syntax is either
+@samp{w} or @samp{_}.  @samp{\_<} matches at the beginning of the
+buffer only if a symbol-constituent character follows.
 
 @item \_>
 matches the empty string, but only at the end of a symbol.  @samp{\_>}
--- a/man/xresources.texi	Sun Nov 28 14:39:06 2004 +0000
+++ b/man/xresources.texi	Wed Dec 08 22:20:27 2004 +0000
@@ -1,7 +1,7 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 1987,93,94,95,1997,2001,03 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node X Resources, Antinews, Command Arguments, Top
+@node X Resources, Antinews, Emacs Invocation, Top
 @appendix X Options and Resources
 
   You can customize some X-related aspects of Emacs behavior using X
--- a/src/ChangeLog	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/ChangeLog	Wed Dec 08 22:20:27 2004 +0000
@@ -1,3 +1,315 @@
+2004-12-07  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* xmenu.c (Fx_popup_menu): Correct documentation about position.
+	(xmenu_show): Do not call XTranslateCoordinates.  Adjust position
+	if not given by a mouse click to correspond with x-popup-menu
+	documentation.
+
+	* config.in: Regenerate.
+
+	* gtkutil.c: Include signal.h and syssignal.h.
+	(xg_get_file_name): Block and unblock __SIGRTMIN if defined.
+
+	* alloc.c: If HAVE_GTK_AND_PTHREAD, include pthread.h,
+	new variables main_thread and alloc_mutex,
+	define (UN)BLOCK_INPUT_ALLOC to use alloc_mutex to protect
+	emacs_blocked_* calls and only do (UN)BLOCK_INPUT in the main thread.
+	If not HAVE_GTK_AND_PTHREAD, (UN)BLOCK_INPUT_ALLOC is the same as
+	(UN)BLOCK_INPUT.
+	(emacs_blocked_free, emacs_blocked_malloc)
+	(emacs_blocked_realloc): Use (UN)BLOCK_INPUT_ALLOC.
+	(uninterrupt_malloc): Initialize main_thread and alloc_mutex.
+	(reset_malloc_hooks): New function.
+
+	* lisp.h: Declare reset_malloc_hooks.
+
+	* emacs.c (Fdump_emacs): Call reset_malloc_hooks.
+
+	* keyboard.c: Conditionally include pthread.h
+	(handle_async_inpu, input_available_signalt): If not in the main
+	thread, block signal, send signal to main thread and return.
+
+	* gtkutil.c (xg_get_file_with_chooser): Handle local files only.
+	Set current folder in file chooser if default_filename is a
+	directory.
+
+2004-12-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* regex.c (GET_UNSIGNED_NUMBER): Signal an error when reaching the end.
+	Remove redundant correctness checks.
+	(regex_compile): Fix up error codes for \{..\} expressions.
+
+2004-12-05  Richard M. Stallman  <rms@gnu.org>
+
+	* regex.c (regex_compile): Fix end-of-pattern case for space.
+
+2004-12-03  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macterm.h (cfstring_create_with_utf8_cstring): Add prototype.
+	* mac.c (cfstring_create_with_utf8_cstring): Add to prevent
+	crashes with invalid characters.
+	* macmenu.c (add_menu_item): Use it.
+	* image.c (image_load_quartz2d): Likewise.
+	* macfns.c (x_set_name, x_set_title): Likewise.
+	(Fx_file_dialog): Likewise.  Use constant CFRefs instead of
+	creating them each time for labels.
+
+2004-12-02  Richard M. Stallman  <rms@gnu.org>
+
+	* config.in (RE_TRANSLATE_P): If make_number is not a macro,
+	don't use it here.
+
+	* eval.c (Fcalled_interactively_p): Don't check INTERACTIVE.
+	(interactive_p): Skip Scalled_interactively_p frames
+	like Sinteractive_p frames.
+
+	* data.c (Fmake_variable_buffer_local): Doc fix.
+	(Fmake_local_variable): Doc fix.
+
+	* insdel.c (insert_from_string_before_markers)
+	(insert_from_string): Don't modify buffer on empty insertion.
+
+	* window.c (Fget_lru_window, Fget_largest_window): Doc fixes.
+
+2004-12-01  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* macmenu.c (add_menu_item): Fallback on MacRoman if encoding
+	menu text as UTF8 fails.
+
+2004-12-01  Kim F. Storm  <storm@cua.dk>
+
+	* alloc.c: Add commentary for last change.
+	(XMALLOC_PUT_SIZE, XMALLOC_GET_SIZE): New macros to handle
+	sizeof(size_t) != 4.
+	(overrun_check_malloc, overrun_check_realloc, overrun_check_free):
+	Use them.  Also clear header and trailer of freed memory.
+	(GC_STRING_OVERRUN_COOKIE_SIZE): Rename from GC_STRING_EXTRA.
+	(string_overrun_cookie): Rename from string_overrun_pattern.
+	(GC_STRING_EXTRA): Define from GC_STRING_OVERRUN_COOKIE_SIZE.
+
+2004-12-01  Andreas Schwab  <schwab@suse.de>
+
+	* lisp.h: Declare string_to_multibyte.
+
+2004-12-01  Kenichi Handa  <handa@m17n.org>
+
+	* w32console.c (w32con_write_glyphs): Decide coding here.
+	Adjusted for the change of encode_terminal_code.
+
+	* term.c (encode_terminal_code): Don't make it "static".
+
+2004-11-30  Kenichi Handa  <handa@m17n.org>
+
+	* term.c (encode_terminal_buf, encode_terminal_bufsize): New
+	variables.
+	(encode_terminal_code): Argument changed.  Encode all
+	characters at once, and return a pointer to the result of
+	encoding.
+	(write_glyphs): Decide coding here.  Adjusted for the above
+	change.
+	(insert_glyphs): Likewise.
+	(term_init): Initialize encode_terminal_bufsize to 0.
+
+	* coding.c (Vcode_conversion_workbuf_name): New variable.
+	(syms_of_coding): Initialize and staticpro it.
+	(set_conversion_work_buffer): New function.
+	(run_pre_post_conversion_on_str): Use it.
+	(run_pre_write_conversin_on_c_str): New function.
+
+	* coding.h (run_pre_write_conversin_on_c_str): Extern it.
+
+2004-11-30  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+	* keyboard.c: Don't undef SIGIO
+	* s/darwin.h (NO_SOCK_SIGIO): Define NO_SOCK_SIGIO on carbon
+	* Makefile.in (mac.o): Depend on blockinput.h and atimer.h.
+	(macfns.o): Don't depend on ccl.h.
+	* macfns.c (mac_frame_parm_handlers): Set handlers for
+	Qleft_fringe and Qright_fringe.
+	* macterm.c (mac_fill_rectangle_to_pixmap)
+	(mac_draw_rectangle_to_pixmap, mac_copy_area_to_pixmap)
+	(mac_copy_area_with_mask_to_pixmap, x_draw_image_foreground_1):
+	Put in #if 0.
+	(mac_scroll_area) [TARGET_API_MAC_CARBON]: Use ScrollWindowRect.
+	(x_flush) [TARGET_API_MAC_CARBON]: Don't traverse frames.
+	(XFlush) [TARGET_API_MAC_CARBON]: Define to an empty replacement.
+	(x_draw_glyph_string_background, x_draw_glyph_string_foreground)
+	[!MAC_OS8]: Added ifdef'd out code for os8.  Don't use
+	XDrawImageString.  Always draw background and foreground separately.
+	(x_draw_image_foreground): Use clipping instead of computing the
+	intersection rectangle.
+	(x_draw_image_glyph_string): Don't draw an image with mask to a
+	pixmap.
+	(x_redisplay_interface): Set flush_display_optional member to 0.
+	(XTread_socket): Correctly reset the TEConverter
+	object.
+
+2004-11-30  Kim F. Storm  <storm@cua.dk>
+
+	* lisp.h: New defines to enable buffer overrun checking.
+	(GC_CHECK_STRING_OVERRUN, GC_CHECK_STRING_FREE_LIST)
+	(XMALLOC_OVERRUN_CHECK, GC_CHECK_CONS_LIST): Add.
+
+	* alloc.c: Add more checks for buffer overruns.
+	(XMALLOC_OVERRUN_CHECK_SIZE, xmalloc_overrun_check_header)
+	xmalloc_overrun_check_trailer, overrun_check_malloc)
+	overrun_check_realloc, overrun_check_free): Add.
+	(GC_STRING_EXTRA, string_overrun_pattern): Add.
+	(check_sblock, allocate_string_data, compact_small_strings):
+	Set and check string_overrun_pattern if GC_CHECK_STRING_OVERRUN.
+	(check_cons_list): Condition on GC_CHECK_CONS_LIST.
+	(check_string_free_list): Add.
+	(allocate_string, sweep_strings): Call check_string_free_list.
+
+	* emacs.c (malloc_initialize_hook): Don't free malloc_state_ptr if
+	XMALLOC_OVERRUN_CHECK to avoid crash during load.
+
+2004-11-29  Kim F. Storm  <storm@cua.dk>
+
+	* fns.c (concat): Use SAFE_ALLOCA.
+
+2004-11-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* sysdep.c (emacs_write): Don't use QUIT.
+
+2004-11-29  Kenichi Handa  <handa@m17n.org>
+
+	* buffer.c (init_buffer): Set current_buffer->directory to a
+	multibyte string made by string_to_multibyte.
+
+	* emacs.c (init_cmdargs): Set unibyte strings in Vcommand_line_args.
+
+2004-11-27  Andreas Schwab  <schwab@suse.de>
+
+	* alloc.c (mark_stack): Call GC_MARK_SECONDARY_STACK if defined.
+
+	* s/gnu-linux.h: Enable no-op gcpros on ia64.
+	(GC_MARK_SECONDARY_STACK) [__ia64__]: Define.
+
+	* filelock.c (lock_file_1): Call get_boot_time early.
+	Increase buffer size.
+
+2004-11-27  Eli Zaretskii  <eliz@gnu.org>
+
+	* lisp.h (DECL_ALIGN): Define non-trivially only if NO_DECL_ALIGN
+	is not defined.
+
+2004-11-27  Kim F. Storm  <storm@cua.dk>
+
+	* search.c (syms_of_search) <search-spaces-regexp>: Move 'doc:'
+	marker out of doc string.
+
+2004-11-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* s/darwin.h (POSIX_SIGNALS): Undo the removal of 2002-08-25,
+	which was not mentioned in the log.
+
+2004-11-26  Kim F. Storm  <storm@cua.dk>
+
+	* fringe.c (update_window_fringes): Prefer truncation bitmaps over
+	angle bitmaps at top/bottom line.
+
+	* xdisp.c: Undo recent changes for restoring saved_face_id. Instead,
+	set it when it->method is set to next_element_from_display_vector.
+	(setup_for_ellipsis): Add LEN argument.  Callers changed.
+	Set it->saved_face_id.
+	(get_next_display_element): Use loop instead of recursion.
+	Set it->saved_face_id.  Combine duplicate code for ctr chars.
+	(next_element_from_display_vector): Do not set it->saved_face_id.
+	(next_element_from_ellipsis): Use setup_for_ellipsis.
+
+2004-11-26  Eli Zaretskii  <eliz@gnu.org>
+
+	* eval.c (Fdefvar): Declare pdl from last change as `volatile' to
+	prevent compiler warnings.
+
+2004-11-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* keyboard.c (command_loop_1): Print a message describing the key
+	the user just pressed when this key has no binding.
+
+	* sysdep.c (sys_signal): Don't use SA_RESTART if SYNC_INPUT is set.
+	(emacs_open, emacs_read, emacs_write): Check QUIT when interrupted.
+
+	* lread.c (readchar): Check QUIT when `getc' is interrupted.
+
+2004-11-24  Richard M. Stallman  <rms@gnu.org>
+
+	* coding.c (run_pre_post_conversion_on_str): Bind Qinhibit_read_only.
+
+	* buffer.c (syms_of_buffer) <indicate-buffer-boundaries>: Doc fix.
+
+2004-11-24  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (move_it_in_display_line_to, display_line):
+	Restore saved_face_id also when truncate-lines or hscrolled.
+
+2004-11-23  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* gtkutil.c (xg_get_file_name): Rename use-old-gtk-file-dialog to
+	x-use-old-gtk-file-dialog.
+
+	* xfns.c: Define x_use_old_gtk_file_dialog.
+	(syms_of_xfns): Rename use-old-gtk-file-dialog to x-...  Move it
+	outside ifdef USE_GTK.
+
+2004-11-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* coding.h (ENCODE_FILE, DECODE_FILE, ENCODE_SYSTEM, DECODE_SYSTEM):
+	Don't use XFASTINT blindly.
+
+	* config.in (RE_TRANSLATE_P): Don't use XFASTINT blindly.
+
+	* indent.c (skip_invisible): Avoid non-idempotent side-effects
+	in macro arguments.
+
+	* keymap.c (Flookup_key): Check INTEGERP before XINT.
+
+	* lread.c (oblookup): Don't use XFASTINT blindly.
+
+	* window.c (Fset_window_scroll_bars): Don't use XINT if it isn't int.
+	(decode_next_window_args, window_loop): Don't use XFASTINT blindly.
+
+2004-11-23  Kim F. Storm  <storm@cua.dk>
+
+	* dispextern.h (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P)
+	(MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P): Not if dpvec_index is zero.
+
+	* xfaces.c (lookup_named_face): Add signal_p arg.  Return -1 if
+	signal_p is zero and face name is unknown.
+	(Fx_list_fonts): Don't signal error in lookup_named_face.
+	(Fface_font): Signal error in lookup_named_face.
+	(ascii_face_of_lisp_face): Likewise.
+
+	* dispextern.h (lookup_named_face): Fix prototype.
+
+	* xdisp.c (handle_single_display_prop): Don't signal error in
+	lookup_named_face for unknown fringe face name.
+	(highlight_trailing_whitespace): Don't signal error in
+	lookup_named_face if trailing-whitespace face unknown.
+	(calc_line_height_property): Don't signal error in
+	lookup_named_face if specified face name is unknown.
+
+	* fringe.c (update_window_fringes): Show top row indicator if
+	window has header-line.  Don't show arrow at bob and eob
+	if the boundary indicators are not used.
+	(Fset_fringe_bitmap_face): Signal error in lookup_named_face.
+
+	* window.c (set_window_buffer): Clear display_error_modiff.
+
+2004-11-22  Kim F. Storm  <storm@cua.dk>
+
+	* fringe.c (update_window_fringes): Provide sensible fall-back
+	value for non-nil indicate-buffer-boundaries setting.
+
+2004-11-22  Markus Rost  <rost@ias.edu>
+
+	* minibuf.c (Fminibuffer_complete_and_exit): Fix previous change.
+
+2004-11-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* eval.c (Fdefvar): Warn when var is let-bound but globally void.
+
 2004-11-21  Kim F. Storm  <storm@cua.dk>
 
 	* xdisp.c (erase_phys_cursor): Clear hollow cursor inside TEXT_AREA.
@@ -11,9 +323,9 @@
 	* macterm.c (x_clip_to_row): Add area arg.  Callers changed.
 	(x_draw_hollow_cursor, x_draw_bar_cursor): Clip to TEXT_AREA.
 
-	* xdisp.c (move_it_in_display_line_to, display_line): Restore
-	saved_face_id if overflow-newline-into-fringe is enabled and line
-	is continued before or in middle of element from display vector.
+	* xdisp.c (move_it_in_display_line_to, display_line):
+	Restore saved_face_id if overflow-newline-into-fringe is enabled and
+	line is continued before or in middle of element from display vector.
 
 	* indent.c (Fvertical_motion): Fix last change.  Use another
 	method to detect if iterator moved too far ahead after reseat.
@@ -27,8 +339,7 @@
 
 2004-11-20  Luc Teirlinck  <teirllm@auburn.edu>
 
-	* fns.c (Fyes_or_no_p): Call Fread_from_minibuffer with extra
-	argument.
+	* fns.c (Fyes_or_no_p): Call Fread_from_minibuffer with extra argument.
 	* callint.c (Fcall_interactively): Ditto.
 
 2004-11-20  Stefan Monnier  <monnier@iro.umontreal.ca>
@@ -44,7 +355,7 @@
 	(Fread_from_minibuffer): New arg KEEP_ALL.  Callers changed.
 
 	* search.c (Vsearch_spaces_regexp):
-	Renamed from Vsearch_whitespace_regexp.  All uses changed.
+	Rename from Vsearch_whitespace_regexp.  All uses changed.
 
 2004-11-20  Thien-Thi Nguyen  <ttn@gnu.org>
 
@@ -86,8 +397,7 @@
 
 2004-11-16  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
-	* gtkutil.c (xg_get_file_name): Fix typo in
-	HAVE_GTK_FILE_SELECTION_NEW.
+	* gtkutil.c (xg_get_file_name): Typo in HAVE_GTK_FILE_SELECTION_NEW.
 
 	* xmenu.c (x_menu_in_use): Remove.
 	(x_menu_set_in_use): Also set popup_activated_flag.
@@ -6340,7 +6650,7 @@
 
 2003-06-01  David Ponce  <david@dponce.com>
 
-	* termhooks.h (enum event_kind): Added new WHEEL_EVENT event.
+	* termhooks.h (enum event_kind): Add new WHEEL_EVENT event.
 	Declare MOUSE_WHEEL_EVENT only if MAC_OSX defined.
 
 	* keyboard.c (Qmouse_wheel): Declare only if MAC_OSX defined.
@@ -6348,8 +6658,7 @@
 	(discard_mouse_events): Discard WHEEL_EVENT events too.
 	(lispy_wheel_names, wheel_syms): New.
 	(syms_of_keyboard): Init and staticpro `wheel_syms'.  Init and
-	staticpro `Qmouse_wheel' and `mouse_wheel_syms' only if MAC_OSX
-	defined.
+	staticpro `Qmouse_wheel' and `mouse_wheel_syms' only if MAC_OSX defined.
 	(make_lispy_event): Add WHEEL_EVENT handler.
 
 	* w32term.c (construct_mouse_wheel): Construct WHEEL_EVENT.
@@ -6391,8 +6700,7 @@
 
 	* ccl.h (struct ccl_program) <eight_bit_control>: Comment fixed.
 
-	* ccl.c (CCL_WRITE_CHAR): Increment extra_bytes only when it is
-	nonzero.
+	* ccl.c (CCL_WRITE_CHAR): Increment extra_bytes only when it is nonzero.
 	(ccl_driver): Initialize extra_bytes to ccl->eight_bit_control.
 	(setup_ccl_program): Initialize ccl->eight_bit_control to zero.
 
@@ -6408,19 +6716,18 @@
 
 2003-05-28  Kenichi Handa  <handa@m17n.org>
 
-	* coding.c (ENCODE_UNSAFE_CHARACTER): Adjusted for the name change
+	* coding.c (ENCODE_UNSAFE_CHARACTER): Adjust for the name change
 	of CODING_REPLACEMENT_CHARACTER.
 	(decode_coding_iso2022): If CODING_FLAG_ISO_SAFE, set
 	CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag in coding->mode, and
 	check this flag on encoding.
-	(encode_coding_sjis_big5): Check
-	CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag of coding->mode.
-	(Fset_terminal_coding_system_internal): Set
-	CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag in terminal_coding.mode
-	instead of setting CODING_FLAG_ISO_SAFE flag in
-	terminal_coding.flags.
-
-	* coding.h (CODING_REPLACEMENT_CHARACTER): Renamed from
+	(encode_coding_sjis_big5):
+	Check CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag of coding->mode.
+	(Fset_terminal_coding_system_internal):
+	Set CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag in terminal_coding.mode
+	instead of setting CODING_FLAG_ISO_SAFE flag in terminal_coding.flags.
+
+	* coding.h (CODING_REPLACEMENT_CHARACTER): Rename from
 	CODING_INHIBIT_CHARACTER_SUBSTITUTION.
 	(CODING_MODE_INHIBIT_UNENCODABLE_CHAR): New macro.
 
@@ -6562,65 +6869,65 @@
 	(struct frame): New member scroll_bar_actual_width which
 	consolidates and renames the vertical_scroll_bar_extra member of
 	x_output, w32_output, and mac_output structures.  All uses changed.
-	(FRAME_PIXEL_HEIGHT): Renamed from PIXEL_HEIGHT and moved
+	(FRAME_PIXEL_HEIGHT): Rename from PIXEL_HEIGHT and moved
 	from x/w32/macterm.h files.  All uses changed.  Also change code
 	which referred to f->output_data...->pixel_height.
-	(FRAME_PIXEL_WIDTH): Renamed from PIXEL_WIDTH and moved
+	(FRAME_PIXEL_WIDTH): Rename from PIXEL_WIDTH and moved
 	from x/w32/macterm.h files.  All uses changed.  Also change code
 	which referred to f->output_data...->pixel_width.
-	(FRAME_LINES): Renamed from FRAME_HEIGHT.  All uses changed.
+	(FRAME_LINES): Rename from FRAME_HEIGHT.  All uses changed.
 	Also change code which referred to f->height.
-	(FRAME_COLS): Renamed from FRAME_WIDTH.  All uses changed.
+	(FRAME_COLS): Rename from FRAME_WIDTH.  All uses changed.
 	Also change code which referred to f->width.
 	(FRAME_NEW_HEIGHT, FRAME_NEW_WIDTH): Remove macros; change uses
 	to update new_text_lines and new_text_cols members directly.
-	(FRAME_CONFIG_SCROLL_BAR_WIDTH): Renamed from
+	(FRAME_CONFIG_SCROLL_BAR_WIDTH): Rename from
 	FRAME_SCROLL_BAR_PIXEL_WIDTH.  All uses changed.
-	(FRAME_CONFIG_SCROLL_BAR_COLS): Renamed from
+	(FRAME_CONFIG_SCROLL_BAR_COLS): Rename from
 	FRAME_SCROLL_BAR_COLS.  All uses changed.
 	(FRAME_LEFT_SCROLL_BAR_COLS, FRAME_RIGHT_SCROLL_BAR_COLS):
-	Renamed from FRAME_LEFT_SCROLL_BAR_WIDTH and
+	Rename from FRAME_LEFT_SCROLL_BAR_WIDTH and
 	FRAME_RIGHT_SCROLL_BAR_WIDTH, resp.  All uses changed.
 	(FRAME_SCROLL_BAR_AREA_WIDTH, FRAME_LEFT_SCROLL_BAR_AREA_WIDTH)
 	(FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH): New macros.
-	(FRAME_TOTAL_COLS): Renamed from FRAME_WINDOW_WIDTH.
-	(SET_FRAME_COLS): Renamed from SET_FRAME_WIDTH.
-	(FRAME_TOTAL_COLS_ARG): Renamed from FRAME_WINDOW_WIDTH_ARG.
+	(FRAME_TOTAL_COLS): Rename from FRAME_WINDOW_WIDTH.
+	(SET_FRAME_COLS): Rename from SET_FRAME_WIDTH.
+	(FRAME_TOTAL_COLS_ARG): Rename from FRAME_WINDOW_WIDTH_ARG.
 	(WINDOW_VERTICAL_SCROLL_BAR_COLUMN): Remove unused macro.
 	(WINDOW_VERTICAL_SCROLL_BAR_HEIGHT): Remove unused macro.
-	(FRAME_LINE_HEIGHT): Renamed from CANON_Y_UNIT.  Unconditionally
-	return line_height member (it now has proper value also for
-	non-window frames).
-	(FRAME_COLUMN_WIDTH): Renamed from CANON_X_UNIT.  Unconditionally
+	(FRAME_LINE_HEIGHT): Rename from CANON_Y_UNIT.
+	Unconditionally return line_height member (it now has proper value
+	also for non-window frames).
+	(FRAME_COLUMN_WIDTH): Rename from CANON_X_UNIT.  Unconditionally
 	return new column_width member (rather than the default font width).
 	(FRAME_FRINGE_COLS, FRAME_LEFT_FRINGE_WIDTH)
-	(FRAME_RIGHT_FRINGE_WIDTH): Renamed from FRAME_X_... and moved
+	(FRAME_RIGHT_FRINGE_WIDTH): Rename from FRAME_X_... and moved
 	from x/w32/macterm.h files.  Unconditionally return corresponding
 	member of frame structure (they now have proper values also for
 	non-window frames).
-	(FRAME_TOTAL_FRINGE_WIDTH): Renamed from FRAME_FRINGE_WIDTH.
+	(FRAME_TOTAL_FRINGE_WIDTH): Rename from FRAME_FRINGE_WIDTH.
 	Calculate return value from left and right widths.
 	(FRAME_INTERNAL_BORDER_WIDTH): Unconditionally return
 	internal_border_width member (has proper value for non-window frame).
-	(FRAME_PIXEL_X_FROM_CANON_X): Renamed from PIXEL_X_FROM_CANON_X.
-	(FRAME_PIXEL_Y_FROM_CANON_Y): Renamed from PIXEL_Y_FROM_CANON_Y.
-	(FRAME_CANON_X_FROM_PIXEL_X): Renamed from CANON_X_FROM_PIXEL_X.
-	(FRAME_CANON_Y_FROM_PIXEL_Y): Renamed from CANON_Y_FROM_PIXEL_Y.
-	(FRAME_LINE_TO_PIXEL_Y): Renamed from CHAR_TO_PIXEL_ROW,
+	(FRAME_PIXEL_X_FROM_CANON_X): Rename from PIXEL_X_FROM_CANON_X.
+	(FRAME_PIXEL_Y_FROM_CANON_Y): Rename from PIXEL_Y_FROM_CANON_Y.
+	(FRAME_CANON_X_FROM_PIXEL_X): Rename from CANON_X_FROM_PIXEL_X.
+	(FRAME_CANON_Y_FROM_PIXEL_Y): Rename from CANON_Y_FROM_PIXEL_Y.
+	(FRAME_LINE_TO_PIXEL_Y): Rename from CHAR_TO_PIXEL_ROW,
 	consolidated from xterm.h, macterm.h, and w32term.h.
-	(FRAME_COL_TO_PIXEL_X): Renamed from CHAR_TO_PIXEL_COL,
+	(FRAME_COL_TO_PIXEL_X): Rename from CHAR_TO_PIXEL_COL,
 	consolidated from xterm.h, macterm.h, and w32term.h.
-	(FRAME_TEXT_COLS_TO_PIXEL_WIDTH): Renamed from
+	(FRAME_TEXT_COLS_TO_PIXEL_WIDTH): Rename from
 	CHAR_TO_PIXEL_WIDTH consolidated from x/mac/w32term.h.
-	(FRAME_TEXT_LINES_TO_PIXEL_HEIGHT): Renamed from
+	(FRAME_TEXT_LINES_TO_PIXEL_HEIGHT): Rename from
 	CHAR_TO_PIXEL_HEIGHT consolidated from x/mac/w32term.h.
-	(FRAME_PIXEL_Y_TO_LINE): Renamed from PIXEL_TO_CHAR_ROW
+	(FRAME_PIXEL_Y_TO_LINE): Rename from PIXEL_TO_CHAR_ROW
 	consolidated from x/mac/w32term.h.
-	(FRAME_PIXEL_X_TO_COL): Renamed from PIXEL_TO_CHAR_COL
+	(FRAME_PIXEL_X_TO_COL): Rename from PIXEL_TO_CHAR_COL
 	consolidated from x/mac/w32term.h.
-	(FRAME_PIXEL_WIDTH_TO_TEXT_COLS): Renamed from
+	(FRAME_PIXEL_WIDTH_TO_TEXT_COLS): Rename from
 	PIXEL_TO_CHAR_WIDTH consolidated from x/mac/w32term.h.
-	(FRAME_PIXEL_HEIGHT_TO_TEXT_LINES): Renamed from
+	(FRAME_PIXEL_HEIGHT_TO_TEXT_LINES): Rename from
 	PIXEL_TO_CHAR_HEIGHT consolidated from x/mac/w32term.h.
 
 	* window.h (struct window): Rename members left to left_col,
@@ -6642,7 +6949,7 @@
 	referred to XINT (w->height) * canon_y_unit.
 	(WINDOW_LEFT_EDGE_COL): New macro.  Change relevant code that
 	referred to XINT (w->left).
-	(WINDOW_RIGHT_EDGE_COL): Renamed from WINDOW_RIGHT_EDGE.  Change
+	(WINDOW_RIGHT_EDGE_COL): Rename from WINDOW_RIGHT_EDGE.  Change
 	all uses and code that referred to XINT (w->left) + XINT (w->width).
 	(WINDOW_TOP_EDGE_LINE): New macro.  Change relevant code that
 	referred to XINT (w->top).
@@ -6657,14 +6964,14 @@
 	(WINDOW_BOTTOM_EDGE_Y): New macro.  Change relevant code that
 	referred to (XINT (w->top) + XINT (w->height)) * canon_y_unit.
 	(WINDOW_LEFTMOST_P): New macro.
-	(WINDOW_BOX_LEFT_EDGE_COL): Renamed from WINDOW_LEFT_MARGIN.
+	(WINDOW_BOX_LEFT_EDGE_COL): Rename from WINDOW_LEFT_MARGIN.
 	All uses changed.
-	(WINDOW_BOX_RIGHT_EDGE_COL): Renamed from WINDOW_RIGHT_MARGIN.
+	(WINDOW_BOX_RIGHT_EDGE_COL): Rename from WINDOW_RIGHT_MARGIN.
 	All uses changed.
-	(WINDOW_BOX_LEFT_EDGE_X): Renamed from
+	(WINDOW_BOX_LEFT_EDGE_X): Rename from
 	WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X, moved from dispextern.h.
 	Do not exclude left fringe width.
-	(WINDOW_BOX_RIGHT_EDGE_X): Renamed from
+	(WINDOW_BOX_RIGHT_EDGE_X): Rename from
 	WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X, moved from dispextern.h.
 	Do not exclude fringe widths.
 	(WINDOW_LEFT_FRINGE_WIDTH, WINDOW_RIGHT_FRINGE_WIDTH)
@@ -6691,18 +6998,18 @@
 	FRAME_SCROLL_BAR_WIDTH.
 	(WINDOW_SCROLL_BAR_COLS, WINDOW_SCROLL_BAR_AREA_WIDTH)
 	(WINDOW_SCROLL_BAR_AREA_X): New macros.
-	(WINDOW_HEADER_LINE_HEIGHT): Renamed from
+	(WINDOW_HEADER_LINE_HEIGHT): Rename from
 	WINDOW_DISPLAY_HEADER_LINE_HEIGHT, moved from dispextern.h.
-	(WINDOW_BOX_HEIGHT_NO_MODE_LINE): Renamed from
+	(WINDOW_BOX_HEIGHT_NO_MODE_LINE): Rename from
 	WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE, moved from dispextern.h.
-	(WINDOW_BOX_TEXT_HEIGHT): Renamed from
+	(WINDOW_BOX_TEXT_HEIGHT): Rename from
 	WINDOW_DISPLAY_PIXEL_WIDTH, moved from dispextern.h.
 	(WINDOW_TO_FRAME_PIXEL_X, WINDOW_TO_FRAME_PIXEL_Y)
 	(FRAME_TO_WINDOW_PIXEL_X, FRAME_TO_WINDOW_PIXEL_Y)
-	(WINDOW_TEXT_TO_FRAME_PIXEL_X): Moved here from dispextern.h.
-	(WINDOW_LEFT_MARGIN_WIDTH): Renamed from
+	(WINDOW_TEXT_TO_FRAME_PIXEL_X): Move here from dispextern.h.
+	(WINDOW_LEFT_MARGIN_WIDTH): Rename from
 	WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH, moved from dispextern.h.
-	(WINDOW_RIGHT_MARGIN_WIDTH): Renamed from
+	(WINDOW_RIGHT_MARGIN_WIDTH): Rename from
 	WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH, moved from dispextern.h.
 	(window_from_coordinates): Update prototype.
 	(Fset_window_buffer): Update EXFUN.
@@ -6796,7 +7103,7 @@
 	left_margin_cols, right_margin_cols, left_fringe_width,
 	right_fringe_width, fringes_outside_margins, scroll_bar_width,
 	and vertical_scroll_bar_type.
-	(coordinates_in_window): Adapted to new fringe/margin positions
+	(coordinates_in_window): Adapt to new fringe/margin positions
 	and per-window fringes and scroll-bars.
 	Fix bug related to incorrectly adjusting coordinates by
 	frame's internal_border_width (the effect normally negible since
@@ -6831,7 +7138,7 @@
 	narrow.  This fixes a bug which could cause Emacs to trap if the
 	width of the split window was less than the width of the display
 	margins.
-	(window_box_text_cols): Renamed from window_internal_width.
+	(window_box_text_cols): Rename from window_internal_width.
 	All uses changed.  Adapt to per-window fringes and scroll bars.
 	Fix bug that caused vertical separator to be subtracted also on
 	window frames.  Fix another bug that did not reduce the returned
@@ -6863,8 +7170,7 @@
 	the width of the window.
 	(Fset_window_fringes): New defun to allow user to specifically set
 	this window's fringe widths and position vs. display margins.
-	(Fwindow_fringes): New defun to return window's actual fringe
-	settings.
+	(Fwindow_fringes): New defun to return window's actual fringe settings.
 	(Fset_window_scroll_bars): New defun to allow user to specifically
 	set this window's scroll bar width and position.
 	(Fwindow_scroll_bars): New defun to return window's actual scroll
@@ -6931,17 +7237,16 @@
 	(FRAME_DEFAULT_FONT_WIDTH): Remove macro.
 	(PIXEL_WIDTH, PIXEL_HEIGHT)
 	(FRAME_X_FRINGE_COLS, FRAME_X_FRINGE_WIDTH)
-	(FRAME_X_LEFT_FRINGE_WIDTH, FRAME_X_RIGHT_FRINGE_WIDTH): Moved to
+	(FRAME_X_LEFT_FRINGE_WIDTH, FRAME_X_RIGHT_FRINGE_WIDTH): Move to
 	frame.h and renamed [see frame.h changes].
 	(CHAR_TO_PIXEL_ROW, CHAR_TO_PIXEL_COL, CHAR_TO_PIXEL_WIDTH)
 	(CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_ROW, PIXEL_TO_CHAR_COL)
-	(PIXEL_TO_CHAR_WIDTH, PIXEL_TO_CHAR_HEIGHT): Moved to frame.h
+	(PIXEL_TO_CHAR_WIDTH, PIXEL_TO_CHAR_HEIGHT): Move to frame.h
 	and renamed [see frame.h changes].
 
 	* xterm.c: Make (several) trivial substitutions for renamed and
 	new macros in dispextern.h, frame.h and window.h.
-	(x_draw_glyph_string_box): Adapt to per-window fringes and
-	scroll-bars.
+	(x_draw_glyph_string_box): Adapt to per-window fringes and scroll-bars.
 	(scroll_run): Adapt to new fringe position.
 	(glyph_rect): Use window coordinates returned from
 	window_from_coordinates rather than frame_to_window_pixel_xy.
@@ -6965,17 +7270,16 @@
 	(FRAME_DEFAULT_FONT_WIDTH): Remove macro.
 	(PIXEL_WIDTH, PIXEL_HEIGHT)
 	(FRAME_X_FRINGE_COLS, FRAME_X_FRINGE_WIDTH)
-	(FRAME_X_LEFT_FRINGE_WIDTH, FRAME_X_RIGHT_FRINGE_WIDTH): Moved to
+	(FRAME_X_LEFT_FRINGE_WIDTH, FRAME_X_RIGHT_FRINGE_WIDTH): Move to
 	frame.h and renamed [see frame.h changes].
 	(CHAR_TO_PIXEL_ROW, CHAR_TO_PIXEL_COL, CHAR_TO_PIXEL_WIDTH)
 	(CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_ROW, PIXEL_TO_CHAR_COL)
-	(PIXEL_TO_CHAR_WIDTH, PIXEL_TO_CHAR_HEIGHT): Moved to frame.h
+	(PIXEL_TO_CHAR_WIDTH, PIXEL_TO_CHAR_HEIGHT): Move to frame.h
 	and renamed [see frame.h changes].
 
 	* w32term.c: Make (several) trivial substitutions for renamed and
 	new macros in dispextern.h, frame.h and window.h.
-	(x_draw_glyph_string_box): Adapt to per-window fringes and
-	scroll-bars.
+	(x_draw_glyph_string_box): Adapt to per-window fringes and scroll-bars.
 	(glyph_rect): Use window coordinates returned from
 	window_from_coordinates rather than frame_to_window_pixel_xy.
 	(XTset_vertical_scroll_bar): Adapt to per-window fringes and
@@ -7006,17 +7310,16 @@
 	(FRAME_DEFAULT_FONT_WIDTH): Remove macro.
 	(PIXEL_WIDTH, PIXEL_HEIGHT)
 	(FRAME_X_FRINGE_COLS, FRAME_X_FRINGE_WIDTH)
-	(FRAME_X_LEFT_FRINGE_WIDTH, FRAME_X_RIGHT_FRINGE_WIDTH): Moved to
+	(FRAME_X_LEFT_FRINGE_WIDTH, FRAME_X_RIGHT_FRINGE_WIDTH): Move to
 	frame.h and renamed [see frame.h changes].
 	(CHAR_TO_PIXEL_ROW, CHAR_TO_PIXEL_COL, CHAR_TO_PIXEL_WIDTH)
 	(CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_ROW, PIXEL_TO_CHAR_COL)
-	(PIXEL_TO_CHAR_WIDTH, PIXEL_TO_CHAR_HEIGHT): Moved to frame.h
+	(PIXEL_TO_CHAR_WIDTH, PIXEL_TO_CHAR_HEIGHT): Move to frame.h
 	and renamed [see frame.h changes].
 
 	* macterm.c: Make (several) trivial substitutions for renamed and
 	new macros in dispextern.h, frame.h and window.h.
-	(x_draw_glyph_string_box): Adapt to per-window fringes and
-	scroll-bars.
+	(x_draw_glyph_string_box): Adapt to per-window fringes and scroll-bars.
 	(glyph_rect): Use window coordinates returned from
 	window_from_coordinates rather than frame_to_window_pixel_xy.
 	(XTset_vertical_scroll_bar): Adapt to per-window fringes and
--- a/src/Makefile.in	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/Makefile.in	Wed Dec 08 22:20:27 2004 +0000
@@ -1233,10 +1233,10 @@
   fontset.o indent.o insdel.o keyboard.o macros.o minibuf.o msdos.o process.o \
   scroll.o sysdep.o term.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \
   xterm.o xselect.o sound.o: macgui.h
-mac.o: mac.c process.h sysselect.h systime.h $(config_h)
+mac.o: mac.c process.h sysselect.h blockinput.h atimer.h systime.h $(config_h)
 macfns.o: macfns.c charset.h macterm.h macgui.h frame.h window.h buffer.h \
   dispextern.h macgui.h fontset.h $(INTERVAL_SRC) keyboard.h blockinput.h \
-  atimer.h systime.h epaths.h termhooks.h coding.h ccl.h systime.h $(config_h)
+  atimer.h systime.h epaths.h termhooks.h coding.h systime.h $(config_h)
 macmenu.o: macmenu.c termhooks.h frame.h window.h dispextern.h macgui.h \
   keyboard.h blockinput.h atimer.h systime.h buffer.h macterm.h $(config_h)
 macterm.o: blockinput.h atimer.h systime.h syssignal.h macterm.h macgui.h \
--- a/src/alloc.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/alloc.c	Wed Dec 08 22:20:27 2004 +0000
@@ -31,6 +31,10 @@
 
 #include <signal.h>
 
+#ifdef HAVE_GTK_AND_PTHREAD
+#include <pthread.h>
+#endif
+
 /* This file is part of the core Lisp implementation, and thus must
    deal with the real data structures.  If the Lisp implementation is
    replaced, this file likely will not be used.  */
@@ -85,6 +89,35 @@
 
 #endif /* not DOUG_LEA_MALLOC */
 
+#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD)
+
+static pthread_mutex_t alloc_mutex;
+pthread_t main_thread;
+
+#define BLOCK_INPUT_ALLOC                       \
+  do                                            \
+    {                                           \
+      pthread_mutex_lock (&alloc_mutex);        \
+      if (pthread_self () == main_thread)       \
+        BLOCK_INPUT;                            \
+    }                                           \
+  while (0)
+#define UNBLOCK_INPUT_ALLOC                     \
+  do                                            \
+    {                                           \
+      if (pthread_self () == main_thread)       \
+        UNBLOCK_INPUT;                          \
+      pthread_mutex_unlock (&alloc_mutex);      \
+    }                                           \
+  while (0)
+
+#else /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */
+
+#define BLOCK_INPUT_ALLOC BLOCK_INPUT
+#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT
+
+#endif /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */
+
 /* Value of _bytes_used, when spare_memory was freed.  */
 
 static __malloc_size_t bytes_used_when_full;
@@ -517,6 +550,140 @@
 }
 
 
+#ifdef XMALLOC_OVERRUN_CHECK
+
+/* Check for overrun in malloc'ed buffers by wrapping a 16 byte header
+   and a 16 byte trailer around each block.
+
+   The header consists of 12 fixed bytes + a 4 byte integer contaning the
+   original block size, while the trailer consists of 16 fixed bytes.
+
+   The header is used to detect whether this block has been allocated
+   through these functions -- as it seems that some low-level libc
+   functions may bypass the malloc hooks.
+*/
+
+
+#define XMALLOC_OVERRUN_CHECK_SIZE 16
+
+static char xmalloc_overrun_check_header[XMALLOC_OVERRUN_CHECK_SIZE-4] =
+  { 0x9a, 0x9b, 0xae, 0xaf,
+    0xbf, 0xbe, 0xce, 0xcf,
+    0xea, 0xeb, 0xec, 0xed };
+
+static char xmalloc_overrun_check_trailer[XMALLOC_OVERRUN_CHECK_SIZE] =
+  { 0xaa, 0xab, 0xac, 0xad,
+    0xba, 0xbb, 0xbc, 0xbd,
+    0xca, 0xcb, 0xcc, 0xcd,
+    0xda, 0xdb, 0xdc, 0xdd };
+
+/* Macros to insert and extract the block size in the header.  */
+
+#define XMALLOC_PUT_SIZE(ptr, size)	\
+  (ptr[-1] = (size & 0xff),		\
+   ptr[-2] = ((size >> 8) & 0xff),	\
+   ptr[-3] = ((size >> 16) & 0xff),	\
+   ptr[-4] = ((size >> 24) & 0xff))
+
+#define XMALLOC_GET_SIZE(ptr)			\
+  (size_t)((unsigned)(ptr[-1])		|	\
+	   ((unsigned)(ptr[-2]) << 8)	|	\
+	   ((unsigned)(ptr[-3]) << 16)	|	\
+	   ((unsigned)(ptr[-4]) << 24))
+
+
+/* Like malloc, but wraps allocated block with header and trailer.  */
+
+POINTER_TYPE *
+overrun_check_malloc (size)
+     size_t size;
+{
+  register unsigned char *val;
+
+  val = (unsigned char *) malloc (size + XMALLOC_OVERRUN_CHECK_SIZE*2);
+  if (val)
+    {
+      bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4);
+      val += XMALLOC_OVERRUN_CHECK_SIZE;
+      XMALLOC_PUT_SIZE(val, size);
+      bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE);
+    }
+  return (POINTER_TYPE *)val;
+}
+
+
+/* Like realloc, but checks old block for overrun, and wraps new block
+   with header and trailer.  */
+
+POINTER_TYPE *
+overrun_check_realloc (block, size)
+     POINTER_TYPE *block;
+     size_t size;
+{
+  register unsigned char *val = (unsigned char *)block;
+
+  if (val
+      && bcmp (xmalloc_overrun_check_header,
+	       val - XMALLOC_OVERRUN_CHECK_SIZE,
+	       XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
+    {
+      size_t osize = XMALLOC_GET_SIZE (val);
+      if (bcmp (xmalloc_overrun_check_trailer,
+		val + osize,
+		XMALLOC_OVERRUN_CHECK_SIZE))
+	abort ();
+      bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
+      val -= XMALLOC_OVERRUN_CHECK_SIZE;
+      bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
+    }
+
+  val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + XMALLOC_OVERRUN_CHECK_SIZE*2);
+
+  if (val)
+    {
+      bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4);
+      val += XMALLOC_OVERRUN_CHECK_SIZE;
+      XMALLOC_PUT_SIZE(val, size);
+      bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE);
+    }
+  return (POINTER_TYPE *)val;
+}
+
+/* Like free, but checks block for overrun.  */
+
+void
+overrun_check_free (block)
+     POINTER_TYPE *block;
+{
+  unsigned char *val = (unsigned char *)block;
+
+  if (val
+      && bcmp (xmalloc_overrun_check_header,
+	       val - XMALLOC_OVERRUN_CHECK_SIZE,
+	       XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
+    {
+      size_t osize = XMALLOC_GET_SIZE (val);
+      if (bcmp (xmalloc_overrun_check_trailer,
+		val + osize,
+		XMALLOC_OVERRUN_CHECK_SIZE))
+	abort ();
+      bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
+      val -= XMALLOC_OVERRUN_CHECK_SIZE;
+      bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
+    }
+
+  free (val);
+}
+
+#undef malloc
+#undef realloc
+#undef free
+#define malloc overrun_check_malloc
+#define realloc overrun_check_realloc
+#define free overrun_check_free
+#endif
+
+
 /* Like malloc but check for no memory and block interrupt input..  */
 
 POINTER_TYPE *
@@ -603,7 +770,9 @@
    number of bytes to allocate, TYPE describes the intended use of the
    allcated memory block (for strings, for conses, ...).  */
 
+#ifndef USE_LSB_TAG
 static void *lisp_malloc_loser;
+#endif
 
 static POINTER_TYPE *
 lisp_malloc (nbytes, type)
@@ -933,7 +1102,7 @@
 emacs_blocked_free (ptr)
      void *ptr;
 {
-  BLOCK_INPUT;
+  BLOCK_INPUT_ALLOC;
 
 #ifdef GC_MALLOC_CHECK
   if (ptr)
@@ -971,7 +1140,7 @@
     spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
 
   __free_hook = emacs_blocked_free;
-  UNBLOCK_INPUT;
+  UNBLOCK_INPUT_ALLOC;
 }
 
 
@@ -997,7 +1166,7 @@
 {
   void *value;
 
-  BLOCK_INPUT;
+  BLOCK_INPUT_ALLOC;
   __malloc_hook = old_malloc_hook;
 #ifdef DOUG_LEA_MALLOC
     mallopt (M_TOP_PAD, malloc_hysteresis * 4096);
@@ -1029,7 +1198,7 @@
 #endif /* GC_MALLOC_CHECK */
 
   __malloc_hook = emacs_blocked_malloc;
-  UNBLOCK_INPUT;
+  UNBLOCK_INPUT_ALLOC;
 
   /* fprintf (stderr, "%p malloc\n", value); */
   return value;
@@ -1045,7 +1214,7 @@
 {
   void *value;
 
-  BLOCK_INPUT;
+  BLOCK_INPUT_ALLOC;
   __realloc_hook = old_realloc_hook;
 
 #ifdef GC_MALLOC_CHECK
@@ -1090,17 +1259,45 @@
 #endif /* GC_MALLOC_CHECK */
 
   __realloc_hook = emacs_blocked_realloc;
-  UNBLOCK_INPUT;
+  UNBLOCK_INPUT_ALLOC;
 
   return value;
 }
 
 
+#ifdef HAVE_GTK_AND_PTHREAD
+/* Called from Fdump_emacs so that when the dumped Emacs starts, it has a
+   normal malloc.  Some thread implementations need this as they call
+   malloc before main.  The pthread_self call in BLOCK_INPUT_ALLOC then
+   calls malloc because it is the first call, and we have an endless loop.  */
+
+void
+reset_malloc_hooks ()
+{
+  __free_hook = 0;
+  __malloc_hook = 0;
+  __realloc_hook = 0;
+}
+#endif /* HAVE_GTK_AND_PTHREAD */
+
+
 /* Called from main to set up malloc to use our hooks.  */
 
 void
 uninterrupt_malloc ()
 {
+#ifdef HAVE_GTK_AND_PTHREAD
+  pthread_mutexattr_t attr;
+
+  /*  GLIBC has a faster way to do this, but lets keep it portable.
+      This is according to the Single UNIX Specification.  */
+  pthread_mutexattr_init (&attr);
+  pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+  pthread_mutex_init (&alloc_mutex, &attr);
+
+  main_thread = pthread_self ();
+#endif /* HAVE_GTK_AND_PTHREAD */
+
   if (__free_hook != emacs_blocked_free)
     old_free_hook = __free_hook;
   __free_hook = emacs_blocked_free;
@@ -1429,6 +1626,21 @@
 
 #endif /* not GC_CHECK_STRING_BYTES */
 
+
+#ifdef GC_CHECK_STRING_OVERRUN
+
+/* We check for overrun in string data blocks by appending a small
+   "cookie" after each allocated string data block, and check for the
+   presense of this cookie during GC.  */
+
+#define GC_STRING_OVERRUN_COOKIE_SIZE	4
+static char string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
+  { 0xde, 0xad, 0xbe, 0xef };
+
+#else
+#define GC_STRING_OVERRUN_COOKIE_SIZE 0
+#endif
+
 /* Value is the size of an sdata structure large enough to hold NBYTES
    bytes of string data.  The value returned includes a terminating
    NUL byte, the size of the sdata structure, and padding.  */
@@ -1452,6 +1664,10 @@
 
 #endif /* not GC_CHECK_STRING_BYTES */
 
+/* Extra bytes to allocate for each string.  */
+
+#define GC_STRING_EXTRA (GC_STRING_OVERRUN_COOKIE_SIZE)
+
 /* Initialize string allocation.  Called from init_alloc_once.  */
 
 void
@@ -1516,7 +1732,7 @@
 	nbytes = SDATA_NBYTES (from);
 
       nbytes = SDATA_SIZE (nbytes);
-      from_end = (struct sdata *) ((char *) from + nbytes);
+      from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
     }
 }
 
@@ -1549,6 +1765,28 @@
 
 #endif /* GC_CHECK_STRING_BYTES */
 
+#ifdef GC_CHECK_STRING_FREE_LIST
+
+/* Walk through the string free list looking for bogus next pointers.
+   This may catch buffer overrun from a previous string.  */
+
+static void
+check_string_free_list ()
+{
+  struct Lisp_String *s;
+
+  /* Pop a Lisp_String off the free-list.  */
+  s = string_free_list;
+  while (s != NULL)
+    {
+      if ((unsigned)s < 1024)
+	abort();
+      s = NEXT_FREE_LISP_STRING (s);
+    }
+}
+#else
+#define check_string_free_list()
+#endif
 
 /* Return a new Lisp_String.  */
 
@@ -1580,6 +1818,8 @@
       total_free_strings += STRING_BLOCK_SIZE;
     }
 
+  check_string_free_list ();
+
   /* Pop a Lisp_String off the free-list.  */
   s = string_free_list;
   string_free_list = NEXT_FREE_LISP_STRING (s);
@@ -1649,7 +1889,7 @@
       mallopt (M_MMAP_MAX, 0);
 #endif
 
-      b = (struct sblock *) lisp_malloc (size, MEM_TYPE_NON_LISP);
+      b = (struct sblock *) lisp_malloc (size + GC_STRING_EXTRA, MEM_TYPE_NON_LISP);
 
 #ifdef DOUG_LEA_MALLOC
       /* Back to a reasonable maximum of mmap'ed areas. */
@@ -1664,7 +1904,7 @@
   else if (current_sblock == NULL
 	   || (((char *) current_sblock + SBLOCK_SIZE
 		- (char *) current_sblock->next_free)
-	       < needed))
+	       < (needed + GC_STRING_EXTRA)))
     {
       /* Not enough room in the current sblock.  */
       b = (struct sblock *) lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP);
@@ -1693,7 +1933,11 @@
   s->size = nchars;
   s->size_byte = nbytes;
   s->data[nbytes] = '\0';
-  b->next_free = (struct sdata *) ((char *) data + needed);
+#ifdef GC_CHECK_STRING_OVERRUN
+  bcopy (string_overrun_cookie, (char *) data + needed,
+	 GC_STRING_OVERRUN_COOKIE_SIZE);
+#endif
+  b->next_free = (struct sdata *) ((char *) data + needed + GC_STRING_EXTRA);
 
   /* If S had already data assigned, mark that as free by setting its
      string back-pointer to null, and recording the size of the data
@@ -1798,9 +2042,13 @@
 	}
     }
 
+  check_string_free_list ();
+
   string_blocks = live_blocks;
   free_large_strings ();
   compact_small_strings ();
+
+  check_string_free_list ();
 }
 
 
@@ -1872,28 +2120,38 @@
 	  else
 	    nbytes = SDATA_NBYTES (from);
 
+	  if (nbytes > LARGE_STRING_BYTES)
+	    abort ();
+
 	  nbytes = SDATA_SIZE (nbytes);
-	  from_end = (struct sdata *) ((char *) from + nbytes);
+	  from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
+
+#ifdef GC_CHECK_STRING_OVERRUN
+	  if (bcmp (string_overrun_cookie,
+		    ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE,
+		    GC_STRING_OVERRUN_COOKIE_SIZE))
+	    abort ();
+#endif
 
 	  /* FROM->string non-null means it's alive.  Copy its data.  */
 	  if (from->string)
 	    {
 	      /* If TB is full, proceed with the next sblock.  */
-	      to_end = (struct sdata *) ((char *) to + nbytes);
+	      to_end = (struct sdata *) ((char *) to + nbytes + GC_STRING_EXTRA);
 	      if (to_end > tb_end)
 		{
 		  tb->next_free = to;
 		  tb = tb->next;
 		  tb_end = (struct sdata *) ((char *) tb + SBLOCK_SIZE);
 		  to = &tb->first_data;
-		  to_end = (struct sdata *) ((char *) to + nbytes);
+		  to_end = (struct sdata *) ((char *) to + nbytes + GC_STRING_EXTRA);
 		}
 
 	      /* Copy, and update the string's `data' pointer.  */
 	      if (from != to)
 		{
 		  xassert (tb != b || to <= from);
-		  safe_bcopy ((char *) from, (char *) to, nbytes);
+		  safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA);
 		  to->string->data = SDATA_DATA (to);
 		}
 
@@ -2403,9 +2661,9 @@
 void
 check_cons_list ()
 {
+#ifdef GC_CHECK_CONS_LIST
   struct Lisp_Cons *tail = cons_free_list;
 
-#if 0
   while (tail)
     tail = *(struct Lisp_Cons **)&tail->cdr;
 #endif
@@ -4100,6 +4358,11 @@
 #endif
   for (i = 0; i < sizeof (Lisp_Object); i += GC_LISP_OBJECT_ALIGNMENT)
     mark_memory ((char *) stack_base + i, end);
+  /* Allow for marking a secondary stack, like the register stack on the
+     ia64.  */
+#ifdef GC_MARK_SECONDARY_STACK
+  GC_MARK_SECONDARY_STACK ();
+#endif
 
 #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS
   check_gcpros ();
--- a/src/buffer.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/buffer.c	Wed Dec 08 22:20:27 2004 +0000
@@ -5162,7 +5162,13 @@
     }
 #endif /* not VMS */
 
-  current_buffer->directory = build_string (buf);
+  current_buffer->directory = make_unibyte_string (buf, strlen (buf));
+  if (! NILP (buffer_defaults.enable_multibyte_characters))
+    /* At this momemnt, we still don't know how to decode the
+       direcotry name.  So, we keep the bytes in multibyte form so
+       that ENCODE_FILE correctly gets the original bytes.  */
+    current_buffer->directory
+      = string_to_multibyte (current_buffer->directory);
 
   /* Add /: to the front of the name
      if it would otherwise be treated as magic.  */
@@ -5684,10 +5690,13 @@
 arrow bitmaps.
 
 If value is a symbol `left' or `right', both angle and arrow bitmaps
-are displayed in the left or right fringe, resp.
-
-If value is an alist, each element (INDICATOR . POSITION) specifies
-the position of one of the indicators.  INDICATOR is one of `top',
+are displayed in the left or right fringe, resp.  Any other value
+that doesn't look like an alist means displat the angle bitmaps in
+the left fringe but no arrows.
+
+You can exercise more precise control by using an alist as the
+value.  Each alist element (INDICATOR . POSITION) specifies
+where to show one of the indicators.  INDICATOR is one of `top',
 `bottom', `up', `down', or t, which specifies the default position,
 and POSITION is one of `left', `right', or nil, meaning do not show
 this indicator.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/buildobj.lst	Wed Dec 08 22:20:27 2004 +0000
@@ -0,0 +1,1 @@
+dispnew.o frame.o scroll.o xdisp.o xmenu.o window.o charset.o coding.o category.o ccl.o cm.o term.o xfaces.o xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o  emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o editfns.o callint.o eval.o floatfns.o fns.o print.o lread.o abbrev.o syntax.o unexelf.o bytecode.o process.o callproc.o region-cache.o sound.o atimer.o doprnt.o strftime.o intervals.o textprop.o composite.o md5.o    terminfo.o lastfile.o   vm-limit.o  widget.o mktime.o 
--- a/src/coding.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/coding.c	Wed Dec 08 22:20:27 2004 +0000
@@ -6004,6 +6004,37 @@
   return 0;
 }
 
+/* Name (or base name) of work buffer for code conversion.  */
+static Lisp_Object Vcode_conversion_workbuf_name;
+
+/* Set the current buffer to the working buffer prepared for
+   code-conversion.  MULTIBYTE specifies the multibyteness of the
+   buffer.  */
+
+static struct buffer *
+set_conversion_work_buffer (multibyte)
+     int multibyte;
+{
+  Lisp_Object buffer;
+  struct buffer *buf;
+
+  buffer = Fget_buffer_create (Vcode_conversion_workbuf_name);
+  buf = XBUFFER (buffer);
+  delete_all_overlays (buf);
+  buf->directory = current_buffer->directory;
+  buf->read_only = Qnil;
+  buf->filename = Qnil;
+  buf->undo_list = Qt;
+  eassert (buf->overlays_before == NULL);
+  eassert (buf->overlays_after == NULL);
+  set_buffer_internal (buf);
+  if (BEG != BEGV || Z != ZV)
+    Fwiden ();
+  del_range_2 (BEG, BEG_BYTE, Z, Z_BYTE, 0);
+  buf->enable_multibyte_characters = multibyte ? Qt : Qnil;
+  return buf;
+}
+
 Lisp_Object
 run_pre_post_conversion_on_str (str, coding, encodep)
      Lisp_Object str;
@@ -6013,7 +6044,6 @@
   int count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2;
   int multibyte = STRING_MULTIBYTE (str);
-  Lisp_Object buffer;
   struct buffer *buf;
   Lisp_Object old_deactivate_mark;
 
@@ -6024,23 +6054,10 @@
   old_deactivate_mark = Vdeactivate_mark;
   GCPRO2 (str, old_deactivate_mark);
 
-  buffer = Fget_buffer_create (build_string (" *code-converting-work*"));
-  buf = XBUFFER (buffer);
-
-  delete_all_overlays (buf);
-  buf->directory = current_buffer->directory;
-  buf->read_only = Qnil;
-  buf->filename = Qnil;
-  buf->undo_list = Qt;
-  eassert (buf->overlays_before == NULL);
-  eassert (buf->overlays_after == NULL);
-
-  set_buffer_internal (buf);
   /* We must insert the contents of STR as is without
      unibyte<->multibyte conversion.  For that, we adjust the
      multibyteness of the working buffer to that of STR.  */
-  Ferase_buffer ();
-  buf->enable_multibyte_characters = multibyte ? Qt : Qnil;
+  set_conversion_work_buffer (multibyte);
 
   insert_from_string (str, 0, 0,
 		      SCHARS (str), SBYTES (str), 0);
@@ -6061,6 +6078,64 @@
   return unbind_to (count, str);
 }
 
+
+/* Run pre-write-conversion function of CODING on NCHARS/NBYTES
+   text in *STR.  *SIZE is the allocated bytes for STR.  As it
+   is intended that this function is called from encode_terminal_code,
+   the pre-write-conversion function is run by safe_call and thus
+   "Error during redisplay: ..." is logged when an error occurs.
+
+   Store the resulting text in *STR and set CODING->produced_char and
+   CODING->produced to the number of characters and bytes
+   respectively.  If the size of *STR is too small, enlarge it by
+   xrealloc and update *STR and *SIZE.  */
+
+void
+run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding)
+     unsigned char **str;
+     int *size, nchars, nbytes;
+     struct coding_system *coding;
+{
+  struct gcpro gcpro1, gcpro2;
+  struct buffer *cur = current_buffer;
+  Lisp_Object old_deactivate_mark, old_last_coding_system_used;
+  Lisp_Object args[3];
+
+  /* It is not crucial to specbind this.  */
+  old_deactivate_mark = Vdeactivate_mark;
+  old_last_coding_system_used = Vlast_coding_system_used;
+  GCPRO2 (old_deactivate_mark, old_last_coding_system_used);
+
+  /* We must insert the contents of STR as is without
+     unibyte<->multibyte conversion.  For that, we adjust the
+     multibyteness of the working buffer to that of STR.  */
+  set_conversion_work_buffer (coding->src_multibyte);
+  insert_1_both (*str, nchars, nbytes, 0, 0, 0);
+  UNGCPRO;
+  inhibit_pre_post_conversion = 1;
+  args[0] = coding->pre_write_conversion;
+  args[1] = make_number (BEG);
+  args[2] = make_number (Z);
+  safe_call (3, args);
+  inhibit_pre_post_conversion = 0;
+  Vdeactivate_mark = old_deactivate_mark;
+  Vlast_coding_system_used = old_last_coding_system_used;
+  coding->produced_char = Z - BEG;
+  coding->produced = Z_BYTE - BEG_BYTE;
+  if (coding->produced > *size)
+    {
+      *size = coding->produced;
+      *str = xrealloc (*str, *size);
+    }
+  if (BEG < GPT && GPT < Z)
+    move_gap (BEG);
+  bcopy (BEG_ADDR, *str, coding->produced);
+  coding->src_multibyte
+    = ! NILP (current_buffer->enable_multibyte_characters);
+  set_buffer_internal (cur);
+}
+
+
 Lisp_Object
 decode_coding_string (str, coding, nocopy)
      Lisp_Object str;
@@ -7539,6 +7614,9 @@
 void
 syms_of_coding ()
 {
+  staticpro (&Vcode_conversion_workbuf_name);
+  Vcode_conversion_workbuf_name = build_string (" *code-conversion-work*");
+
   Qtarget_idx = intern ("target-idx");
   staticpro (&Qtarget_idx);
 
--- a/src/coding.h	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/coding.h	Wed Dec 08 22:20:27 2004 +0000
@@ -1,4 +1,5 @@
 /* Header for coding system handler.
+   Copyright (C) 2004  Free Software Foundation, Inc.
    Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN.
    Licensed to the Free Software Foundation.
 
@@ -572,10 +573,10 @@
    for file names, if any.  */
 #define ENCODE_FILE(name)						   \
   (! NILP (Vfile_name_coding_system)					   \
-   && XFASTINT (Vfile_name_coding_system) != 0				   \
+   && !EQ (Vfile_name_coding_system, make_number (0))			   \
    ? code_convert_string_norecord (name, Vfile_name_coding_system, 1)	   \
    : (! NILP (Vdefault_file_name_coding_system)				   \
-      && XFASTINT (Vdefault_file_name_coding_system) != 0		   \
+      && !EQ (Vdefault_file_name_coding_system, make_number (0))	   \
       ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \
       : name))
 
@@ -583,10 +584,10 @@
    for file names, if any.  */
 #define DECODE_FILE(name)						   \
   (! NILP (Vfile_name_coding_system)					   \
-   && XFASTINT (Vfile_name_coding_system) != 0				   \
+   && !EQ (Vfile_name_coding_system, make_number (0))			   \
    ? code_convert_string_norecord (name, Vfile_name_coding_system, 0)	   \
    : (! NILP (Vdefault_file_name_coding_system)				   \
-      && XFASTINT (Vdefault_file_name_coding_system) != 0		   \
+      && !EQ (Vdefault_file_name_coding_system, make_number (0))	   \
       ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \
       : name))
 
@@ -595,7 +596,7 @@
    for w32 system functions, if any.  */
 #define ENCODE_SYSTEM(str)						   \
   (! NILP (Vlocale_coding_system)					   \
-   && XFASTINT (Vlocale_coding_system) != 0				   \
+   && !EQ (Vlocale_coding_system, make_number (0))			   \
    ? code_convert_string_norecord (str, Vlocale_coding_system, 1)	   \
    : str)
 
@@ -603,7 +604,7 @@
    for w32 system functions, if any.  */
 #define DECODE_SYSTEM(name)						   \
   (! NILP (Vlocale_coding_system)					   \
-   && XFASTINT (Vlocale_coding_system) != 0				   \
+   && !EQ (Vlocale_coding_system, make_number (0))			   \
    ? code_convert_string_norecord (str, Vlocale_coding_system, 0)	   \
    : str)
 
@@ -635,6 +636,10 @@
 extern Lisp_Object run_pre_post_conversion_on_str P_ ((Lisp_Object,
 						       struct coding_system *,
 						       int));
+extern void run_pre_write_conversin_on_c_str P_ ((unsigned char **, int *, 
+						  int, int,
+						  struct coding_system *));
+
 extern int decoding_buffer_size P_ ((struct coding_system *, int));
 extern int encoding_buffer_size P_ ((struct coding_system *, int));
 extern void detect_coding P_ ((struct coding_system *, const unsigned char *,
--- a/src/config.in	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/config.in	Wed Dec 08 22:20:27 2004 +0000
@@ -220,6 +220,9 @@
 /* Define to 1 if using GTK. */
 #undef HAVE_GTK
 
+/* Define to 1 if you have GTK and pthread (-lpthread). */
+#undef HAVE_GTK_AND_PTHREAD
+
 /* Define to 1 if GTK has both file selection and chooser dialog. */
 #undef HAVE_GTK_FILE_BOTH
 
@@ -441,6 +444,9 @@
 /* Define to 1 if you have the `pstat_getdynamic' function. */
 #undef HAVE_PSTAT_GETDYNAMIC
 
+/* Define to 1 if you have the <pthread.h> header file. */
+#undef HAVE_PTHREAD_H
+
 /* Define to 1 if you have the <pty.h> header file. */
 #undef HAVE_PTY_H
 
--- a/src/data.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/data.c	Wed Dec 08 22:20:27 2004 +0000
@@ -1509,6 +1509,9 @@
 a `let'-style binding made in this buffer is in effect,
 does not make the variable buffer-local.  Return VARIABLE.
 
+In most cases it is better to use `make-local-variable',
+which makes a variable local in just one buffer.
+
 The function `default-value' gets the default value and `set-default' sets it.  */)
      (variable)
      register Lisp_Object variable;
@@ -1552,7 +1555,7 @@
 Other buffers will continue to share a common default value.
 \(The buffer-local value of VARIABLE starts out as the same value
 VARIABLE previously had.  If VARIABLE was void, it remains void.\)
-See also `make-variable-buffer-local'.  Return VARIABLE.
+Return VARIABLE.
 
 If the variable is already arranged to become local when set,
 this function causes a local value to exist for this buffer,
@@ -1562,6 +1565,8 @@
   (set (make-local-variable 'VARIABLE) VALUE-EXP)
 works.
 
+See also `make-variable-buffer-local'.
+
 Do not use `make-local-variable' to make a hook variable buffer-local.
 Instead, use `add-hook' and specify t for the LOCAL argument.  */)
      (variable)
--- a/src/dispextern.h	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/dispextern.h	Wed Dec 08 22:20:27 2004 +0000
@@ -974,7 +974,7 @@
    or a control char, or an overlay string.  */
 
 #define MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P(ROW)	\
-     ((ROW)->end.dpvec_index >= 0			\
+     ((ROW)->end.dpvec_index > 0			\
       || (ROW)->end.overlay_string_index >= 0		\
       || (ROW)->ends_in_middle_of_char_p)
 
@@ -986,7 +986,7 @@
 /* Non-zero if ROW starts in the middle of a character.  See above.  */
 
 #define MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P(ROW)	\
-     ((ROW)->start.dpvec_index >= 0			\
+     ((ROW)->start.dpvec_index > 0			\
       || (ROW)->starts_in_middle_of_char_p		\
       || ((ROW)->start.overlay_string_index >= 0	\
 	  && (ROW)->start.string_pos.charpos > 0))
@@ -2730,7 +2730,7 @@
 void prepare_face_for_display P_ ((struct frame *, struct face *));
 int xstricmp P_ ((const unsigned char *, const unsigned char *));
 int lookup_face P_ ((struct frame *, Lisp_Object *, int, struct face *));
-int lookup_named_face P_ ((struct frame *, Lisp_Object, int));
+int lookup_named_face P_ ((struct frame *, Lisp_Object, int, int));
 int smaller_face P_ ((struct frame *, int, int));
 int face_with_height P_ ((struct frame *, int, int));
 int lookup_derived_face P_ ((struct frame *, Lisp_Object, int, int));
--- a/src/emacs.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/emacs.c	Wed Dec 08 22:20:27 2004 +0000
@@ -581,8 +581,12 @@
   for (i = argc - 1; i >= 0; i--)
     {
       if (i == 0 || i > skip_args)
+	/* For the moment, we keep arguments as is in unibyte strings.
+	   They are decoded in the function command-line after we know
+	   locale-coding-system.  */
 	Vcommand_line_args
-	  = Fcons (build_string (argv[i]), Vcommand_line_args);
+	  = Fcons (make_unibyte_string (argv[i], strlen (argv[i])),
+		   Vcommand_line_args);
     }
 
   unbind_to (count, Qnil);
@@ -745,7 +749,9 @@
 	}
 
       malloc_set_state (malloc_state_ptr);
+#ifndef XMALLOC_OVERRUN_CHECK
       free (malloc_state_ptr);
+#endif
     }
   else
     {
@@ -2231,6 +2237,12 @@
   memory_warnings (my_edata, malloc_warning);
 #endif /* not WINDOWSNT */
 #endif
+#ifdef HAVE_GTK_AND_PTHREAD
+  /* Pthread may call malloc before main, and then we will get an endless
+     loop, because pthread_self (see alloc.c) calls malloc the first time
+     it is called on some systems.  */
+  reset_malloc_hooks ();
+#endif
 #ifdef DOUG_LEA_MALLOC
   malloc_state_ptr = malloc_get_state ();
 #endif
--- a/src/eval.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/eval.c	Wed Dec 08 22:20:27 2004 +0000
@@ -573,7 +573,7 @@
 unconditionally for that argument.  (`p' is a good way to do this.)  */)
      ()
 {
-  return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil;
+  return interactive_p (1) ? Qt : Qnil;
 }
 
 
@@ -595,7 +595,8 @@
   /* If this isn't a byte-compiled function, there may be a frame at
      the top for Finteractive_p.  If so, skip it.  */
   fun = Findirect_function (*btp->function);
-  if (SUBRP (fun) && XSUBR (fun) == &Sinteractive_p)
+  if (SUBRP (fun) && (XSUBR (fun) == &Sinteractive_p
+		      || XSUBR (fun) == &Scalled_interactively_p))
     btp = btp->next;
 
   /* If we're running an Emacs 18-style byte-compiled function, there
@@ -786,6 +787,21 @@
     {
       if (NILP (tem))
 	Fset_default (sym, Feval (Fcar (tail)));
+      else
+	{ /* Check if there is really a global binding rather than just a let
+	     binding that shadows the global unboundness of the var.  */
+	  volatile struct specbinding *pdl = specpdl_ptr;
+	  while (--pdl >= specpdl)
+	    {
+	      if (EQ (pdl->symbol, sym) && !pdl->func
+		  && EQ (pdl->old_value, Qunbound))
+		{
+		  message_with_string ("Warning: defvar ignored because %s is let-bound",
+				       SYMBOL_NAME (sym), 1);
+		  break;
+		}
+	    }
+	}
       tail = Fcdr (tail);
       tem = Fcar (tail);
       if (!NILP (tem))
@@ -1158,9 +1174,10 @@
   /* Save the value in the tag.  */
   catch->val = value;
 
-  /* Restore the polling-suppression count.  */
+  /* Restore certain special C variables.  */
   set_poll_suppress_count (catch->poll_suppress_count);
   interrupt_input_blocked = catch->interrupt_input_blocked;
+  handling_signal = 0;
 
   do
     {
--- a/src/filelock.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/filelock.c	Wed Dec 08 22:20:27 2004 +0000
@@ -377,6 +377,9 @@
   char *host_name;
   char *lock_info_str;
 
+  /* Call this first because it can GC.  */
+  boot_time = get_boot_time ();
+
   if (STRINGP (Fuser_login_name (Qnil)))
     user_name = (char *)SDATA (Fuser_login_name (Qnil));
   else
@@ -386,9 +389,8 @@
   else
     host_name = "";
   lock_info_str = (char *)alloca (strlen (user_name) + strlen (host_name)
-				  + LOCK_PID_MAX + 5);
+				  + LOCK_PID_MAX + 30);
 
-  boot_time = get_boot_time ();
   if (boot_time)
     sprintf (lock_info_str, "%s@%s.%lu:%lu", user_name, host_name,
 	     (unsigned long) getpid (), (unsigned long) boot_time);
--- a/src/fns.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/fns.c	Wed Dec 08 22:20:27 2004 +0000
@@ -562,6 +562,7 @@
   struct textprop_rec  *textprops = NULL;
   /* Number of elments in textprops.  */
   int num_textprops = 0;
+  USE_SAFE_ALLOCA;
 
   tail = Qnil;
 
@@ -670,8 +671,7 @@
 
   prev = Qnil;
   if (STRINGP (val))
-    textprops
-      = (struct textprop_rec *) alloca (sizeof (struct textprop_rec) * nargs);
+    SAFE_ALLOCA (textprops, struct textprop_rec *, sizeof (struct textprop_rec) * nargs);
 
   for (argnum = 0; argnum < nargs; argnum++)
     {
@@ -827,6 +827,8 @@
 	  last_to_end = textprops[argnum].to + SCHARS (this);
 	}
     }
+
+  SAFE_FREE ();
   return val;
 }
 
--- a/src/fringe.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/fringe.c	Wed Dec 08 22:20:27 2004 +0000
@@ -810,12 +810,13 @@
 	    arrow_bot = XCDR (pos);
 	}
       else
-	ind = Qnil;
+	/* Anything else means boundary on left and no arrows.  */
+	boundary_top = boundary_bot = Qleft;
     }
 
   if (!NILP (ind))
     {
-      int do_eob = 1, do_bob = 1;
+      int done_top = 0, done_bot = 0;
 
       for (y = 0, rn = 0;
 	   y < yb && rn < nrows;
@@ -836,19 +837,25 @@
 	  row->indicate_bob_p = row->indicate_top_line_p = 0;
 	  row->indicate_eob_p = row->indicate_bottom_line_p = 0;
 
-	  if (!NILP (boundary_top)
-	      && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)))
-	    row->indicate_bob_p = do_bob, do_bob = 0;
-	  else if (!NILP (arrow_top)
-		   && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn)
-	    row->indicate_top_line_p = 1;
+	  if (!row->mode_line_p)
+	    {
+	      if (!done_top)
+		{
+		  if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)))
+		    row->indicate_bob_p = !NILP (boundary_top);
+		  else
+		    row->indicate_top_line_p = !NILP (arrow_top);
+		  done_top = 1;
+		}
 
-	  if (!NILP (boundary_bot)
-	      && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
-	    row->indicate_eob_p = do_eob, do_eob = 0;
-	  else if (!NILP (arrow_bot)
-		   && y + row->height >= yb)
-	    row->indicate_bottom_line_p = 1;
+	      if (!done_bot)
+		{
+		  if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
+		    row->indicate_eob_p = !NILP (boundary_bot), done_bot = 1;
+		  else if (y + row->height >= yb)
+		    row->indicate_bottom_line_p = !NILP (arrow_bot), done_bot = 1;
+		}
+	    }
 
 	  if (indicate_bob_p != row->indicate_bob_p
 	      || indicate_top_line_p != row->indicate_top_line_p
@@ -884,13 +891,13 @@
 	  left = row->left_user_fringe_bitmap;
 	  left_face_id = row->left_user_fringe_face_id;
 	}
+      else if (row->truncated_on_left_p)
+	left = LEFT_TRUNCATION_BITMAP;
       else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
 	left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft))
 		? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP);
       else if (row->indicate_eob_p && EQ (boundary_bot, Qleft))
 	left = BOTTOM_LEFT_ANGLE_BITMAP;
-      else if (row->truncated_on_left_p)
-	left = LEFT_TRUNCATION_BITMAP;
       else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
 	left = CONTINUATION_LINE_BITMAP;
       else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
@@ -910,13 +917,13 @@
 	  right = row->right_user_fringe_bitmap;
 	  right_face_id = row->right_user_fringe_face_id;
 	}
+      else if (row->truncated_on_right_p)
+	right = RIGHT_TRUNCATION_BITMAP;
       else if (row->indicate_bob_p && EQ (boundary_top, Qright))
 	right = ((row->indicate_eob_p && EQ (boundary_bot, Qright))
 		 ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP);
       else if (row->indicate_eob_p && EQ (boundary_bot, Qright))
 	right = BOTTOM_RIGHT_ANGLE_BITMAP;
-      else if (row->truncated_on_right_p)
-	right = RIGHT_TRUNCATION_BITMAP;
       else if (row->continued_p)
 	right = CONTINUED_LINE_BITMAP;
       else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
@@ -1352,7 +1359,7 @@
 
   if (!NILP (face))
     {
-      face_id = lookup_named_face (SELECTED_FRAME (), face, 'A');
+      face_id = lookup_named_face (SELECTED_FRAME (), face, 'A', 1);
       if (face_id < 0)
 	error ("No such face");
     }
--- a/src/gtkutil.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/gtkutil.c	Wed Dec 08 22:20:27 2004 +0000
@@ -23,10 +23,12 @@
 
 #ifdef USE_GTK
 #include <string.h>
+#include <signal.h>
 #include <stdio.h>
 #include "lisp.h"
 #include "xterm.h"
 #include "blockinput.h"
+#include "syssignal.h"
 #include "window.h"
 #include "atimer.h"
 #include "gtkutil.h"
@@ -1122,10 +1124,6 @@
 /***********************************************************************
                       File dialog functions
  ***********************************************************************/
-#ifdef HAVE_GTK_FILE_BOTH
-int use_old_gtk_file_dialog;
-#endif
-
 /* Function that is called when the file dialog pops down.
    W is the dialog widget, RESPONSE is the response code.
    USER_DATA is what we passed in to g_signal_connect (pointer to int).  */
@@ -1204,6 +1202,7 @@
                                           GTK_STOCK_OPEN : GTK_STOCK_OK),
                                          GTK_RESPONSE_OK,
                                          NULL);
+  gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE);
 
   if (default_filename)
     {
@@ -1211,16 +1210,20 @@
       struct gcpro gcpro1;
       GCPRO1 (file);
 
+      file = build_string (default_filename);
+
       /* File chooser does not understand ~/... in the file name.  It must be
          an absolute name starting with /.  */
       if (default_filename[0] != '/')
-        {
-          file = Fexpand_file_name (build_string (default_filename), Qnil);
-          default_filename = SDATA (file);
-        }
-
-      gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
-                                     default_filename);
+        file = Fexpand_file_name (file, Qnil);
+
+      default_filename = SDATA (file);
+      if (Ffile_directory_p (file))
+        gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin),
+                                             default_filename);
+      else
+        gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin),
+                                       default_filename);
 
       UNGCPRO;
     }
@@ -1310,8 +1313,17 @@
   int filesel_done = 0;
   xg_get_file_func func;
 
+#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
+  /* I really don't know why this is needed, but without this the GLIBC add on
+     library linuxthreads hangs when the Gnome file chooser backend creates
+     threads.  */
+  sigblock (sigmask (__SIGRTMIN));
+#endif /* HAVE_GTK_AND_PTHREAD */
+
 #ifdef HAVE_GTK_FILE_BOTH
-  if (use_old_gtk_file_dialog)
+  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,
                                     mustmatch_p, only_dir_p, &func);
   else
@@ -1355,6 +1367,10 @@
       gtk_main_iteration ();
     }
 
+#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN)
+  sigunblock (sigmask (__SIGRTMIN));
+#endif
+
   if (filesel_done == GTK_RESPONSE_OK)
     fn = (*func) (w);
 
--- a/src/image.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/image.c	Wed Dec 08 22:20:27 2004 +0000
@@ -2416,8 +2416,7 @@
 	  UNGCPRO;
 	  return 0;
 	}
-      path = CFStringCreateWithCString (NULL, SDATA (file),
-					kCFStringEncodingUTF8);
+      path = cfstring_create_with_utf8_cstring (SDATA (file));
       url = CFURLCreateWithFileSystemPath (NULL, path,
 					   kCFURLPOSIXPathStyle, 0);
       CFRelease (path);
--- a/src/indent.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/indent.c	Wed Dec 08 22:20:27 2004 +0000
@@ -222,7 +222,7 @@
      Lisp_Object window;
 {
   Lisp_Object prop, position, overlay_limit, proplimit;
-  Lisp_Object buffer;
+  Lisp_Object buffer, tmp;
   int end, inv_p;
 
   XSETFASTINT (position, pos);
@@ -253,8 +253,9 @@
       /* No matter what. don't go past next overlay change.  */
       if (XFASTINT (overlay_limit) < XFASTINT (proplimit))
 	proplimit = overlay_limit;
-      end = XFASTINT (Fnext_single_property_change (position, Qinvisible,
-						    buffer, proplimit));
+      tmp = Fnext_single_property_change (position, Qinvisible,
+					  buffer, proplimit);
+      end = XFASTINT (tmp);
 #if 0
       /* Don't put the boundary in the middle of multibyte form if
          there is no actual property change.  */
--- a/src/insdel.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/insdel.c	Wed Dec 08 22:20:27 2004 +0000
@@ -1057,6 +1057,10 @@
      int inherit;
 {
   int opoint = PT;
+
+  if (SCHARS (string) == 0)
+    return;
+
   insert_from_string_1 (string, pos, pos_byte, length, length_byte,
 			inherit, 0);
   signal_after_change (opoint, 0, PT - opoint);
@@ -1074,6 +1078,10 @@
      int inherit;
 {
   int opoint = PT;
+
+  if (SCHARS (string) == 0)
+    return;
+
   insert_from_string_1 (string, pos, pos_byte, length, length_byte,
 			inherit, 1);
   signal_after_change (opoint, 0, PT - opoint);
--- a/src/keyboard.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/keyboard.c	Wed Dec 08 22:20:27 2004 +0000
@@ -45,6 +45,9 @@
 #include <setjmp.h>
 #include <errno.h>
 
+#ifdef HAVE_GTK_AND_PTHREAD
+#include <pthread.h>
+#endif
 #ifdef MSDOS
 #include "msdos.h"
 #include <time.h>
@@ -595,7 +598,7 @@
 
 /* We are unable to use interrupts if FIONREAD is not available,
    so flush SIGIO so we won't try.  */
-#if !defined (FIONREAD) || defined(HAVE_CARBON)
+#if !defined (FIONREAD)
 #ifdef SIGIO
 #undef SIGIO
 #endif
@@ -1603,7 +1606,10 @@
       if (NILP (Vthis_command))
 	{
 	  /* nil means key is undefined.  */
+	  Lisp_Object keys = Fvector (i, keybuf);
+	  keys = Fkey_description (keys, Qnil);
 	  bitch_at_user ();
+	  message_with_string ("%s is undefined", keys, 0);
 	  current_kboard->defining_kbd_macro = Qnil;
 	  update_mode_lines = 1;
 	  current_kboard->Vprefix_arg = Qnil;
@@ -6843,6 +6849,25 @@
 #ifdef BSD4_1
   extern int select_alarmed;
 #endif
+#ifdef HAVE_GTK_AND_PTHREAD
+  extern pthread_t main_thread;
+  if (pthread_self () != main_thread)
+    {
+      /* POSIX says any thread can receive the signal.  On GNU/Linux that is
+         not true, but for other systems (FreeBSD at least) it is.  So direct
+         the signal to the correct thread and block it from this thread.  */
+#ifdef SIGIO
+      sigset_t new_mask;
+
+      sigemptyset (&new_mask);
+      sigaddset (&new_mask, SIGIO);
+      pthread_sigmask (SIG_BLOCK, &new_mask, 0);
+      pthread_kill (main_thread, SIGIO);
+#endif
+      return;
+    }
+#endif
+
   interrupt_input_pending = 0;
 
   while (1)
@@ -6870,7 +6895,22 @@
 {
   /* Must preserve main program's value of errno.  */
   int old_errno = errno;
-
+#ifdef HAVE_GTK_AND_PTHREAD
+  extern pthread_t main_thread;
+  if (pthread_self () != main_thread)
+    {
+      /* POSIX says any thread can receive the signal.  On GNU/Linux that is
+         not true, but for other systems (FreeBSD at least) it is.  So direct
+         the signal to the correct thread and block it from this thread.  */
+      sigset_t new_mask;
+
+      sigemptyset (&new_mask);
+      sigaddset (&new_mask, SIGIO);
+      pthread_sigmask (SIG_BLOCK, &new_mask, 0);
+      pthread_kill (main_thread, SIGIO);
+      return;
+    }
+#endif /* HAVE_GTK_AND_PTHREAD */
 #if defined (USG) && !defined (POSIX_SIGNALS)
   /* USG systems forget handlers when they are used;
      must reestablish each time */
--- a/src/keymap.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/keymap.c	Wed Dec 08 22:20:27 2004 +0000
@@ -1241,7 +1241,7 @@
 	c = Fevent_convert_list (c);
 
       /* Turn the 8th bit of string chars into a meta modifier.  */
-      if (XINT (c) & 0x80 && STRINGP (key))
+      if (INTEGERP (c) && XINT (c) & 0x80 && STRINGP (key))
 	XSETINT (c, (XINT (c) | meta_modifier) & ~0x80);
 
       /* Allow string since binding for `menu-bar-select-buffer'
--- a/src/lisp.h	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/lisp.h	Wed Dec 08 22:20:27 2004 +0000
@@ -35,6 +35,22 @@
    be compared to the sizes recorded in Lisp strings.  */
 
 #define GC_CHECK_STRING_BYTES 1
+
+/* Define this to check for short string overrun.  */
+
+#define GC_CHECK_STRING_OVERRUN 1
+
+/* Define this to check the string free list.  */
+
+#define GC_CHECK_STRING_FREE_LIST 1
+
+/* Define this to check for malloc buffer overrun.  */
+
+#define XMALLOC_OVERRUN_CHECK 1
+
+/* Define this to check for errors in cons list.  */
+/* #define GC_CHECK_CONS_LIST 1 */
+
 #endif /* 0 */
 
 
@@ -304,11 +320,13 @@
 /* First, try and define DECL_ALIGN(type,var) which declares a static
    variable VAR of type TYPE with the added requirement that it be
    TYPEBITS-aligned. */
-#ifndef DECL_ALIGN
+#ifndef NO_DECL_ALIGN
+# ifndef DECL_ALIGN
 /* What compiler directive should we use for non-gcc compilers?  -stef  */
-# if defined (__GNUC__)
-#  define DECL_ALIGN(type, var) \
-    type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
+#  if defined (__GNUC__)
+#   define DECL_ALIGN(type, var) \
+     type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
+#  endif
 # endif
 #endif
 
@@ -323,7 +341,7 @@
 # endif
 #endif
 
-/* Just remove the alignment annotation if we don't use it.  */
+/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op.  */
 #ifndef DECL_ALIGN
 # ifdef USE_LSB_TAG
 #  error "USE_LSB_TAG used without defining DECL_ALIGN"
@@ -2301,6 +2319,7 @@
 extern int string_char_to_byte P_ ((Lisp_Object, int));
 extern int string_byte_to_char P_ ((Lisp_Object, int));
 extern Lisp_Object string_make_multibyte P_ ((Lisp_Object));
+extern Lisp_Object string_to_multibyte P_ ((Lisp_Object));
 extern Lisp_Object string_make_unibyte P_ ((Lisp_Object));
 EXFUN (Fcopy_alist, 1);
 EXFUN (Fplist_get, 2);
@@ -2438,6 +2457,7 @@
 /* Defined in alloc.c */
 extern void check_pure_size P_ ((void));
 extern void allocate_string_data P_ ((struct Lisp_String *, int, int));
+extern void reset_malloc_hooks P_ ((void));
 extern void uninterrupt_malloc P_ ((void));
 extern void malloc_warning P_ ((char *));
 extern void memory_full P_ ((void));
--- a/src/lread.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/lread.c	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,6 @@
 /* Lisp parsing and input streams.
-   Copyright (C) 1985,86,87,88,89,93,94,95,97,98,99,2000,01,03,2004
-      Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997, 1998,
+     1999, 2000, 2001, 2003, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -323,6 +323,7 @@
       /* Interrupted reads have been observed while reading over the network */
       while (c == EOF && ferror (instream) && errno == EINTR)
 	{
+	  QUIT;
 	  clearerr (instream);
 	  c = getc (instream);
 	}
@@ -3277,7 +3278,7 @@
   hash %= obsize;
   bucket = XVECTOR (obarray)->contents[hash];
   oblookup_last_bucket_number = hash;
-  if (XFASTINT (bucket) == 0)
+  if (EQ (bucket, make_number (0)))
     ;
   else if (!SYMBOLP (bucket))
     error ("Bad data in guts of obarray"); /* Like CADR error message */
--- a/src/mac.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/mac.c	Wed Dec 08 22:20:27 2004 +0000
@@ -262,6 +262,22 @@
   return 1;
 }
 
+#if TARGET_API_MAC_CARBON
+CFStringRef
+cfstring_create_with_utf8_cstring (c_str)
+     const char *c_str;
+{
+  CFStringRef str;
+
+  str = CFStringCreateWithCString (NULL, c_str, kCFStringEncodingUTF8);
+  if (str == NULL)
+    /* Failed to interpret as UTF 8.  Fall back on Mac Roman.  */
+    str = CFStringCreateWithCString (NULL, c_str, kCFStringEncodingMacRoman);
+
+  return str;
+}
+#endif
+
 #ifndef MAC_OSX
 
 /* The following functions with "sys_" prefix are stubs to Unix
--- a/src/macfns.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/macfns.c	Wed Dec 08 22:20:27 2004 +0000
@@ -1932,8 +1932,7 @@
       {
 #if TARGET_API_MAC_CARBON
 	CFStringRef windowTitle =
-	  CFStringCreateWithCString (NULL, SDATA (name),
-				     kCFStringEncodingUTF8);
+	  cfstring_create_with_utf8_cstring (SDATA (name));
 
 	SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
 	CFRelease (windowTitle);
@@ -2015,8 +2014,7 @@
       {
 #if TARGET_API_MAC_CARBON
 	CFStringRef windowTitle =
-	  CFStringCreateWithCString (NULL, SDATA (name),
-				     kCFStringEncodingUTF8);
+	  cfstring_create_with_utf8_cstring (SDATA (name));
 
 	SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
 	CFRelease (windowTitle);
@@ -4246,8 +4244,7 @@
     NavDialogRef dialogRef;
     NavTypeListHandle fileTypes = NULL;
     NavUserAction userAction;
-    CFStringRef message=NULL, client=NULL, saveName = NULL, ok = NULL;
-    CFStringRef title = NULL;
+    CFStringRef message=NULL, saveName = NULL;
     
     BLOCK_INPUT;
     /* No need for a callback function because we are modal */
@@ -4259,15 +4256,11 @@
     options.optionFlags |= kNavSelectAllReadableItem;
     if (!NILP(prompt))
       {
-	message = CFStringCreateWithCStringNoCopy(NULL, SDATA(prompt),
-						  kCFStringEncodingUTF8, 
-						  kCFAllocatorNull);
+	message = cfstring_create_with_utf8_cstring (SDATA (prompt));
 	options.message = message;
       }
     /* Don't set the application, let it use default.
-    client = CFStringCreateWithCStringNoCopy(NULL, "Emacs", 
-					     kCFStringEncodingMacRoman, NULL);
-    options.clientName = client;
+    options.clientName = CFSTR ("Emacs");
     */
 
     if (!NILP (only_dir_p))
@@ -4276,17 +4269,14 @@
     else if (NILP (mustmatch)) 
       { 
 	/* This is a save dialog */
-	ok = CFStringCreateWithCString (NULL, "Ok", kCFStringEncodingUTF8);
-	title = CFStringCreateWithCString (NULL, "Enter name",
-	                                   kCFStringEncodingUTF8);
 	options.optionFlags |= kNavDontConfirmReplacement;
-	options.actionButtonLabel = ok;
-	options.windowTitle = title;
+	options.actionButtonLabel = CFSTR ("Ok");
+	options.windowTitle = CFSTR ("Enter name");
 
 	if (!NILP(default_filename))
 	  {
-	    saveName = CFStringCreateWithCString(NULL, SDATA(default_filename),
-						 kCFStringEncodingUTF8);
+	    saveName =
+	      cfstring_create_with_utf8_cstring (SDATA (default_filename));
 	    options.saveFileName = saveName;
 	    options.optionFlags |= kNavSelectDefaultLocation;
 	  }
@@ -4320,10 +4310,7 @@
     }
 
     if (saveName) CFRelease(saveName);
-    if (client) CFRelease(client);
     if (message) CFRelease(message);
-    if (ok) CFRelease(ok);
-    if (title) CFRelease(title);
 
     if (status == noErr) {
       userAction = NavDialogGetUserAction(dialogRef);
@@ -4415,8 +4402,8 @@
   0, /* MAC_TODO: x_set_scroll_bar_background, */
   x_set_screen_gamma,
   x_set_line_spacing,
-  0, /* MAC_TODO: x_set_fringe_width, */
-  0, /* MAC_TODO: x_set_fringe_width, */
+  x_set_fringe_width,
+  x_set_fringe_width,
   0, /* x_set_wait_for_wm, */
   0, /* MAC_TODO: x_set_fullscreen, */
 };
--- a/src/macmenu.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/macmenu.c	Wed Dec 08 22:20:27 2004 +0000
@@ -2264,8 +2264,7 @@
       item_name[255] = 0;
 #if TARGET_API_MAC_CARBON
       {
-	CFStringRef string =
-	  CFStringCreateWithCString (NULL, item_name, kCFStringEncodingUTF8);
+	CFStringRef string = cfstring_create_with_utf8_cstring (item_name);
 
 	SetMenuItemTextWithCFString (menu, pos, string);
 	CFRelease (string);
--- a/src/macterm.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/macterm.c	Wed Dec 08 22:20:27 2004 +0000
@@ -567,7 +567,7 @@
      Display *display;		/* not used */
      WindowPtr w;
      unsigned int width, height;
-     unsigned int depth;	/* not used */
+     unsigned int depth;
 {
   Pixmap pixmap;
   Rect r;
@@ -643,6 +643,7 @@
 }
 
 
+#if 0 /* TODO: figure out if we need to do this on Mac.  */
 static void
 mac_fill_rectangle_to_pixmap (display, p, gc, x, y, width, height)
      Display *display;
@@ -666,6 +667,7 @@
 
   SetGWorld (old_port, old_gdh);
 }
+#endif
 
 
 /* Mac replacement for XDrawRectangle: dest is a window.  */
@@ -689,6 +691,7 @@
 }
 
 
+#if 0 /* TODO: figure out if we need to do this on Mac.  */
 /* Mac replacement for XDrawRectangle: dest is a Pixmap.  */
 
 static void
@@ -714,6 +717,7 @@
 
   SetGWorld (old_port, old_gdh);
 }
+#endif
 
 
 static void
@@ -908,24 +912,13 @@
      int dest_x, dest_y;
 {
 #if TARGET_API_MAC_CARBON
-  Rect gw_r, src_r, dest_r;
+  Rect src_r;
+  RgnHandle dummy = NewRgn ();	/* For avoiding update events.  */
 
   SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
-  SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
-
-  SetPortWindowPort (w);
-
-  ForeColor (blackColor);
-  BackColor (whiteColor);
-
-  LockPortBits (GetWindowPort (w));
-  {
-    const BitMap *bitmap = GetPortBitMapForCopyBits (GetWindowPort (w));
-    CopyBits (bitmap, bitmap, &src_r, &dest_r, srcCopy, 0);
-  }
-  UnlockPortBits (GetWindowPort (w));
-
-  mac_set_colors (gc);
+  ScrollWindowRect (w, &src_r, dest_x - src_x, dest_y - src_y,
+		    kScrollWindowNoOptions, dummy);
+  DisposeRgn (dummy);
 #else /* not TARGET_API_MAC_CARBON */
   Rect src_r, dest_r;
 
@@ -959,6 +952,7 @@
 }
 
 
+#if 0 /* TODO: figure out if we need to do this on Mac.  */
 /* Mac replacement for XCopyArea: dest must be Pixmap.  */
 
 static void
@@ -1037,6 +1031,7 @@
 
   SetGWorld (old_port, old_gdh);
 }
+#endif
 
 
 /* Mac replacement for XChangeGC.  */
@@ -1131,6 +1126,23 @@
 }
 
 
+/* Flush display of frame F, or of all frames if F is null.  */
+
+static void
+x_flush (f)
+     struct frame *f;
+{
+#if TARGET_API_MAC_CARBON
+  BLOCK_INPUT;
+  if (f)
+    QDFlushPortBuffer (GetWindowPort (FRAME_MAC_WINDOW (f)), NULL);
+  else
+    QDFlushPortBuffer (GetQDGlobalsThePort (), NULL);
+  UNBLOCK_INPUT;
+#endif
+}
+
+
 /* Remove calls to XFlush by defining XFlush to an empty replacement.
    Calls to XFlush should be unnecessary because the X output buffer
    is flushed automatically as needed by calls to XPending,
@@ -1138,32 +1150,7 @@
    XTread_socket calls XPending.  Removing XFlush improves
    performance.  */
 
-#if TARGET_API_MAC_CARBON
-#define XFlush(DISPLAY) QDFlushPortBuffer (GetQDGlobalsThePort (), NULL)
-#else
 #define XFlush(DISPLAY)	(void) 0
-#endif
-
-/* Flush display of frame F, or of all frames if F is null.  */
-
-void
-x_flush (f)
-     struct frame *f;
-{
-#if TARGET_API_MAC_CARBON
-  BLOCK_INPUT;
-  if (f == NULL)
-    {
-      Lisp_Object rest, frame;
-      FOR_EACH_FRAME (rest, frame)
-	x_flush (XFRAME (frame));
-    }
-  else if (FRAME_MAC_P (f))
-    XFlush (FRAME_MAC_DISPLAY (f));
-  UNBLOCK_INPUT;
-#endif /* TARGET_API_MAC_CARBON */
-}
-
 
 
 /* Return the struct mac_display_info corresponding to DPY.  There's
@@ -1957,6 +1944,14 @@
 }
 
 
+/* We prefer not to use XDrawImageString (srcCopy text transfer mode)
+   on Mac OS X because:
+   - Screen is double-buffered.  (In srcCopy mode, a text is drawn
+     into an offscreen graphics world first.  So performance gain
+     cannot be expected.)
+   - It lowers rendering quality.
+   - Some fonts leave garbage on cursor movement.  */
+
 /* Draw the background of glyph_string S.  If S->background_filled_p
    is non-zero don't draw it.  FORCE_P non-zero means draw the
    background even if it wouldn't be drawn normally.  This is used
@@ -1988,10 +1983,12 @@
 	}
       else
 #endif
+#if 0 /* defined(MAC_OS8)*/
         if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
 	       || s->font_not_found_p
 	       || s->extends_to_end_of_line_p
 	       || force_p)
+#endif
 	{
 	  x_clear_glyph_string_rect (s, s->x, s->y + box_line_width,
 				     s->background_width,
@@ -2044,6 +2041,7 @@
 	for (i = 0; i < s->nchars; ++i)
 	  char1b[i] = s->char2b[i].byte2;
 
+#if 0 /* defined(MAC_OS8) */
       /* Draw text with XDrawString if background has already been
 	 filled.  Otherwise, use XDrawImageString.  (Note that
 	 XDrawImageString is usually faster than XDrawString.)  Always
@@ -2051,6 +2049,7 @@
 	 no chance that characters under a box cursor are invisible.  */
       if (s->for_overlaps_p
 	  || (s->background_filled_p && s->hl != DRAW_CURSOR))
+#endif
 	{
 	  /* Draw characters with 16-bit or 8-bit functions.  */
 	  if (s->two_byte_p)
@@ -2060,6 +2059,7 @@
 	    XDrawString (s->display, s->window, s->gc, x,
 			 s->ybase - boff, char1b, s->nchars);
 	}
+#if 0 /* defined(MAC_OS8)*/
       else
 	{
 	  if (s->two_byte_p)
@@ -2069,6 +2069,7 @@
 	    XDrawImageString (s->display, s->window, s->gc, x,
 			      s->ybase - boff, char1b, s->nchars);
 	}
+#endif
     }
 }
 
@@ -2635,38 +2636,17 @@
 
   if (s->img->pixmap)
     {
+      x_set_glyph_string_clipping (s);
+
       if (s->img->mask)
-	{
-	  Rect nr;
-	  XRectangle clip_rect, image_rect, r;
-
-	  get_glyph_string_clip_rect (s, &nr);
-	  CONVERT_TO_XRECT (clip_rect, nr);
-	  image_rect.x = x;
-	  image_rect.y = y;
-	  image_rect.width = s->slice.width;
-	  image_rect.height = s->slice.height;
-	  if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
-	    mac_copy_area_with_mask (s->display, s->img->pixmap, s->img->mask,
-				     s->window, s->gc,
-				     s->slice.x + r.x - x, s->slice.y + r.y - y,
-				     r.width, r.height, r.x, r.y);
-	}
+	mac_copy_area_with_mask (s->display, s->img->pixmap, s->img->mask,
+				 s->window, s->gc, s->slice.x, s->slice.y,
+				 s->slice.width, s->slice.height, x, y);
       else
 	{
-	  Rect nr;
-	  XRectangle clip_rect, image_rect, r;
-
-	  get_glyph_string_clip_rect (s, &nr);
-	  CONVERT_TO_XRECT (clip_rect, nr);
-	  image_rect.x = x;
-	  image_rect.y = y;
-	  image_rect.width = s->slice.width;
-	  image_rect.height = s->slice.height;
-	  if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
-	    mac_copy_area (s->display, s->img->pixmap, s->window, s->gc,
-			   s->slice.x + r.x - x, s->slice.y + r.y - y,
-			   r.width, r.height, r.x, r.y);
+	  mac_copy_area (s->display, s->img->pixmap,
+			 s->window, s->gc, s->slice.x, s->slice.y,
+			 s->slice.width, s->slice.height, x, y);
 
 	  /* When the image has a mask, we can expect that at
 	     least part of a mouse highlight or a block cursor will
@@ -2745,6 +2725,7 @@
 }
 
 
+#if 0 /* TODO: figure out if we need to do this on Mac.  */
 /* Draw the foreground of image glyph string S to PIXMAP.  */
 
 static void
@@ -2805,6 +2786,7 @@
     mac_draw_rectangle_to_pixmap (s->display, pixmap, s->gc, x, y,
 				  s->slice.width - 1, s->slice.height - 1);
 }
+#endif
 
 
 /* Draw part of the background of glyph string S.  X, Y, W, and H
@@ -2876,6 +2858,7 @@
       if (s->slice.y == 0)
 	y += box_line_vwidth;
 
+#if 0 /* TODO: figure out if we need to do this on Mac.  */
       if (s->img->mask)
 	{
 	  /* Create a pixmap as large as the glyph string.  Fill it
@@ -2912,12 +2895,14 @@
 	    }
 	}
       else
+#endif
 	x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height);
 
       s->background_filled_p = 1;
     }
 
   /* Draw the foreground.  */
+#if 0 /* TODO: figure out if we need to do this on Mac.  */
   if (pixmap != 0)
     {
       x_draw_image_foreground_1 (s, pixmap);
@@ -2928,6 +2913,7 @@
       XFreePixmap (s->display, pixmap);
     }
   else
+#endif
     x_draw_image_foreground (s);
 
   /* If we must draw a relief around the image, do it.  */
@@ -5899,7 +5885,14 @@
 static Lisp_Object Qbig5, Qcn_gb, Qsjis, Qeuc_kr;
 
 static void
-decode_mac_font_name (char *name, int size, short scriptcode)
+decode_mac_font_name (name, size, scriptcode)
+     char *name;
+     int size;
+#if TARGET_API_MAC_CARBON
+     int scriptcode;
+#else
+     short scriptcode;
+#endif
 {
   Lisp_Object coding_system;
   struct coding_system coding;
@@ -5937,7 +5930,15 @@
 
 
 static char *
-mac_to_x_fontname (char *name, int size, Style style, short scriptcode)
+mac_to_x_fontname (name, size, style, scriptcode, encoding_base)
+     char *name;
+     int size;
+     Style style;
+#if TARGET_API_MAC_CARBON
+     int scriptcode;
+#else
+     short scriptcode;
+#endif
 {
   char foundry[32], family[32], cs[32];
   char xf[256], *result, *p;
@@ -5949,13 +5950,13 @@
 
       switch (scriptcode)
       {
-      case smTradChinese:
+      case smTradChinese:	/* == kTextEncodingMacChineseTrad */
         strcpy(cs, "big5-0");
         break;
-      case smSimpChinese:
+      case smSimpChinese:	/* == kTextEncodingMacChineseSimp */
         strcpy(cs, "gb2312.1980-0");
         break;
-      case smJapanese:
+      case smJapanese:		/* == kTextEncodingMacJapanese */
         strcpy(cs, "jisx0208.1983-sjis");
         break;
       case -smJapanese:
@@ -5967,12 +5968,24 @@
 	   font is being built.  */
 	strcpy(cs, "jisx0201.1976-0");
 	break;
-      case smKorean:
+      case smKorean:		/* == kTextEncodingMacKorean */
         strcpy(cs, "ksc5601.1989-0");
         break;
+#if TARGET_API_MAC_CARBON
+      case kTextEncodingMacCyrillic:
+	strcpy(cs, "mac-cyrillic");
+	break;
+      case kTextEncodingMacCentralEurRoman:
+	strcpy(cs, "mac-centraleuropean");
+	break;
+      case kTextEncodingMacSymbol:
+      case kTextEncodingMacDingbats:
+	strcpy(cs, "adobe-fontspecific");
+	break;
+#endif
       default:
-        strcpy(cs, "mac-roman");
-        break;
+	strcpy(cs, "mac-roman");
+	break;
       }
     }
 
@@ -6019,7 +6032,10 @@
     coding_system = Qsjis;
   else if (strcmp (cs, "ksc5601.1989-0") == 0)
     coding_system = Qeuc_kr;
-  else if (strcmp (cs, "mac-roman") == 0)
+  else if (strcmp (cs, "mac-roman") == 0
+	   || strcmp (cs, "mac-cyrillic") == 0
+	   || strcmp (cs, "mac-centraleuropean") == 0
+	   || strcmp (cs, "adobe-fontspecific") == 0)
     strcpy (mf, family);
   else
     sprintf (mf, "%s-%s-%s", foundry, family, cs);
@@ -6091,7 +6107,8 @@
 	  FMFont font;
 	  FMFontStyle style;
 	  FMFontSize size;
-	  SInt16 sc;
+	  TextEncoding encoding;
+	  TextEncodingBase sc;
 
 	  if (FMGetFontFamilyName (ff, name) != noErr)
 	    break;
@@ -6099,9 +6116,11 @@
 	  if (*name == '.')
 	    continue;
 
-	  sc = FontToScript (ff);
+	  if (FMGetFontFamilyTextEncoding (ff, &encoding) != noErr)
+	    break;
+	  sc = GetTextEncodingBase (encoding);
 	  decode_mac_font_name (name, sizeof (name), sc);
-
+				       
 	  /* Point the instance iterator at the current font family.  */
 	  if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr)
 	    break;
@@ -8619,17 +8638,30 @@
 		{
 		  unsigned char ch = inev.code;
 		  ByteCount actual_input_length, actual_output_length;
-		  unsigned char outch;
-
-		  convert_status = TECConvertText (converter, &ch, 1,
-						   &actual_input_length,
-						   &outch, 1,
-						   &actual_output_length);
-		  if (convert_status == noErr
-		      && actual_input_length == 1
-		      && actual_output_length == 1)
-		    inev.code = outch;
-		}
+		  unsigned char outbuf[32];
+		  
+                  convert_status = TECConvertText (converter, &ch, 1,
+                                                   &actual_input_length,
+						   outbuf, 1,
+                                                   &actual_output_length);
+                  if (convert_status == noErr
+                      && actual_input_length == 1
+                      && actual_output_length == 1)
+		    inev.code = *outbuf;
+		  
+		  /* Reset internal states of the converter object.
+                   If it fails, create another one. */
+		  convert_status = TECFlushText (converter, outbuf,
+						 sizeof (outbuf),
+                                               &actual_output_length);
+		  if (convert_status != noErr)
+		    {
+		      TECDisposeConverter (converter);
+		      TECCreateConverter (&converter,
+					  kTextEncodingMacRoman,
+					  mac_keyboard_text_encoding);
+		    }
+                }
 	    }
 
 #if USE_CARBON_EVENTS
@@ -9148,7 +9180,7 @@
   x_update_window_end,
   x_cursor_to,
   x_flush,
-  x_flush,
+  0, /* flush_display_optional */
   x_clear_window_mouse_face,
   x_get_glyph_overhangs,
   x_fix_overlapping_area,
--- a/src/macterm.h	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/macterm.h	Wed Dec 08 22:20:27 2004 +0000
@@ -597,5 +597,9 @@
 #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
 #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0
 
+#if TARGET_API_MAC_CARBON
+extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *));
+#endif
+
 /* arch-tag: 6b4ca125-5bef-476d-8ee8-31ed808b7e79
    (do not change this comment) */
--- a/src/minibuf.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/minibuf.c	Wed Dec 08 22:20:27 2004 +0000
@@ -2110,8 +2110,6 @@
       goto exit;
     }
 
-    goto exit;
-
   /* Call do_completion, but ignore errors.  */
   SET_PT (ZV);
   val = internal_condition_case (complete_and_exit_1, Qerror,
--- a/src/regex.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/regex.c	Wed Dec 08 22:20:27 2004 +0000
@@ -1950,28 +1950,27 @@
 
 /* Get the next unsigned number in the uncompiled pattern.  */
 #define GET_UNSIGNED_NUMBER(num)					\
- do { if (p != pend)							\
-     {									\
-       PATFETCH (c);							\
-       if (c == ' ')							\
-	 FREE_STACK_RETURN (REG_BADBR);					\
-       while ('0' <= c && c <= '9')					\
-	 {								\
-           int prev;							\
-	   if (num < 0)							\
-	     num = 0;							\
-	   prev = num;							\
-	   num = num * 10 + c - '0';					\
-	   if (num / 10 != prev)					\
-	     FREE_STACK_RETURN (REG_BADBR);				\
-	   if (p == pend)						\
-	     break;							\
-	   PATFETCH (c);						\
-	 }								\
-       if (c == ' ')							\
-	 FREE_STACK_RETURN (REG_BADBR);					\
-       }								\
-    } while (0)
+  do {									\
+    if (p == pend)							\
+      FREE_STACK_RETURN (REG_EBRACE);					\
+    else								\
+      {									\
+	PATFETCH (c);							\
+	while ('0' <= c && c <= '9')					\
+	  {								\
+	    int prev;							\
+	    if (num < 0)						\
+	      num = 0;							\
+	    prev = num;							\
+	    num = num * 10 + c - '0';					\
+	    if (num / 10 != prev)					\
+	      FREE_STACK_RETURN (REG_BADBR);				\
+	    if (p == pend)						\
+	      FREE_STACK_RETURN (REG_EBRACE);				\
+	    PATFETCH (c);						\
+	  }								\
+      }									\
+  } while (0)
 
 #if ! WIDE_CHAR_SUPPORT
 
@@ -2558,8 +2557,8 @@
 	      }
 	    /* If the spaces are followed by a repetition op,
 	       treat them normally.  */
-	    if (p1 == pend
-		|| (*p1 == '*' || *p1 == '+' || *p1 == '?'
+	    if (p1 != pend
+		&& (*p1 == '*' || *p1 == '+' || *p1 == '?'
 		    || (*p1 == '\\' && p1 + 1 != pend && p1[1] == '{')))
 	      goto normal_char;
 
@@ -3234,9 +3233,6 @@
 
 		beg_interval = p;
 
-		if (p == pend)
-		  FREE_STACK_RETURN (REG_EBRACE);
-
 		GET_UNSIGNED_NUMBER (lower_bound);
 
 		if (c == ',')
@@ -3253,7 +3249,8 @@
 		  {
 		    if (c != '\\')
 		      FREE_STACK_RETURN (REG_BADBR);
-
+		    if (p == pend)
+		      FREE_STACK_RETURN (REG_EESCAPE);
 		    PATFETCH (c);
 		  }
 
--- a/src/s/darwin.h	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/s/darwin.h	Wed Dec 08 22:20:27 2004 +0000
@@ -217,6 +217,13 @@
 /* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
 #define HAVE_SOCKETS
 
+/* In Carbon, asynchronous I/O (using SIGIO) can't be used for window
+   events because they don't come from sockets, even though it works
+   fine on tty's.  */
+#ifdef HAVE_CARBON
+#define NO_SOCK_SIGIO
+#endif
+
 /* Extra initialization calls in main for Mac OS X system type.  */
 #ifdef HAVE_CARBON
 #define SYMS_SYSTEM syms_of_mac()
@@ -314,6 +321,10 @@
 #define free unexec_free
 #endif
 
+/* This makes create_process in process.c save and restore signal
+   handlers correctly.  Suggested by Nozomu Ando.*/
+#define POSIX_SIGNALS
+
 /* Reroute calls to SELECT to the version defined in mac.c to fix the
    problem of Emacs requiring an extra return to be typed to start
    working when started from the command line.  */
--- a/src/s/gnu-linux.h	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/s/gnu-linux.h	Wed Dec 08 22:20:27 2004 +0000
@@ -1,5 +1,5 @@
 /* This file is the configuration file for Linux-based GNU systems
-   Copyright (C) 1985, 86, 92, 94, 96, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1985, 86, 92, 94, 96, 1999, 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -355,12 +355,22 @@
 
 #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
     || defined __alpha__ || defined __mips__ || defined __s390__ \
-    || defined __arm__ || defined __powerpc__ || defined __amd64__
+    || defined __arm__ || defined __powerpc__ || defined __amd64__ \
+    || defined __ia64__
 #define GC_SETJMP_WORKS 1
 #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
 #ifdef __mc68000__
 #define GC_LISP_OBJECT_ALIGNMENT 2
 #endif
+#ifdef __ia64__
+#define GC_MARK_SECONDARY_STACK()				\
+  do {								\
+    extern void *__libc_ia64_register_backing_store_base;	\
+    __builtin_ia64_flushrs ();					\
+    mark_memory (__libc_ia64_register_backing_store_base,	\
+		 __builtin_ia64_bsp ());			\
+  } while (0)
+#endif
 #endif
 
 /* arch-tag: 6244ea2a-abd0-44ec-abec-ff3dcc9afea9
--- a/src/search.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/search.c	Wed Dec 08 22:20:27 2004 +0000
@@ -2860,7 +2860,7 @@
 	else
 	  {
 	    int from;
-	    
+
 	    if (MARKERP (marker))
 	      {
 		if (XMARKER (marker)->buffer == 0)
@@ -2868,15 +2868,15 @@
 		else
 		  XSETBUFFER (last_thing_searched, XMARKER (marker)->buffer);
 	      }
-	    
+
 	    CHECK_NUMBER_COERCE_MARKER (marker);
 	    from = XINT (marker);
 	    list = Fcdr (list);
-	    
+
 	    marker = Fcar (list);
 	    if (MARKERP (marker) && XMARKER (marker)->buffer == 0)
 	      XSETFASTINT (marker, 0);
-	    
+
 	    CHECK_NUMBER_COERCE_MARKER (marker);
 	    search_regs.start[i] = from;
 	    search_regs.end[i] = XINT (marker);
@@ -3013,7 +3013,7 @@
   staticpro (&saved_last_thing_searched);
 
   DEFVAR_LISP ("search-spaces-regexp", &Vsearch_spaces_regexp,
-      /* doc: Regexp to substitute for bunches of spaces in regexp search.
+      doc: /* Regexp to substitute for bunches of spaces in regexp search.
 Some commands use this for user-specified regexps.
 Spaces that occur inside character classes or repetition operators
 or other such regexp constructs are not replaced with this.
--- a/src/sysdep.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/sysdep.c	Wed Dec 08 22:20:27 2004 +0000
@@ -1,6 +1,6 @@
 /* Interfaces to system-dependent kernel and library entries.
-   Copyright (C) 1985, 86,87,88,93,94,95,1999,2000,01,2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001,
+     2003, 2004  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -2872,12 +2872,16 @@
   struct sigaction new_action, old_action;
   sigemptyset (&new_action.sa_mask);
   new_action.sa_handler = action;
-#if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART)
+#if defined (SA_RESTART) && ! defined (BROKEN_SA_RESTART) && !defined(SYNC_INPUT)
   /* Emacs mostly works better with restartable system services. If this
      flag exists, we probably want to turn it on here.
      However, on some systems this resets the timeout of `select'
      which means that `select' never finishes if it keeps getting signals.
      BROKEN_SA_RESTART is defined on those systems.  */
+  /* It's not clear why the comment above says "mostly works better".  --Stef
+     When SYNC_INPUT is set, we don't want SA_RESTART because we need to poll
+     for pending input so we need long-running syscalls to be interrupted
+     after a signal that sets the interrupt_input_pending flag.  */
   new_action.sa_flags = SA_RESTART;
 #else
   new_action.sa_flags = 0;
@@ -3329,7 +3333,8 @@
 #endif
 
   while ((rtnval = open (path, oflag, mode)) == -1
-	 && (errno == EINTR));
+	 && (errno == EINTR))
+    QUIT;
   return (rtnval);
 }
 
@@ -3362,7 +3367,8 @@
   register int rtnval;
 
   while ((rtnval = read (fildes, buf, nbyte)) == -1
-	 && (errno == EINTR));
+	 && (errno == EINTR))
+    QUIT;
   return (rtnval);
 }
 
@@ -3383,7 +3389,15 @@
       if (rtnval == -1)
 	{
 	  if (errno == EINTR)
-	    continue;
+	    {
+#ifdef SYNC_INPUT
+	      /* I originally used `QUIT' but that might causes files to
+		 be truncated if you hit C-g in the middle of it.  --Stef  */
+	      if (interrupt_input_pending)
+		handle_async_input ();
+#endif
+	      continue;
+	    }
 	  else
 	    return (bytes_written ? bytes_written : -1);
 	}
--- a/src/term.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/term.c	Wed Dec 08 22:20:27 2004 +0000
@@ -612,39 +612,43 @@
     }
 }
 
-/* Encode SRC_LEN glyphs starting at SRC to terminal output codes and
-   store them at DST.  Do not write more than DST_LEN bytes.  That may
-   require stopping before all SRC_LEN input glyphs have been
-   converted.
-
-   We store the number of glyphs actually converted in *CONSUMED.  The
-   return value is the number of bytes store in DST.  */
-
-int
-encode_terminal_code (struct coding_system *coding,
-                      struct glyph *src,
-                      unsigned char *dst,
-                      int src_len,
-                      int dst_len,
-                      int *consumed)
+/* Buffer to store the source and result of code conversion for terminal.  */
+static unsigned char *encode_terminal_buf;
+/* Allocated size of the above buffer.  */
+static int encode_terminal_bufsize;
+
+/* Encode SRC_LEN glyphs starting at SRC to terminal output codes.
+   Set CODING->produced to the byte-length of the resulting byte
+   sequence, and return a pointer to that byte sequence.  */
+
+unsigned char *
+encode_terminal_code (src, src_len, coding)
+     struct glyph *src;
+     int src_len;
+     struct coding_system *coding;
 {
   struct glyph *src_start = src, *src_end = src + src_len;
-  unsigned char *dst_start = dst, *dst_end = dst + dst_len;
   register GLYPH g;
-  unsigned char workbuf[MAX_MULTIBYTE_LENGTH];
-  const unsigned char *buf;
-  int len;
+  unsigned char *buf;
+  int nchars, nbytes, required;
   register int tlen = GLYPH_TABLE_LENGTH;
   register Lisp_Object *tbase = GLYPH_TABLE_BASE;
-  int result;
-
-  /* If the specified coding does any conversion, use it, otherwise use
-     safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
-     because it always returns 1 if the member src_multibyte is 1.  */
-  coding = (coding->common_flags & CODING_REQUIRE_ENCODING_MASK
-	    ? coding
-	    : &safe_terminal_coding);
-
+
+  /* Allocate sufficient size of buffer to store all characters in
+     multibyte-form.  But, it may be enlarged on demand if
+     Vglyph_table contains a string.  */
+  required = MAX_MULTIBYTE_LENGTH * src_len;
+  if (encode_terminal_bufsize < required)
+    {
+      encode_terminal_bufsize = required;
+      if (encode_terminal_bufsize == 0)
+	encode_terminal_buf = xmalloc (required);
+      else
+	encode_terminal_buf = xrealloc (encode_terminal_buf, required);
+    }
+
+  buf = encode_terminal_buf;
+  nchars = 0;
   while (src < src_end)
     {
       /* We must skip glyphs to be padded for a wide character.  */
@@ -655,18 +659,11 @@
 	  if (g < 0 || g >= tlen)
 	    {
 	      /* This glyph doesn't has an entry in Vglyph_table.  */
-	      if (! CHAR_VALID_P (src->u.ch, 0))
-		{
-		  len = 1;
-		  buf = " ";
-		  coding->src_multibyte = 0;
-		}
+	      if (CHAR_VALID_P (src->u.ch, 0))
+		buf += CHAR_STRING (src->u.ch, buf);
 	      else
-		{
-		  len = CHAR_STRING (src->u.ch, workbuf);
-		  buf = workbuf;
-		  coding->src_multibyte = 1;
-		}
+		*buf++ = SPACEGLYPH;
+	      nchars++;
 	    }
 	  else
 	    {
@@ -676,48 +673,61 @@
 
 	      if (GLYPH_SIMPLE_P (tbase, tlen, g))
 		{
-		  /* We set the multi-byte form of a character in G
-		     (that should be an ASCII character) at
-		     WORKBUF.  */
-		  workbuf[0] = FAST_GLYPH_CHAR (g);
-		  len = 1;
-		  buf = workbuf;
-		  coding->src_multibyte = 0;
+		  int c = FAST_GLYPH_CHAR (g);
+
+		  if (CHAR_VALID_P (c, 0))
+		    buf += CHAR_STRING (c, buf);
+		  else
+		    *buf++ = SPACEGLYPH;
+		  nchars++;
 		}
 	      else
 		{
 		  /* We have a string in Vglyph_table.  */
-		  len = GLYPH_LENGTH (tbase, g);
-		  buf = GLYPH_STRING (tbase, g);
-		  coding->src_multibyte = STRING_MULTIBYTE (tbase[g]);
+		  Lisp_Object string;
+
+		  string = tbase[g];
+		  if (! STRING_MULTIBYTE (string))
+		    string = string_to_multibyte (string);
+		  nbytes = buf - encode_terminal_buf;
+		  if (nbytes + SBYTES (string) < encode_terminal_bufsize)
+		    {
+		      encode_terminal_bufsize = nbytes + SBYTES (string);
+		      encode_terminal_buf = xrealloc (encode_terminal_buf,
+						      encode_terminal_bufsize);
+		      buf = encode_terminal_buf + nbytes;
+		    }
+		  bcopy (SDATA (string), buf, SBYTES (string));
+		  buf += SBYTES (string);
+		  nchars += SCHARS (string);
 		}
 	    }
-
-	  result = encode_coding (coding, buf, dst, len, dst_end - dst);
-	  len -= coding->consumed;
-	  dst += coding->produced;
-	  if (result == CODING_FINISH_INSUFFICIENT_DST
-	      || (result == CODING_FINISH_INSUFFICIENT_SRC
-		  && len > dst_end - dst))
-	    /* The remaining output buffer is too short.  We must
-	       break the loop here without increasing SRC so that the
-	       next call of this function starts from the same glyph.  */
-	    break;
-
-	  if (len > 0)
-	    {
-	      /* This is the case that a code of the range 0200..0237
-		 exists in buf.  We must just write out such a code.  */
-	      buf += coding->consumed;
-	      while (len--)
-		*dst++ = *buf++;
-	    }
 	}
       src++;
     }
 
-  *consumed = src - src_start;
-  return (dst - dst_start);
+  nbytes = buf - encode_terminal_buf;
+  coding->src_multibyte = 1;
+  coding->dst_multibyte = 0;
+  if (SYMBOLP (coding->pre_write_conversion)
+      && ! NILP (Ffboundp (coding->pre_write_conversion)))
+    {
+      run_pre_write_conversin_on_c_str (&encode_terminal_buf, 
+					&encode_terminal_bufsize,
+					nchars, nbytes, coding);
+      nchars = coding->produced_char;
+      nbytes = coding->produced;
+    }
+  required = nbytes + encoding_buffer_size (coding, nbytes);
+  if (encode_terminal_bufsize < required)
+    {
+      encode_terminal_bufsize = required;
+      encode_terminal_buf = xrealloc (encode_terminal_buf, required);
+    }
+
+  encode_coding (coding, encode_terminal_buf, encode_terminal_buf + nbytes,
+		 nbytes, encode_terminal_bufsize - nbytes);
+  return encode_terminal_buf + nbytes;
 }
 
 
@@ -736,9 +746,8 @@
 void
 tty_write_glyphs (struct frame *f, struct glyph *string, int len)
 {
-  int produced, consumed;
-  unsigned char conversion_buffer[1024];
-  int conversion_buffer_size = sizeof conversion_buffer;
+  unsigned char *conversion_buffer;
+  struct coding_system *coding;
 
   struct tty_display_info *tty = FRAME_TTY (f);
 
@@ -757,9 +766,14 @@
 
   cmplus (tty, len);
 
+  /* If terminal_coding does any conversion, use it, otherwise use
+     safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
+     because it always return 1 if the member src_multibyte is 1.  */
+  coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
+	    ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
   /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
      the tail.  */
-  FRAME_TERMINAL_CODING (f)->mode &= ~CODING_MODE_LAST_BLOCK;
+  coding->mode &= ~CODING_MODE_LAST_BLOCK;
 
   while (len > 0)
     {
@@ -775,55 +789,26 @@
       highlight_if_desired (tty);
       turn_on_face (f, face_id);
 
-      while (n > 0)
+      if (n == len)
+	/* This is the last run.  */
+	coding->mode |= CODING_MODE_LAST_BLOCK;
+      conversion_buffer = encode_terminal_code (string, n, coding);
+      if (coding->produced > 0)
 	{
-	  /* We use a fixed size (1024 bytes) of conversion buffer.
-	     Usually it is sufficient, but if not, we just repeat the
-	     loop.  */
-	  produced = encode_terminal_code (FRAME_TERMINAL_CODING (f),
-                                           string, conversion_buffer,
-					   n, conversion_buffer_size,
-					   &consumed);
-	  if (produced > 0)
-	    {
-	      fwrite (conversion_buffer, 1, produced,
-                      tty->output);
-	      if (ferror (tty->output))
-		clearerr (tty->output);
-	      if (tty->termscript)
-		fwrite (conversion_buffer, 1, produced,
-                        tty->termscript);
-	    }
-	  len -= consumed;
-	  n -= consumed;
-	  string += consumed;
+	  fwrite (conversion_buffer, 1, coding->produced, tty->output);
+	  if (ferror (tty->output))
+	    clearerr (tty->output);
+	  if (tty->termscript)
+	    fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
 	}
+      len -= n;
+      string += n;
 
       /* Turn appearance modes off.  */
       turn_off_face (f, face_id);
       turn_off_highlight (tty);
     }
 
-  /* We may have to output some codes to terminate the writing.  */
-  if (CODING_REQUIRE_FLUSHING (FRAME_TERMINAL_CODING (f)))
-    {
-      FRAME_TERMINAL_CODING (f)->mode |= CODING_MODE_LAST_BLOCK;
-      encode_coding (FRAME_TERMINAL_CODING (f), "",
-                     conversion_buffer, 0, conversion_buffer_size);
-      if (FRAME_TERMINAL_CODING (f)->produced > 0)
-	{
-	  fwrite (conversion_buffer, 1,
-                  FRAME_TERMINAL_CODING (f)->produced,
-                  tty->output);
-	  if (ferror (tty->output))
-	    clearerr (tty->output);
-	  if (tty->termscript)
-	    fwrite (conversion_buffer, 1,
-                    FRAME_TERMINAL_CODING (f)->produced,
-		    tty->termscript);
-	}
-    }
-
   cmcheckmagic (tty);
 }
 
@@ -848,6 +833,9 @@
 {
   char *buf;
   struct glyph *glyph = NULL;
+  unsigned char *conversion_buffer;
+  unsigned char space[1];
+  struct coding_system *coding;
 
   struct tty_display_info *tty = FRAME_TTY (f);
 
@@ -863,19 +851,26 @@
 
   turn_on_insert (tty);
   cmplus (tty, len);
-  /* The bit CODING_MODE_LAST_BLOCK should be set to 1 only at the tail.  */
-  FRAME_TERMINAL_CODING (f)->mode &= ~CODING_MODE_LAST_BLOCK;
+
+  if (! start)
+    space[0] = SPACEGLYPH;
+
+  /* If terminal_coding does any conversion, use it, otherwise use
+     safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
+     because it always return 1 if the member src_multibyte is 1.  */
+  coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
+	    ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
+  /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
+     the tail.  */
+  coding->mode &= ~CODING_MODE_LAST_BLOCK;
+
   while (len-- > 0)
     {
-      int produced, consumed;
-      unsigned char conversion_buffer[1024];
-      int conversion_buffer_size = sizeof conversion_buffer;
-
       OUTPUT1_IF (tty, tty->TS_ins_char);
       if (!start)
 	{
-	  conversion_buffer[0] = SPACEGLYPH;
-	  produced = 1;
+	  conversion_buffer = space;
+	  coding->produced = 1;
 	}
       else
 	{
@@ -893,24 +888,18 @@
 
 	  if (len <= 0)
 	    /* This is the last glyph.  */
-	    FRAME_TERMINAL_CODING (f)->mode |= CODING_MODE_LAST_BLOCK;
-
-	  /* The size of conversion buffer (1024 bytes) is surely
-	     sufficient for just one glyph.  */
-	  produced = encode_terminal_code (FRAME_TERMINAL_CODING (f),
-                                           glyph, conversion_buffer, 1,
-					   conversion_buffer_size, &consumed);
+	    coding->mode |= CODING_MODE_LAST_BLOCK;
+
+          conversion_buffer = encode_terminal_code (glyph, 1, coding);
 	}
 
-      if (produced > 0)
+      if (coding->produced > 0)
 	{
-	  fwrite (conversion_buffer, 1, produced,
-                  tty->output);
+	  fwrite (conversion_buffer, 1, coding->produced, tty->output);
 	  if (ferror (tty->output))
 	    clearerr (tty->output);
 	  if (tty->termscript)
-	    fwrite (conversion_buffer, 1, produced,
-                    tty->termscript);
+	    fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
 	}
 
       OUTPUT1_IF (tty, tty->TS_pad_inserted_char);
@@ -2445,6 +2434,8 @@
 
   add_keyboard_wait_descriptor (fileno (tty->input));
 
+  encode_terminal_bufsize = 0;
+
 #ifdef WINDOWSNT
   initialize_w32_display ();
 
--- a/src/w32console.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/w32console.c	Wed Dec 08 22:20:27 2004 +0000
@@ -294,6 +294,9 @@
     }
 }
 
+extern unsigned char *encode_terminal_code P_ ((struct glyph *, int, 
+						struct coding_system *));
+
 static void
 w32con_write_glyphs (register struct glyph *string, register int len)
 {
@@ -301,12 +304,17 @@
   DWORD r;
   struct frame * f = PICK_FRAME ();
   WORD char_attr;
-  unsigned char conversion_buffer[1024];
-  int conversion_buffer_size = sizeof conversion_buffer;
+  unsigned char *conversion_buffer;
+  struct coding_system *coding;
 
   if (len <= 0)
     return;
 
+  /* If terminal_coding does any conversion, use it, otherwise use
+     safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
+     because it always return 1 if the member src_multibyte is 1.  */
+  coding = (terminal_coding.common_flags & CODING_REQUIRE_ENCODING_MASK
+	    ? &terminal_coding : &safe_terminal_coding);
   /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
      the tail.  */
   terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;
@@ -324,69 +332,37 @@
       /* Turn appearance modes of the face of the run on.  */
       char_attr = w32_face_attributes (f, face_id);
 
-      while (n > 0)
-        {
-	  /* We use a fixed size (1024 bytes) of conversion buffer.
-	     Usually it is sufficient, but if not, we just repeat the
-	     loop.  */
-	  produced = encode_terminal_code (string, conversion_buffer,
-					   n, conversion_buffer_size,
-					   &consumed);
-	  if (produced > 0)
+      if (n == len)
+	/* This is the last run.  */
+	coding->mode |= CODING_MODE_LAST_BLOCK;
+      conversion_buffer = encode_terminal_code (string, n, coding);
+      if (coding->produced > 0)
+	{
+	  /* Set the attribute for these characters.  */
+	  if (!FillConsoleOutputAttribute (cur_screen, char_attr,
+					   coding->produced, cursor_coords,
+					   &r))
 	    {
-              /* Set the attribute for these characters.  */
-              if (!FillConsoleOutputAttribute (cur_screen, char_attr,
-                                               produced, cursor_coords, &r))
-                {
-                  printf ("Failed writing console attributes: %d\n",
-                          GetLastError ());
-                  fflush (stdout);
-                }
-
-              /* Write the characters.  */
-              if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer,
-                                                produced, cursor_coords, &r))
-                {
-                  printf ("Failed writing console characters: %d\n",
-                          GetLastError ());
-                  fflush (stdout);
-                }
+	      printf ("Failed writing console attributes: %d\n",
+		      GetLastError ());
+	      fflush (stdout);
+	    }
 
-              cursor_coords.X += produced;
-              w32con_move_cursor (cursor_coords.Y, cursor_coords.X);
-            }
-          len -= consumed;
-          n -= consumed;
-          string += consumed;
-        }
-    }
+	  /* Write the characters.  */
+	  if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer,
+					    coding->produced, cursor_coords,
+					    &r))
+	    {
+	      printf ("Failed writing console characters: %d\n",
+		      GetLastError ());
+	      fflush (stdout);
+	    }
 
-  /* We may have to output some codes to terminate the writing.  */
-  if (CODING_REQUIRE_FLUSHING (&terminal_coding))
-    {
-      terminal_coding.mode |= CODING_MODE_LAST_BLOCK;
-      encode_coding (&terminal_coding, "", conversion_buffer,
-		     0, conversion_buffer_size);
-      if (terminal_coding.produced > 0)
-        {
-          if (!FillConsoleOutputAttribute (cur_screen, char_attr_normal,
-                                           terminal_coding.produced,
-                                           cursor_coords, &r))
-            {
-              printf ("Failed writing console attributes: %d\n",
-                      GetLastError ());
-              fflush (stdout);
-            }
-
-          /* Write the characters.  */
-          if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer,
-                                            produced, cursor_coords, &r))
-            {
-              printf ("Failed writing console characters: %d\n",
-                      GetLastError ());
-              fflush (stdout);
-            }
-        }
+	  cursor_coords.X += coding->produced;
+	  w32con_move_cursor (cursor_coords.Y, cursor_coords.X);
+	}
+      len -= n;
+      string += n;
     }
 }
 
--- a/src/window.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/window.c	Wed Dec 08 22:20:27 2004 +0000
@@ -1613,7 +1613,7 @@
 		   : Qnil);
   else if (EQ (*all_frames, Qvisible))
     ;
-  else if (XFASTINT (*all_frames) == 0)
+  else if (EQ (*all_frames, make_number (0)))
     ;
   else if (FRAMEP (*all_frames))
     ;
@@ -1887,7 +1887,7 @@
 
   if (f)
     frame_arg = Qlambda;
-  else if (XFASTINT (frames) == 0)
+  else if (EQ (frames, make_number (0)))
     frame_arg = frames;
   else if (EQ (frames, Qvisible))
     frame_arg = frames;
@@ -2099,6 +2099,8 @@
        doc: /* Return the window least recently selected or used for display.
 Return a full-width window if possible.
 A minibuffer window is never a candidate.
+A dedicated window is never a candidate, so if all windows are dedicated,
+the value is nil.
 If optional argument FRAME is `visible', search all visible frames.
 If FRAME is 0, search all visible and iconified frames.
 If FRAME is t, search all frames.
@@ -2119,6 +2121,8 @@
 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0,
        doc: /* Return the largest window in area.
 A minibuffer window is never a candidate.
+A dedicated window is never a candidate, so if all windows are dedicated,
+the value is nil.
 If optional argument FRAME is `visible', search all visible frames.
 If FRAME is 0, search all visible and iconified frames.
 If FRAME is t, search all frames.
@@ -2696,7 +2700,7 @@
             ++nonzero_sizes;
             nonzero_idx = i;
           }
-      
+
       for (i = 0; i < nchildren; ++i)
         if (new_sizes[i] > min_size)
           {
@@ -3014,6 +3018,9 @@
   if (EQ (window, selected_window))
     b->last_selected_window = window;
 
+  /* Let redisplay errors through.  */
+  b->display_error_modiff = 0;
+
   /* Update time stamps of buffer display.  */
   if (INTEGERP (b->display_count))
     XSETINT (b->display_count, XINT (b->display_count) + 1);
@@ -6180,10 +6187,12 @@
   struct window *w = decode_window (window);
 
   if (!NILP (width))
-    CHECK_NATNUM (width);
-
-  if (XINT (width) == 0)
-    vertical_type = Qnil;
+    {
+      CHECK_NATNUM (width);
+
+      if (XINT (width) == 0)
+	vertical_type = Qnil;
+    }
 
   if (!(EQ (vertical_type, Qnil)
 	|| EQ (vertical_type, Qleft)
--- a/src/xdisp.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/xdisp.c	Wed Dec 08 22:20:27 2004 +0000
@@ -803,7 +803,7 @@
 
 /* Function prototypes.  */
 
-static void setup_for_ellipsis P_ ((struct it *));
+static void setup_for_ellipsis P_ ((struct it *, int));
 static void mark_window_display_accurate_1 P_ ((struct window *, int));
 static int single_display_prop_string_p P_ ((Lisp_Object, Lisp_Object));
 static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object));
@@ -3223,7 +3223,7 @@
 	      it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p;
 	    }
 	  else if (display_ellipsis_p)
-	    setup_for_ellipsis (it);
+	    setup_for_ellipsis (it, 0);
 	}
     }
 
@@ -3231,14 +3231,17 @@
 }
 
 
-/* Make iterator IT return `...' next.  */
-
-static void
-setup_for_ellipsis (it)
-     struct it *it;
-{
-  if (it->dp
-      && VECTORP (DISP_INVIS_VECTOR (it->dp)))
+/* Make iterator IT return `...' next.
+   Replaces LEN characters from buffer.  */
+
+static void
+setup_for_ellipsis (it, len)
+     struct it *it;
+     int len;
+{
+  /* Use the display table definition for `...'.  Invalid glyphs
+     will be handled by the method returning elements from dpvec.  */
+  if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp)))
     {
       struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
       it->dpvec = v->contents;
@@ -3251,12 +3254,12 @@
       it->dpend = default_invis_vector + 3;
     }
 
-  /* The ellipsis display does not replace the display of the
-     character at the new position.  Indicate this by setting
-     IT->dpvec_char_len to zero.  */
-  it->dpvec_char_len = 0;
-
+  it->dpvec_char_len = len;
   it->current.dpvec_index = 0;
+
+  /* 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;
 }
 
@@ -3571,7 +3574,7 @@
 	      || EQ (XCAR (prop), Qright_fringe))
 	  && CONSP (XCDR (prop)))
 	{
-	  unsigned face_id = DEFAULT_FACE_ID;
+	  int face_id = DEFAULT_FACE_ID;
 	  int fringe_bitmap;
 
 	  /* Save current settings of IT so that we can restore them
@@ -3590,10 +3593,9 @@
 	  if (CONSP (XCDR (XCDR (prop))))
 	    {
 	      Lisp_Object face_name = XCAR (XCDR (XCDR (prop)));
-
-	      face_id = lookup_named_face (it->f, face_name, 'A');
-	      if (face_id < 0)
-		return 0;
+	      int face_id2 = lookup_named_face (it->f, face_name, 'A', 0);
+	      if (face_id2 >= 0)
+		face_id = face_id2;
 	    }
 
 	  push_it (it);
@@ -4048,7 +4050,7 @@
       /* If we have to display `...' for invisible text, set
 	 the iterator up for that.  */
       if (display_ellipsis_p)
-	setup_for_ellipsis (it);
+	setup_for_ellipsis (it, 0);
     }
   else
     {
@@ -4840,7 +4842,10 @@
      we hit the end of what we iterate over.  Performance note: the
      function pointer `method' used here turns out to be faster than
      using a sequence of if-statements.  */
-  int success_p = (*it->method) (it);
+  int success_p;
+
+ get_next:
+  success_p = (*it->method) (it);
 
   if (it->what == IT_CHARACTER)
     {
@@ -4872,14 +4877,14 @@
 		  it->dpvec = v->contents;
 		  it->dpend = v->contents + v->size;
 		  it->current.dpvec_index = 0;
+		  it->saved_face_id = it->face_id;
 		  it->method = next_element_from_display_vector;
-		  success_p = get_next_display_element (it);
 		}
 	      else
 		{
 		  set_iterator_to_next (it, 0);
-		  success_p = get_next_display_element (it);
-		}
+		}
+	      goto get_next;
 	    }
 
 	  /* Translate control characters into `\003' or `^C' form.
@@ -4915,6 +4920,7 @@
 		 IT->ctl_chars with glyphs for what we have to
 		 display.  Then, set IT->dpvec to these glyphs.  */
 	      GLYPH g;
+	      int ctl_len;
 
 	      if (it->c < 128 && it->ctl_arrow_p)
 		{
@@ -4929,14 +4935,7 @@
 
 		  g = FAST_MAKE_GLYPH (it->c ^ 0100, 0);
 		  XSETINT (it->ctl_chars[1], g);
-
-		  /* 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 + 2;
-		  it->current.dpvec_index = 0;
-		  it->method = next_element_from_display_vector;
-		  get_next_display_element (it);
+		  ctl_len = 2;
 		}
 	      else
 		{
@@ -4985,16 +4984,17 @@
 		      g = FAST_MAKE_GLYPH ((str[i] & 7) + '0', 0);
 		      XSETINT (it->ctl_chars[i * 4 + 3], g);
 		    }
-
-		  /* Set up IT->dpvec and return the first character
-                     from it.  */
-		  it->dpvec_char_len = it->len;
-		  it->dpvec = it->ctl_chars;
-		  it->dpend = it->dpvec + len * 4;
-		  it->current.dpvec_index = 0;
-		  it->method = next_element_from_display_vector;
-		  get_next_display_element (it);
-		}
+		  ctl_len = len * 4;
+		}
+
+	      /* 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->saved_face_id = it->face_id;
+	      it->method = next_element_from_display_vector;
+	      goto get_next;
 	    }
 	}
 
@@ -5184,11 +5184,14 @@
 	       && IT_STRING_CHARPOS (*it) >= 0));
 }
 
-
 /* Load IT's display element fields with information about the next
    display element which comes from a display table entry or from the
    result of translating a control character to one of the forms `^C'
-   or `\003'.  IT->dpvec holds the glyphs to return as characters.  */
+   or `\003'.
+
+   IT->dpvec holds the glyphs to return as characters.
+   IT->saved_face_id holds the face id before the display vector--
+   it is restored into IT->face_idin set_iterator_to_next.  */
 
 static int
 next_element_from_display_vector (it)
@@ -5197,10 +5200,6 @@
   /* Precondition.  */
   xassert (it->dpvec && it->current.dpvec_index >= 0);
 
-  /* 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;
-
   if (INTEGERP (*it->dpvec)
       && GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec)))
     {
@@ -5384,28 +5383,7 @@
      struct it *it;
 {
   if (it->selective_display_ellipsis_p)
-    {
-      if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp)))
-	{
-	  /* Use the display table definition for `...'.  Invalid glyphs
-	     will be handled by the method returning elements from dpvec.  */
-	  struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
-	  it->dpvec_char_len = it->len;
-	  it->dpvec = v->contents;
-	  it->dpend = v->contents + v->size;
-	  it->current.dpvec_index = 0;
-	  it->method = next_element_from_display_vector;
-	}
-      else
-	{
-	  /* Use default `...' which is stored in default_invis_vector.  */
-	  it->dpvec_char_len = it->len;
-	  it->dpvec = default_invis_vector;
-	  it->dpend = default_invis_vector + 3;
-	  it->current.dpvec_index = 0;
-	  it->method = next_element_from_display_vector;
-	}
-    }
+    setup_for_ellipsis (it, it->len);
   else
     {
       /* The face at the current position may be different from the
@@ -5776,8 +5754,6 @@
 				  result = MOVE_NEWLINE_OR_CR;
 				  break;
 				}
-			      if (it->method == next_element_from_display_vector)
-				it->face_id = it->saved_face_id;
 			    }
 #endif /* HAVE_WINDOW_SYSTEM */
 			}
@@ -14538,7 +14514,9 @@
 		  && glyph->u.ch == ' '))
 	  && trailing_whitespace_p (glyph->charpos))
 	{
-	  int face_id = lookup_named_face (f, Qtrailing_whitespace, 0);
+	  int face_id = lookup_named_face (f, Qtrailing_whitespace, 0, 0);
+	  if (face_id < 0)
+	    return;
 
 	  while (glyph >= start
 		 && BUFFERP (glyph->object)
@@ -14631,8 +14609,10 @@
      hscrolled.  This may stop at an x-position < IT->first_visible_x
      if the first glyph is partially visible or if we hit a line end.  */
   if (it->current_x < it->first_visible_x)
-    move_it_in_display_line_to (it, ZV, it->first_visible_x,
-				MOVE_TO_POS | MOVE_TO_X);
+    {
+      move_it_in_display_line_to (it, ZV, it->first_visible_x,
+				  MOVE_TO_POS | MOVE_TO_X);
+    }
 
   /* Get the initial row height.  This is either the height of the
      text hscrolled, if there is any, or zero.  */
@@ -14791,8 +14771,6 @@
 				  row->continued_p = 0;
 				  row->exact_window_width_line_p = 1;
 				}
-			      else if (it->method == next_element_from_display_vector)
-				it->face_id = it->saved_face_id;
 			    }
 #endif /* HAVE_WINDOW_SYSTEM */
 			}
@@ -18812,7 +18790,7 @@
       struct face *face;
       struct font_info *font_info;
 
-      face_id = lookup_named_face (it->f, face_name, ' ');
+      face_id = lookup_named_face (it->f, face_name, ' ', 0);
       if (face_id < 0)
 	return make_number (-1);
 
--- a/src/xfaces.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/xfaces.c	Wed Dec 08 22:20:27 2004 +0000
@@ -3012,7 +3012,7 @@
     {
       /* This is of limited utility since it works with character
 	 widths.  Keep it for compatibility.  --gerd.  */
-      int face_id = lookup_named_face (f, face, 0);
+      int face_id = lookup_named_face (f, face, 0, 0);
       struct face *face = (face_id < 0
 			   ? NULL
 			   : FACE_FROM_ID (f, face_id));
@@ -4926,7 +4926,7 @@
   else
     {
       struct frame *f = frame_or_selected_frame (frame, 1);
-      int face_id = lookup_named_face (f, face, 0);
+      int face_id = lookup_named_face (f, face, 0, 1);
       struct face *face = FACE_FROM_ID (f, face_id);
       return face ? build_string (face->font_name) : Qnil;
     }
@@ -5618,10 +5618,11 @@
    isn't realized and cannot be realized.  */
 
 int
-lookup_named_face (f, symbol, c)
+lookup_named_face (f, symbol, c, signal_p)
      struct frame *f;
      Lisp_Object symbol;
      int c;
+     int signal_p;
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
@@ -5634,7 +5635,9 @@
       default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
     }
 
-  get_lface_attributes (f, symbol, symbol_attrs, 1);
+  if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p))
+    return -1;
+
   bcopy (default_face->lface, attrs, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
 
@@ -5655,7 +5658,7 @@
   if (lface_id >= 0 && lface_id < lface_id_to_name_size)
     {
       Lisp_Object face_name = lface_id_to_name[lface_id];
-      face_id = lookup_named_face (f, face_name, 0);
+      face_id = lookup_named_face (f, face_name, 0, 1);
     }
   else
     face_id = -1;
--- a/src/xfns.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/xfns.c	Wed Dec 08 22:20:27 2004 +0000
@@ -152,6 +152,10 @@
 
 int display_hourglass_p;
 
+/* Non-zero means prompt with the old GTK file selection dialog.  */
+
+int x_use_old_gtk_file_dialog;
+
 /* The background and shape of the mouse pointer, and shape when not
    over text or in the modeline.  */
 
@@ -5598,6 +5602,14 @@
 Chinese, Japanese, and Korean.  */);
   Vx_pixel_size_width_font_regexp = Qnil;
 
+/* This is not ifdef:ed, so other builds than GTK can customize it.  */
+  DEFVAR_BOOL ("x-use-old-gtk-file-dialog", &x_use_old_gtk_file_dialog,
+    doc: /* *Non-nil means prompt with the old GTK file selection dialog.
+If nil or if the file selection dialog is not available, the new GTK file
+chooser is used instead.  To turn off all file dialogs set the
+variable `use-file-dialog'.  */);
+  x_use_old_gtk_file_dialog = 0;
+
 #ifdef USE_X_TOOLKIT
   Fprovide (intern ("x-toolkit"), Qnil);
 #ifdef USE_MOTIF
@@ -5617,14 +5629,6 @@
   Fprovide (intern ("x-toolkit"), Qnil);
   Fprovide (intern ("gtk"), Qnil);
 
-#ifdef HAVE_GTK_FILE_BOTH
-  DEFVAR_BOOL ("use-old-gtk-file-dialog", &use_old_gtk_file_dialog,
-    doc: /* *Non-nil means that the old GTK file selection dialog is used.
-If nil the new GTK file chooser is used instead.  To turn off
-all file dialogs set the variable `use-file-dialog'.  */);
-  use_old_gtk_file_dialog = 0;
-#endif
-
   DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
                doc: /* Version info for GTK+.  */);
   {
--- a/src/xmenu.c	Sun Nov 28 14:39:06 2004 +0000
+++ b/src/xmenu.c	Wed Dec 08 22:20:27 2004 +0000
@@ -741,8 +741,7 @@
 or a list ((XOFFSET YOFFSET) WINDOW)
 where XOFFSET and YOFFSET are positions in pixels from the top left
 corner of WINDOW's frame.  (WINDOW may be a frame object instead of a window.)
-This controls the position of the center of the first line
-in the first pane of the menu, not the top left of the menu as a whole.
+This controls the position of the top left of the menu as a whole.
 If POSITION is t, it means to use the current mouse position.
 
 MENU is a specifier for a menu.  For the simplest case, MENU is a keymap.
@@ -3256,7 +3255,7 @@
   char *datap;
   int ulx, uly, width, height;
   int dispwidth, dispheight;
-  int i, j;
+  int i, j, lines, maxlines;
   int maxwidth;
   int dummy_int;
   unsigned int dummy_uint;
@@ -3287,31 +3286,8 @@
 
 #ifdef HAVE_X_WINDOWS
   /* Adjust coordinates to relative to the outer (window manager) window.  */
-  {
-    Window child;
-    int win_x = 0, win_y = 0;
-
-    /* Find the position of the outside upper-left corner of
-       the inner window, with respect to the outer window.  */
-    if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window)
-      {
-	BLOCK_INPUT;
-	XTranslateCoordinates (FRAME_X_DISPLAY (f),
-
-			       /* From-window, to-window.  */
-			       f->output_data.x->window_desc,
-			       f->output_data.x->parent_desc,
-
-			       /* From-position, to-position.  */
-			       0, 0, &win_x, &win_y,
-
-			       /* Child of window.  */
-			       &child);
-	UNBLOCK_INPUT;
-	x += win_x;
-	y += win_y;
-      }
-  }
+  x += FRAME_OUTER_TO_INNER_DIFF_X (f);
+  y += FRAME_OUTER_TO_INNER_DIFF_Y (f);
 #endif /* HAVE_X_WINDOWS */
 
   /* Adjust coordinates to be root-window-relative.  */
@@ -3319,7 +3295,7 @@
   y += f->top_pos;
 
   /* Create all the necessary panes and their items.  */
-  i = 0;
+  maxlines = lines = i = 0;
   while (i < menu_items_used)
     {
       if (EQ (XVECTOR (menu_items)->contents[i], Qt))
@@ -3328,6 +3304,8 @@
 	  Lisp_Object pane_name, prefix;
 	  char *pane_string;
 
+          maxlines = max (maxlines, lines);
+          lines = 0;
 	  pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
 	  prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
 	  pane_string = (NILP (pane_name)
@@ -3420,9 +3398,12 @@
 	      return Qnil;
 	    }
 	  i += MENU_ITEMS_ITEM_LENGTH;
+          lines++;
 	}
     }
 
+  maxlines = max (maxlines, lines);
+
   /* All set and ready to fly.  */
   XMenuRecompute (FRAME_X_DISPLAY (f), menu);
   dispwidth = DisplayWidth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f));
@@ -3446,6 +3427,15 @@
   if (ulx < 0) x -= ulx;
   if (uly < 0) y -= uly;
 
+  if (! for_click)
+    {
+      /* If position was not given by a mouse click, adjust so upper left
+         corner of the menu as a whole ends up at given coordinates.  This
+         is what x-popup-menu says in its documentation.  */
+      x += width/2;
+      y += 1.5*height/(maxlines+2);
+    }
+
   XMenuSetAEQ (menu, TRUE);
   XMenuSetFreeze (menu, TRUE);
   pane = selidx = 0;