Commits

daiki  committed 06b3ed3

Sync riece with upstream version 3.1.2

  • Participants
  • Parent commits 82041e9

Comments (0)

Files changed (87)

+2007-01-29  Daiki Ueno  <ueno@unixuser.org>
+
+	* Riece: Version 3.1.2 released.
+	* configure.ac: Bump up version to 3.1.2.
+
+2006-12-18  Daiki Ueno  <ueno@unixuser.org>
+
+	* configure.ac: Generate lisp/riece-package-info.el.
+
+2006-09-29  Daiki Ueno  <ueno@unixuser.org>
+
+	* Riece: Version 3.1.1 released.
+	* configure.ac: Bump up version to 3.1.1.
+
+2006-07-29  Daiki Ueno  <ueno@unixuser.org>
+
+	* Riece: Version 3.1.0 released.
+	* configure.ac: Bump up version to 3.1.0.
+
+2006-05-29  Daiki Ueno  <ueno@unixuser.org>
+
+	* Riece: Version 3.0.0 released.
+	* configure.ac: Bump up version to 3.0.0.
+
 2006-01-13  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.22 released.
 # This XEmacs package contains the riece IRC client package
 
 VERSION = 1.22
-AUTHOR_VERSION = 2.0.2
+AUTHOR_VERSION = 3.1.2
 MAINTAINER = Daiki Ueno <ueno@unixuser.org>
 PACKAGE = riece
 PKG_TYPE = regular
 
 include ../../Local.rules.inc
 
-ELCS = lisp/riece.elc lisp/riece-000.elc lisp/riece-200.elc lisp/riece-300.elc	      \
-lisp/riece-400.elc lisp/riece-500.elc lisp/riece-addon-modules.elc    \
-lisp/riece-addon.elc lisp/riece-alias.elc lisp/riece-async.elc	      \
-lisp/riece-biff.elc lisp/riece-button.elc lisp/riece-cache.elc	      \
-lisp/riece-channel.elc lisp/riece-coding.elc lisp/riece-commands.elc  \
-lisp/riece-compat.elc lisp/riece-complete.elc lisp/riece-ctcp.elc     \
-lisp/riece-ctlseq.elc lisp/riece-debug.elc lisp/riece-develop.elc     \
-lisp/riece-display.elc lisp/riece-doctor.elc lisp/riece-eval-ruby.elc \
-lisp/riece-eval.elc lisp/riece-filter.elc lisp/riece-foolproof.elc    \
-lisp/riece-globals.elc lisp/riece-google.elc lisp/riece-guess.elc     \
-lisp/riece-handle.elc lisp/riece-hangman.elc lisp/riece-highlight.elc \
-lisp/riece-history.elc lisp/riece-icon.elc lisp/riece-identity.elc    \
-lisp/riece-ignore.elc lisp/riece-irc.elc lisp/riece-kakasi.elc	      \
-lisp/riece-keepalive.elc lisp/riece-keyword.elc lisp/riece-layout.elc \
-lisp/riece-log.elc lisp/riece-lsdb.elc lisp/riece-menu.elc	      \
-lisp/riece-message.elc lisp/riece-mini.elc lisp/riece-misc.elc	      \
-lisp/riece-mode.elc lisp/riece-naming.elc lisp/riece-options.elc      \
-lisp/riece-rdcc.elc lisp/riece-ruby.elc lisp/riece-server.elc	      \
-lisp/riece-shrink-buffer.elc lisp/riece-signal.elc		      \
-lisp/riece-toolbar.elc lisp/riece-unread.elc lisp/riece-url.elc	      \
-lisp/riece-user.elc lisp/riece-version.elc lisp/riece-xemacs.elc      \
-lisp/riece-xface.elc lisp/riece-xfaceb.elc lisp/riece-yank.elc
+ELCS = lisp/riece.elc lisp/riece-000.elc lisp/riece-200.elc	       \
+lisp/riece-300.elc lisp/riece-400.elc lisp/riece-500.elc	       \
+lisp/riece-addon-modules.elc lisp/riece-addon.elc lisp/riece-alias.elc \
+lisp/riece-async.elc lisp/riece-biff.elc lisp/riece-button.elc	       \
+lisp/riece-cache.elc lisp/riece-channel.elc lisp/riece-coding.elc      \
+lisp/riece-commands.elc lisp/riece-compat.elc lisp/riece-complete.elc  \
+lisp/riece-ctcp.elc lisp/riece-ctlseq.elc lisp/riece-debug.elc	       \
+lisp/riece-develop.elc lisp/riece-display.elc lisp/riece-doctor.elc    \
+lisp/riece-epg.elc lisp/riece-eval-ruby.elc lisp/riece-eval.elc	       \
+lisp/riece-filter.elc lisp/riece-foolproof.elc lisp/riece-globals.elc  \
+lisp/riece-google.elc lisp/riece-guess.elc lisp/riece-handle.elc       \
+lisp/riece-hangman.elc lisp/riece-highlight.elc lisp/riece-history.elc \
+lisp/riece-icon.elc lisp/riece-identity.elc lisp/riece-ignore.elc      \
+lisp/riece-irc.elc lisp/riece-kakasi.elc lisp/riece-keepalive.elc      \
+lisp/riece-keyword.elc lisp/riece-layout.elc lisp/riece-log.elc	       \
+lisp/riece-lsdb.elc lisp/riece-menu.elc lisp/riece-message.elc	       \
+lisp/riece-mini.elc lisp/riece-misc.elc lisp/riece-mode.elc	       \
+lisp/riece-naming.elc lisp/riece-options.elc			       \
+lisp/riece-package-info.elc lisp/riece-rdcc.elc lisp/riece-ruby.elc    \
+lisp/riece-server.elc lisp/riece-shrink-buffer.elc		       \
+lisp/riece-signal.elc lisp/riece-toolbar.elc lisp/riece-unread.elc     \
+lisp/riece-url.elc lisp/riece-user.elc lisp/riece-version.elc	       \
+lisp/riece-xemacs.elc lisp/riece-xface.elc lisp/riece-xfaceb.elc       \
+lisp/riece-yank.elc
 
 EXTRA_SOURCES = lisp/riece-emacs.el lisp/riece-ndcc.el \
-	lisp/riece-skk-kakutei.el lisp/url-riece.el
+	lisp/riece-skk-kakutei.el lisp/riece-mcat.el \
+	lisp/riece-mcat-japanese.el lisp/riece-package-info.el.in \
+	lisp/url-riece.el
 AUTOLOAD_PATH = lisp
 
 EXPLICIT_DOCS = doc/riece-en.texi
 ifeq ($(BUILD_WITHOUT_MULE),)
 EXPLICIT_DOCS += doc/riece-ja.texi
-ELCS += lisp/riece-skk-kakutei.elc
+ELCS += lisp/riece-skk-kakutei.elc lisp/riece-mcat.elc \
+	lisp/riece-mcat-japanese.elc
 endif
 
 PRELOADS = -eval \("push \"./lisp\" load-path"\)
+* Major changes in 3.1.2
+
+** Message catalog. (ueno)
+
+* Major changes in 3.1.1
+
+** riece-async works again. (ueno)
+
+** riece-shrink-buffer is now enabled by default. (ueno)
+
+** New window layout "spiral". (URABE Shyouhei)
+
+* Major changes in 3.1.0
+
+** Prevent reentrace of message handlers.  This might fix some long
+   standing bug in message handling. (ueno)
+
+** Removed dependency on the calc package from riece-ndcc.el. (ueno)
+
+** Fixed a bug in the 353 message handler. (ueno)
+
+* Major changes in 3.0.0
+
+** Changed the meaning of riece-username.  If you set this option, you
+   will need to set riece-realname instead. (ueno)
+
+** Cause an error if a user requests to close already closed server. (yoichi)
+
+** New add-on riece-epg.el, which enables secure conversation using
+   GnuPG. (ueno)
+
+** Fixed a couple of bugs in inviting users. (Steve Youngs)
+
+** Fixed a redisplay bug when a user leaves a channel. (ueno)
+
+** Reverted the default value of riece-alias-alternate-separator to
+   "@". (ueno)
+
 * Major changes in 2.0.2
 
 ** Fixed C-c l (riece-command-list) behavior.  It didn't display
 ** Don't alter case of user/channel names when completing user
    input. (ueno)
 
+** Changed default value of alternate separator of a channel name and an
+   IRC server name to "%". (ueno)
+
 * Major changes in 2.0.1
 
 ** If there is a message in previously selected channel, Riece 2.0.0
+* Riece 3.1.1 $B$N<g$JJQ99E@(B
+
+** riece-async $B$r:F$SF0:n$9$k$h$&$K$7$?(B (ueno)
+
+** riece-shrink-buffer $B$r%G%U%)%k%H$GM-8z$K$7$?(B (ueno)
+
+** $B?75,%&%#%s%I%&%l%$%"%&%H(B "spiral" $B$rDI2C(B (URABE Shyouhei)
+
+* Riece 3.1.0 $B$N<g$JJQ99E@(B
+
+** $B%a%C%;!<%8%O%s%I%i$N:FF~6X;_$K$7$?(B (ueno)
+
+** riece-ndcc.el $B$,(B calc $B$K0MB8$7$J$$$h$&$K$7$?(B (ueno)
+
+** 353 $B%O%s%I%i$N%P%0$N=$@5(B (ueno)
+
+* Riece 3.0.0 $B$N<g$JJQ99E@(B
+
+** $BJQ?t(B riece-username $B$N0UL#$rJQ99(B (ueno)
+   $B$3$NJQ?t$r@_Dj$7$F$$$k%f!<%6$O!"(Briece-realname $B$KJQ?tL>$rJQ99$9$kI,(B
+   $BMW$,$"$k!#(B
+
+** $B@ZCG:Q$_$N%5!<%P$r:FEY@ZCG$7$h$&$H$7$?>l9g$K!"%(%i!<$K$J$k$h$&$K$7(B
+   $B$?(B (yoichi)
+
+** $B?75,%"%I%*%s(B riece-epg.el $B$rF3F~!#(BGnuPG $B$r;H$C$?0BA4$J2qOC$,2DG=(B (ueno)
+
+** $B%f!<%6$r>7BT(B (invite) $B$9$k:]$N%P%0$r(B 2 $B$D=$@5(B (Steve Youngs)
+
+** $B%f!<%6$,%A%c%s%M%k$rN%C&$7$?>lLL$G$N!":FIA2h$N%P%0$r=$@5(B (ueno)
+
+** riece-alias-alternate-separator $B$N%G%U%)%k%HCM$r(B "@" $B$KLa$7$?(B (ueno)
+
 * Riece 2.0.2 $B$N<g$JJQ99E@(B
 
 ** C-c l (riece-command-list) $B$G!"%A%c%s%M%k$N%H%T%C%/$NBe$o$j$K;22C<T(B
 ** $B%K%C%/%M!<%`$d%A%c%s%M%kL>$NJd408uJd$NI=<($GBgJ8;z>.J8;z$rJ]B8$9$k(B
    $B$h$&$K$7$?(B (ueno)
 
+** $B%A%c%s%M%kL>$H%5!<%PL>$N6h@Z$jJ8;zNs$N%G%U%)%k%HCM$r(B "@" $B$+$i(B "%" 
+   $B$KJQ99(B (ueno)
+
 * Riece 2.0.1 $B$N<g$JJQ99E@(B
 
 ** $BD>A0$KA*Br$7$F$$$?%A%c%s%M%k$KL$FI%a%C%;!<%8$,$"$k>l9g$K(B unread $B%^!<(B

File configure.ac

 AC_INIT
 AC_CONFIG_SRCDIR([configure.ac])
 AC_PREREQ(2.59)
-AM_INIT_AUTOMAKE(riece, 2.0.2)
+AM_INIT_AUTOMAKE(riece, 3.1.2)
 
 AC_CHECK_EMACS
 AC_PATH_LISPDIR
 
 AC_CONFIG_FILES([Makefile
 lisp/Makefile
+lisp/riece-package-info.el
 lisp/test/Makefile
 doc/Makefile])
 AC_OUTPUT

File doc/infohack.el

 
 ;; 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.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 

File doc/ptexinfmt.el

 
 ;; 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.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 

File doc/riece-en.texi

 @setfilename riece-en.info
 @settitle Riece -- An IRC client for Emacsen --
 @c %**end of header
-@set VERSION 2.0.2
+@include version-en.texi
 @c @documentlanguage en
 
 @dircategory GNU Emacs Lisp

File doc/riece-ja.texi

 @setfilename riece-ja.info
 @settitle Riece -- An IRC client for Emacsen --
 @c %**end of header
-@set VERSION 2.0.2
+@include version-ja.texi
 @c @documentlanguage ja
 
 @dircategory GNU Emacs Lisp
 @ifinfo
 This file describes Riece.
 
-Copyright (C) 2003,2004,2005 Daiki Ueno.
+Copyright (C) 2003,2004,2005,2006 Daiki Ueno.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1 or
 @page
 
 @vskip 0pt plus 1filll
-Copyright @copyright{} 2003,2004,2005 Daiki Ueno.
+Copyright @copyright{} 2003,2004,2005,2006 Daiki Ueno.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1 or
 @samp{foo} $B$H$$$&L>A0$N(B IRC $B%5!<%P$N%[%9%HL>$O(B @samp{irc.example.com} $B$G!";HMQ$9$kJ8;z%3!<%I$O(B Shift_JIS
 
 @item
-@samp{bar} $B$H$$$&L>A0$N(B IRC $B%5!<%P$N%[%9%HL>$O(B @samp{irc.example.com} $B$G!"$3$N%5!<%P$G$O%K%C%/%M!<%`(B @samp{baz} $B$r;H$&(B
+@samp{bar} $B$H$$$&L>A0$N(B IRC $B%5!<%P$N%[%9%HL>$O(B @samp{irc.example.net} $B$G!"$3$N%5!<%P$G$O%K%C%/%M!<%`(B @samp{baz} $B$r;H$&(B
 @end itemize
 
 $B;XDj$G$-$k%-!<%o!<%I$N0lMw$O0J2<$NDL$j$G$9!#(B
 
 $B4{$KFCDj$N%5!<%P$K@\B3$7$F$$$k>uBV$G!"JL$N%5!<%P$K@\B3$9$k$K$O(B @kbd{C-c O} (@code{riece-command-open-server}) $B$r;H$$$^$9!#(B
 
-$BJL$N%5!<%P>e$N%A%c%s%M%k$K;22C$9$k$K$O!"(B@kbd{C-c j} (@code{riece-command-join})$B$G%A%c%s%M%kL>$K%5!<%PL>$rB3$1$^$9!#(B
+$BJL$N%5!<%P>e$N%A%c%s%M%k$K;22C$9$k$K$O!"(B@kbd{C-c j}
+(@code{riece-command-join})$B$G%A%c%s%M%kL>$K(B @samp{@@} $B$KB3$$$F%5!<%PL>$r(B
+$BB3$1$^$9!#(B
 
-$B$?$H$($P!"%5!<%P(B @samp{irc.freenode.net} $B>e$N(B @samp{#Riece} $B$O<!$N$h$&$KI=5-$7$^$9!#(B
+$B$?$H$($P!"%5!<%P(B @samp{irc.freenode.net} $B>e$N(B @samp{#Riece} $B$O<!$N$h$&(B
+$B$KI=5-$7$^$9!#(B
 
 @example
 #Riece@@irc.freenode.net
 @end example
 
+$B%A%c%s%M%kL>$H%5!<%P$N6h@Z$jJ8;z(B @samp{@@} $B$O(B
+$BJQ?t(B @code{riece-alias-alternate-separator} $B$GJQ99$G$-$^$9!#(B
+
+$B$^$?$O!"6uGrJ8;z$G$bBeMQ$G$-$^$9!#$3$N;~$K$O!"(B@kbd{C-q SPC} $B$HF~NO$9$k(B
+$BI,MW$,$"$j$^$9!#(B
+
 $BJ#?t$N@\B3$rA`:n$9$k%3%^%s%I$r0J2<$K$^$H$a$^$9!#(B
 
 @table @kbd
 @node Add-ons,  , Connecting to multiple servers, Advanced usage
 @section Add-ons
 
-Riece $B$G$O!"%f!<%6$,?7$?$J5!G=$rDI2C$7!"<+M3$K<h$j30$7$G$-$k$h$&!"%"%I%*(B
-$B%s$H8F$P$l$k5!9=$rMQ0U$7$F$$$^$9!#%"%I%*%s$ODL>o$N(B elisp $B%b%8%e!<%k$r3H(B
-$BD%$7$?$b$N$G!"%m!<%I$N=gHV$@$1$G$O$J$/!"=i4|2==hM}$N0MB84X78$b5-=R$9$k$3(B
-$B$H$,$G$-$^$9!#(B
+Riece $B$G$O!";(B?$J5!G=$rA*BrE*$KMxMQ$G$-$k$h$&!"%"%I%*%s$H8F$P$l$k5!9=(B
+$B$rMQ0U$7$F$$$^$9!#%"%I%*%s$ODL>o$N(B elisp $B%b%8%e!<%k$r3HD%$7$?$b$N$G!"(B
+$B0BA4$J<h$j30$7$d!"%"%I%*%s4V$N=i4|2==hM}$N0MB84X78$J$I$NLLE]$r$_$^$9!#(B
 
-$B8=:_!"0J2<$N%b%8%e!<%k$,%"%I%*%s$H$7$F<BAu$5$l$F$$$^$9!'(B
+$B%"%I%*%s$K$O<!$N;M<oN`$N>uBV$,$"$j$^$9!#(B
+
+@table @asis
+@item unloaded
+$BFI$_9~$_A0!#%"%I%*%s$N(B elisp $B%b%8%e!<%k$,FI$_9~$^$l$F$$$J$$>uBV(B
+
+@item insinuated
+$BAH$_9~$_:Q$_!#%"%I%*%s$N(B elisp $B%b%8%e!<%k$,FI$_9~$^$l!"=i4|2==hM}$,40N;$7$?>uBV(B
+
+@item enabled
+$BM-8z!#%"%I%*%s$,F0:nCf(B
+
+@item disabled
+$BL58z!#%"%I%*%s$NF0:n$,Dd;_Cf(B
+
+@end table
+
+@menu
+* Add-on browser::              $B%"%I%*%s$N0lMwI=<((B
+* Available add-ons::           $BI8=`E:IU$N%"%I%*%s$N>R2p(B
+@end menu
+
+@node Add-on browser, Available add-ons, Add-ons, Add-ons
+@subsection Add-on browser
+
+Riece $B$NF0:nCf$K%"%I%*%s$N0lMw$rD/$a$k$K$O%"%I%*%s%V%i%&%6$r;H$&$HJXMx$G$9!#(B
+$B%3%^%s%I%P%C%U%!$G(B @kbd{C-c ^} $B$H$9$k$H!"<!$N$h$&$KI=<($5$l$^$9!#(B
+
+@example
++ riece-alias         Define aliases for IRC names.
+  riece-async         Connect to IRC server via async proxy.
+  riece-biff          Be notified if messages arrives.
++ riece-button        Display useful buttons in IRC buffers.
++ riece-ctcp          CTCP (Client To Client Protocol) support.
++ riece-ctlseq        Mark up control sequences in IRC buffers.
+@end example
+
+$B3F9T$N:8C<$N%^!<%/$O%"%I%*%s$N>uBV$rI=$o$7$F$$$^$9!#(B@samp{+} $B$OAH9~$^(B
+$B$l$FM-8z$J%"%I%*%s!"6uGr$O%m!<%I$5$l$F$$$J$$%"%I%*%s$G$9!#(B
+
+$B$3$3$G!"(Briece-button $B$rL58z$K$7$?$$>l9g!";M9TL\$N@hF,$G(B @kbd{-} $B$H$7$^(B
+$B$9!#$9$k$H!"@hF,$N%^!<%/$,(B @samp{+} $B$+$i(B @samp{-} $B$KJQ2=$7$^$9!#(B
+
+@example
++ riece-alias         Define aliases for IRC names.
+  riece-async         Connect to IRC server via async proxy.
+  riece-biff          Be notified if messages arrives.
+- riece-button        Display useful buttons in IRC buffers.
++ riece-ctcp          CTCP (Client To Client Protocol) support.
++ riece-ctlseq        Mark up control sequences in IRC buffers.
+@end example
+
+$B$5$i$K!"(B@samp{u} $B$H$9$k$H!"(Briece-button $B$r%"%I%*%s$N@_Dj$+$i=|30$7$^$9!#(B
+$B$5$i$K!"(B@samp{U} $B$H$9$k$H!"(Briece-button $B$r40A4$K%"%s%m!<%I$7$^$9!#(B
+
+$B$3$N>uBV$G!"(B@samp{s} $B$^$?$O(B @samp{M-x riece-command-save-variables} $B$H(B
+$B$9$k$H!"@_Dj$rJ]B8$7$^$9!#(B
+
+@file{~/.riece/init} $B$G%"%I%*%s$rAH$_9~$`$K$O(B @code{riece-addons} $B$r@_(B
+$BDj$7$^$9!#$?$H$($P(B @samp{riece-alias} $B$rAH$_9~$`>l9g$K$O!"0J2<$N$h$&$K(B
+$B5-=R$7$^$9!#(B
+@vindex riece-addons
+
+@example
+(add-to-list 'riece-addons 'riece-mini)
+@end example
+
+@node Available add-ons,  , Add-on browser, Add-ons
+@subsection Available add-ons
+
+$BMxMQ2DG=$J%"%I%*%s$O<!$NDL$j$G$9!#$3$l$i$N$&$A$NB?$/$OI8=`$GAH$_9~$^$l(B
+$B$F$$$^$9!#(B
 
 @table @samp
-@item riece-highlight
-$B%P%C%U%!$N?'IU$1(B
-@item riece-ctcp
-CTCP (Client To Client Protocol)
-@item riece-url
-$B2qOC$K8=$l$?(B URL $B$N<}=8(B
-@item riece-unread
-$BH/8@$N$"$C$?%A%c%s%M%k$K(B@samp{!}$B%^!<%/$r$D$1$k(B
-@item riece-rdcc
-DCC (Direct Client to Client protocol) $B$K$h$k%U%!%$%kE>Aw(B
-(Ruby $B$K$h$k<BAu(B)
-@item riece-ndcc
-DCC (Direct Client to Client protocol) $B$K$h$k%U%!%$%kE>Aw(B
-(Emacs 21.3 $B$N(B make-network-process $B$K$h$k<BAu(B)
-@item riece-mini
-$B%_%K%P%C%U%!$N$_$G(B IRC $B$r$9$k(B
-@item riece-log
-$B2qOC$N%m%0$N<}=8(B
-@item riece-doctor
-doctor.el $B$HO"7H$7$F@:?@2J0e$K$J$j$9$^$9(B
 @item riece-alias
 $B%A%c%s%M%kL>$d%K%C%/%M!<%`$NJLL>$rDj5A(B
-@item riece-skk-kakutei
-SKK $B;HMQ;~$KJQ49%b!<%I$N0u$rH/8@$+$i<h$j=|$/(B
-@item riece-foolproof
-$B%A%c%s%M%k%_%9$rKI$0(B
-@item riece-guess
-$B?'!9$JJ}K!$G0\F0@h$N%A%c%s%M%k$r?dB,(B
-@item riece-history
-$B%A%c%s%M%k0\F0$NMzNr4IM}(B
-@item riece-button
-$B%\%?%s$d%]%C%W%"%C%W%a%K%e!<$NI=<((B
-@item riece-keyword
-$B%-!<%o!<%I$N6/D4I=<((B
-@item riece-menu
-$B%a%K%e!<%P!<$K%a%K%e!<$rEPO?(B
 @item riece-async
 Emacs $B$,(B busy or suspend $B>uBV$K$J$k$3$H$KHw$(!"(B
 PING $B$K1~Ez$9$k(B local proxy $B7PM3$G(B IRC $B%5!<%P$K@\B3(B
+@item riece-biff
+$BB>$N%P%C%U%!$K$$$k;~$KH/8@$,$"$k$H%b!<%I%i%$%s$K0u(B ("[R]") $B$rI=<((B
+@item riece-button
+$B%\%?%s$d%]%C%W%"%C%W%a%K%e!<$NI=<((B
+@item riece-ctcp
+CTCP (Client To Client Protocol)
+@item riece-ctlseq
+$B%3%s%H%m!<%k%7!<%1%s%9(B (^B $B$J$I(B) $B$K$h$k6/D4I=<((B
+@item riece-doctor
+doctor.el $B$HO"7H$7$F@:?@2J0e$K$J$j$9$^$9(B
+@item riece-epg
+EasyPG @uref{http://www.easypg.org} $B$K$h$k2qOC$N0E9f2=(B
+@item riece-eval-ruby
+$BF~NO$5$l$?J8;zNs$r(B Ruby $B$N<0$H$7$FI>2A(B
+@item riece-eval
+$BF~NO$5$l$?J8;zNs$r(B Emacs Lisp $B$N<0$H$7$FI>2A(B
+@item riece-foolproof
+$B%A%c%s%M%k%_%9$rKI$0(B
+@item riece-google
+$B%-!<%o!<%I$r(B Google $B$G8!:w(B
+@item riece-guess
+$B?'!9$JJ}K!$G0\F0@h$N%A%c%s%M%k$r?dB,(B
+@item reice-hangman
+$B%A%c%s%M%kFb$G(B hangman $B$GM7$V(B
+@item riece-highlight
+$B%P%C%U%!$N?'IU$1(B
+@item riece-history
+$B%A%c%s%M%k0\F0$NMzNr4IM}(B
+@item riece-icon
+$B%P%C%U%!Cf$K%"%$%3%s$rI=<((B
+@item riece-ignore
+$B;XDj$7$?%f!<%6$NH/8@$rL5;k(B
+@item riece-kakasi
+$BF|K\8l$NDL$i$J$$C<Kv$G!"F|K\8l$r%m!<%^;z$GI=<((B
+@item riece-keepalive
+IRC $B%5!<%P$H$N@\B3$rJ];}(B
+@item riece-keyword
+$B%-!<%o!<%I$N6/D4I=<((B
+@item riece-log
+$B2qOC$N%m%0$r%U%!%$%k$KJ]B8(B
 @item riece-lsdb
 $B%"%I%l%9D"(B LSDB (Lovely Sister Database)
 @uref{http://lsdb.sourceforge.jp} $B$HO"7H(B
+@item riece-mcat
+$B%a%C%;!<%8%+%?%m%0(B
+@item riece-menu
+$B%a%K%e!<%P!<$K%a%K%e!<$rEPO?(B
+@item riece-mini
+$B%_%K%P%C%U%!$N$_$G(B IRC $B$r$9$k(B
+@item riece-ndcc
+DCC (Direct Client to Client protocol) $B$K$h$k%U%!%$%kE>Aw(B
+(Emacs 22 $B$G$N$_F0:n(B)
+@item riece-rdcc
+DCC (Direct Client to Client protocol) $B$K$h$k%U%!%$%kE>Aw(B
+@item riece-shrink-buffer
+$B%a%b%j3NJ]$N$?$a!"%P%C%U%!$rDj4|E*$K@Z$j5M$a$k(B
+@item riece-skk-kakutei
+SKK $B;HMQ;~$KJQ49%b!<%I$N0u$rH/8@$+$i<h$j=|$/(B
+@item riece-toolbar
+$B%D!<%k%P!<$rI=<((B
+@item riece-unread
+$BH/8@$N$"$C$?%A%c%s%M%k$K(B@samp{!}$B%^!<%/$r$D$1$k(B
+@item riece-url
+$B2qOC$K8=$l$?(B URL $B$N<}=8(B
 @item riece-xface
 $B%f!<%6%j%9%H%P%C%U%!$K%f!<%6$N(B X-Face $B$rI=<((B
-@item riece-ctlseq
-$B%3%s%H%m!<%k%7!<%1%s%9(B (^B $B$J$I(B) $B$K$h$k6/D4I=<((B
-@item riece-ignore
-$B;XDj$7$?%f!<%6$NH/8@$rL5;k(B
-@item reice-hangman
-$B%A%c%s%M%kFb$G(B hangman(6) $B$GM7$V(B
-@item riece-biff
-$BB>$N%P%C%U%!$K$$$k;~$KH/8@$,$"$k$H%b!<%I%i%$%s$K0u(B ("[R]") $B$rI=<((B
-@item riece-kakasi
-$BF|K\8l$NDL$i$J$$C<Kv$G!"F|K\8l$r%m!<%^;z$GI=<((B
+@item riece-xfaceb
+$B%f!<%6%j%9%H%P%C%U%!$K%f!<%6$N(B X-Face $B$rI=<((B
+(BBDB @uref{http://bbdb.sourceforge.net} $B$,I,MW(B)
 @item riece-yank
 @kbd{C-c y} $B$G(B kill-ring $B$+$iJ8;zNs$rAw?.(B
-@item riece-toolbar
-$B%D!<%k%P!<$rI=<((B
-@item riece-eval
-$BF~NO$5$l$?J8;zNs$r(B lisp $B%*%V%8%'%/%H$H$7$FI>2A(B
-@item riece-google
-$B%-!<%o!<%I$r(B Google $B$G8!:w(B
-@item riece-keepalive
-IRC $B%5!<%P$H$N@\B3$rJ];}(B
-@item riece-eval-ruby
-$BF~NO$5$l$?J8;zNs$r(B Ruby $B$N<0$H$7$FI>2A(B
 @end table
 
-$B$3$l$i$N$&$A!"(B@samp{riece-highlight} $B$H(B @samp{riece-ctcp}$B!"(B
-@samp{riece-url}$B!"(B @samp{riece-unread}$B!"(B @samp{riece-guess}$B!"(B
-@samp{riece-history}$B!"(B @samp{riece-button}$B!"(B@samp{riece-menu}$B!"(B
-@samp{riece-ignore}$B!"(B@samp{riece-log}$B!"(B@samp{riece-alias}$B!"(B
-@samp{riece-ctlseq}$B!"(B@samp{riece-keyword} $B$OI8=`$GAH$_9~$^$l$F$$$^$9!#(B
-
-$B%"%I%*%s$rAH$_9~$`$K$O(B @code{riece-addons} $B$r@_Dj$7$^$9!#$?$H$($P(B 
-@samp{riece-alias} $B$rAH$_9~$`>l9g$K$O!"(B@file{~/.riece/init} $B$K0J2<$N$h(B
-$B$&$K5-=R$7$^$9!#(B
-@vindex riece-addons
-
-@example
-(add-to-list 'riece-addons 'riece-keyword)
-@end example
-
 @node Tips, Index, Advanced usage, Top
 @comment  node-name,  next,  previous,  up
 @chapter Tips
      '("#Riece" "#public" ("#private" "password")))
 @end example
 
-$B5/F0;~$K!"J#?t$N(B IRC $B%5!<%P$N%A%c%s%M%k$K;22C$9$k>l9g$K$O!"(B
-$BJQ?t(B @samp{riece-startup-server-list} $B$bF1;~$K@_Dj$9$kI,MW$,$"$j$^$9!#(B
-
 @section $B5/F0;~$K<+F0E*$KJ#?t$N(B IRC $B%5!<%P$K@\B3$7$?$$(B
 @vindex riece-startup-server-list
 
                            ("freenode" :host "irc.ipv6.freenode.net")))
 @end example
 
-$B$3$N@_DjNc$G$O!"5/F0;~$K(B "ircnet" $B$K@\B3$7$^$9!#(B
+$B$3$N@_DjNc$G$O!"5/F0;~$K@\B3$9$k$N$O(B "ircnet" $B$@$1$G$9!#(B
 @samp{riece-startup-server-list} $B$r0J2<$N$h$&$K@_Dj$9$k$H!"(B
 "freenode" $B$K$b@\B3$9$k$h$&$K$J$j$^$9!#(B
 
 (setq riece-startup-server-list '("freenode"))
 @end example
 
-$B5/F0;~$K!"J#?t$N(B IRC $B%5!<%P$N%A%c%s%M%k$K;22C$9$k>l9g$K$O!"(B
-$BJQ?t(B @samp{riece-startup-channel-list} $B$bF1;~$K@_Dj$9$kI,MW$,$"$j$^$9!#(B
-
 @section HTTP $B%W%m%-%7$r2p$7$F(B IRC $B%5!<%P$K@\B3$7$?$$(B
 @file{relay.el} $B$H(B @file{connect.c} $B$r;H$&$H!"(B
 HTTP $B%W%m%-%7$r2p$7$F(B IRC $B%5!<%P$K@\B3$9$k$3$H$,$G$-$^$9!#(B

File doc/texinfo.tex

 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2000-12-12.07}
-%
-% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
-% Free Software Foundation, Inc.
+\def\texinfoversion{2005-07-05.19}
+%
+% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
+% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+% Foundation, Inc.
 %
 % This texinfo.tex file is free software; you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
 %
 % You should have received a copy of the GNU General Public License
 % along with this texinfo.tex file; see the file COPYING.  If not, write
-% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-% Boston, MA 02111-1307, USA.
-%
-% In other words, you are welcome to use, share and improve this program.
-% You are forbidden to forbid anyone else to use, share and improve
-% what you give them.   Help stamp out software-hoarding!
+% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+% Boston, MA 02110-1301, USA.
+%
+% As a special exception, when this file is read by TeX when processing
+% a Texinfo source document, you may use the result without
+% restriction.  (This has been our intent since Texinfo was invented.)
 %
 % Please try the latest version of texinfo.tex before submitting bug
 % reports; you can get the latest version from:
-%   ftp://ftp.gnu.org/gnu/texinfo.tex
-%   (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
-%   ftp://texinfo.org/tex/texinfo.tex
-%   ftp://us.ctan.org/macros/texinfo/texinfo.tex
-%   (and all CTAN mirrors, finger ctan@us.ctan.org for a list).
-%   /home/gd/gnu/doc/texinfo.tex on the GNU machines.
-% The texinfo.tex in any given Texinfo distribution could well be out
+%   http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
+%   ftp://tug.org/tex/texinfo.tex
+%     (and all CTAN mirrors, see http://www.ctan.org).
+% The texinfo.tex in any given distribution could well be out
 % of date, so if that's what you're using, please check.
-% Texinfo has a small home page at http://texinfo.org/.
 %
 % Send bug reports to bug-texinfo@gnu.org.  Please include including a
 % complete document in each bug report with which we can reproduce the
 %   texindex foo.??
 %   tex foo.texi
 %   tex foo.texi
-%   dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps.
-% The extra runs of TeX get the cross-reference information correct.
+%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
+% The extra TeX runs get the cross-reference information correct.
 % Sometimes one run after texindex suffices, and sometimes you need more
 % than two; texi2dvi does it as many times as necessary.
 %
-% It is possible to adapt texinfo.tex for other languages.  You can get
-% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/.
+% It is possible to adapt texinfo.tex for other languages, to some
+% extent.  You can get the existing language-specific files from the
+% full Texinfo distribution.
+%
+% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
+
 
 \message{Loading texinfo [version \texinfoversion]:}
 
 \everyjob{\message{[Texinfo version \texinfoversion]}%
   \catcode`+=\active \catcode`\_=\active}
 
-% Save some parts of plain tex whose names we will redefine.
+\message{Basics,}
+\chardef\other=12
+
+% We never want plain's \outer definition of \+ in Texinfo.
+% For @tex, we can use \tabalign.
+\let\+ = \relax
+
+% Save some plain tex macros whose names we will redefine.
 \let\ptexb=\b
 \let\ptexbullet=\bullet
 \let\ptexc=\c
 \let\ptexend=\end
 \let\ptexequiv=\equiv
 \let\ptexexclam=\!
+\let\ptexfootnote=\footnote
+\let\ptexgtr=>
+\let\ptexhat=^
 \let\ptexi=\i
+\let\ptexindent=\indent
+\let\ptexinsert=\insert
 \let\ptexlbrace=\{
+\let\ptexless=<
+\let\ptexnewwrite\newwrite
+\let\ptexnoindent=\noindent
+\let\ptexplus=+
 \let\ptexrbrace=\}
+\let\ptexslash=\/
 \let\ptexstar=\*
 \let\ptext=\t
 
-% We never want plain's outer \+ definition in Texinfo.
-% For @tex, we can use \tabalign.
-\let\+ = \relax
-
-\message{Basics,}
-\chardef\other=12
-
 % If this character appears in an error message or help string, it
 % starts a new line in the output.
 \newlinechar = `^^J
 
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+%
+\ifx\inputlineno\thisisundefined
+  \let\linenumber = \empty % Pre-3.0.
+\else
+  \def\linenumber{l.\the\inputlineno:\space}
+\fi
+
 % Set up fixed words for English if not already set.
 \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
 \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
 \ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
 \ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
 \ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
-\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
 \ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi
-\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
+
+% In some macros, we cannot use the `\? notation---the left quote is
+% in some cases the escape char.
+\chardef\backChar  = `\\
+\chardef\colonChar = `\:
+\chardef\commaChar = `\,
+\chardef\dotChar   = `\.
+\chardef\exclamChar= `\!
+\chardef\plusChar  = `\+
+\chardef\questChar = `\?
+\chardef\semiChar  = `\;
+\chardef\underChar = `\_
+
+\chardef\spaceChar = `\ %
+\chardef\spacecat = 10
+\def\spaceisspace{\catcode\spaceChar=\spacecat}
+
+{% for help with debugging.
+ % example usage: \expandafter\show\activebackslash
+ \catcode`\! = 0 \catcode`\\ = \active
+ !global!def!activebackslash{\}
+}
 
 % Ignore a token.
 %
 \def\gobble#1{}
 
-\hyphenation{ap-pen-dix}
-\hyphenation{mini-buf-fer mini-buf-fers}
-\hyphenation{eshell}
-\hyphenation{white-space}
+% The following is used inside several \edef's.
+\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
+
+% Hyphenation fixes.
+\hyphenation{
+  Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
+  ap-pen-dix bit-map bit-maps
+  data-base data-bases eshell fall-ing half-way long-est man-u-script
+  man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
+  par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
+  spell-ing spell-ings
+  stand-alone strong-est time-stamp time-stamps which-ever white-space
+  wide-spread wrap-around
+}
 
 % Margin to add to right of even pages, to left of odd pages.
-\newdimen \bindingoffset
-\newdimen \normaloffset
+\newdimen\bindingoffset
+\newdimen\normaloffset
 \newdimen\pagewidth \newdimen\pageheight
 
+% For a final copy, take out the rectangles
+% that mark overfull boxes (in case you have decided
+% that the text looks ok even though it passes the margin).
+%
+\def\finalout{\overfullrule=0pt}
+
+% @| inserts a changebar to the left of the current line.  It should
+% surround any changed text.  This approach does *not* work if the
+% change spans more than two lines of output.  To handle that, we would
+% have adopt a much more difficult approach (putting marks into the main
+% vertical list for the beginning and end of each change).
+%
+\def\|{%
+  % \vadjust can only be used in horizontal mode.
+  \leavevmode
+  %
+  % Append this vertical mode material after the current line in the output.
+  \vadjust{%
+    % We want to insert a rule with the height and depth of the current
+    % leading; that is exactly what \strutbox is supposed to record.
+    \vskip-\baselineskip
+    %
+    % \vadjust-items are inserted at the left edge of the type.  So
+    % the \llap here moves out into the left-hand margin.
+    \llap{%
+      %
+      % For a thicker or thinner bar, change the `1pt'.
+      \vrule height\baselineskip width1pt
+      %
+      % This is the space between the bar and the text.
+      \hskip 12pt
+    }%
+  }%
+}
+
 % Sometimes it is convenient to have everything in the transcript file
 % and nothing on the terminal.  We don't just call \tracingall here,
-% since that produces some useless output on the terminal.
+% since that produces some useless output on the terminal.  We also make
+% some effort to order the tracing commands to reduce output in the log
+% file; cf. trace.sty in LaTeX.
 %
 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
-\ifx\eTeXversion\undefined
-\def\loggingall{\tracingcommands2 \tracingstats2
-   \tracingpages1 \tracingoutput1 \tracinglostchars1
-   \tracingmacros2 \tracingparagraphs1 \tracingrestores1
-   \showboxbreadth\maxdimen\showboxdepth\maxdimen
+\def\loggingall{%
+  \tracingstats2
+  \tracingpages1
+  \tracinglostchars2  % 2 gives us more in etex
+  \tracingparagraphs1
+  \tracingoutput1
+  \tracingmacros2
+  \tracingrestores1
+  \showboxbreadth\maxdimen \showboxdepth\maxdimen
+  \ifx\eTeXversion\undefined\else % etex gives us more logging
+    \tracingscantokens1
+    \tracingifs1
+    \tracinggroups1
+    \tracingnesting2
+    \tracingassigns1
+  \fi
+  \tracingcommands3  % 3 gives us more in etex
+  \errorcontextlines16
 }%
-\else
-\def\loggingall{\tracingcommands3 \tracingstats2
-   \tracingpages1 \tracingoutput1 \tracinglostchars1
-   \tracingmacros2 \tracingparagraphs1 \tracingrestores1
-   \tracingscantokens1 \tracingassigns1 \tracingifs1
-   \tracinggroups1 \tracingnesting2
-   \showboxbreadth\maxdimen\showboxdepth\maxdimen
-}%
-\fi
+
+% add check for \lastpenalty to plain's definitions.  If the last thing
+% we did was a \nobreak, we don't want to insert more space.
+%
+\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
+  \removelastskip\penalty-50\smallskip\fi\fi}
+\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
+  \removelastskip\penalty-100\medskip\fi\fi}
+\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
+  \removelastskip\penalty-200\bigskip\fi\fi}
 
 % For @cropmarks command.
 % Do @cropmarks to get crop marks.
     % take effect in \write's, yet the group defined by the \vbox ends
     % before the \shipout runs.
     %
-    \escapechar = `\\     % use backslash in output files.
     \indexdummies         % don't expand commands in the output.
-    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
-                   % the page break happens to be in the middle of an example.
     \shipout\vbox{%
       % Do this early so pdf references go to the beginning of the page.
-      \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
+      \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
       %
       \ifcropmarks \vbox to \outervsize\bgroup
         \hsize = \outerhsize
       \egroup % \vbox from first cropmarks clause
       \fi
     }% end of \shipout\vbox
-  }% end of group with \turnoffactive
+  }% end of group with \indexdummies
   \advancepageno
   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
 }
 % the input line (except we remove a trailing comment).  #1 should be a
 % macro which expects an ordinary undelimited TeX argument.
 %
-\def\parsearg#1{%
-  \let\next = #1%
+\def\parsearg{\parseargusing{}}
+\def\parseargusing#1#2{%
+  \def\next{#2}%
   \begingroup
     \obeylines
-    \futurelet\temp\parseargx
-}
-
-% If the next token is an obeyed space (from an @example environment or
-% the like), remove it and recurse.  Otherwise, we're done.
-\def\parseargx{%
-  % \obeyedspace is defined far below, after the definition of \sepspaces.
-  \ifx\obeyedspace\temp
-    \expandafter\parseargdiscardspace
-  \else
-    \expandafter\parseargline
-  \fi
-}
-
-% Remove a single space (as the delimiter token to the macro call).
-{\obeyspaces %
- \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
+    \spaceisspace
+    #1%
+    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
+}
 
 {\obeylines %
   \gdef\parseargline#1^^M{%
     \endgroup % End of the group started in \parsearg.
-    %
-    % First remove any @c comment, then any @comment.
-    % Result of each macro is put in \toks0.
-    \argremovec #1\c\relax %
-    \expandafter\argremovecomment \the\toks0 \comment\relax %
-    %
-    % Call the caller's macro, saved as \next in \parsearg.
-    \expandafter\next\expandafter{\the\toks0}%
+    \argremovecomment #1\comment\ArgTerm%
   }%
 }
 
-% Since all \c{,omment} does is throw away the argument, we can let TeX
-% do that for us.  The \relax here is matched by the \relax in the call
-% in \parseargline; it could be more or less anything, its purpose is
-% just to delimit the argument to the \c.
-\def\argremovec#1\c#2\relax{\toks0 = {#1}}
-\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
-
-% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
+% First remove any @comment, then any @c comment.
+\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
+\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
+
+% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
+%
+% \argremovec might leave us with trailing space, e.g.,
 %    @end itemize  @c foo
-% will have two active spaces as part of the argument with the
-% `itemize'.  Here we remove all active spaces from #1, and assign the
-% result to \toks0.
-%
-% This loses if there are any *other* active characters besides spaces
-% in the argument -- _ ^ +, for example -- since they get expanded.
-% Fortunately, Texinfo does not define any such commands.  (If it ever
-% does, the catcode of the characters in questionwill have to be changed
-% here.)  But this means we cannot call \removeactivespaces as part of
-% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
-% that \parsearg gets might well have any character at all in it.
-%
-\def\removeactivespaces#1{%
-  \begingroup
-    \ignoreactivespaces
-    \edef\temp{#1}%
-    \global\toks0 = \expandafter{\temp}%
-  \endgroup
-}
-
-% Change the active space to expand to nothing.
-%
-\begingroup
+% This space token undergoes the same procedure and is eventually removed
+% by \finishparsearg.
+%
+\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
+\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
+\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
+  \def\temp{#3}%
+  \ifx\temp\empty
+    % We cannot use \next here, as it holds the macro to run;
+    % thus we reuse \temp.
+    \let\temp\finishparsearg
+  \else
+    \let\temp\argcheckspaces
+  \fi
+  % Put the space token in:
+  \temp#1 #3\ArgTerm
+}
+
+% If a _delimited_ argument is enclosed in braces, they get stripped; so
+% to get _exactly_ the rest of the line, we had to prevent such situation.
+% We prepended an \empty token at the very beginning and we expand it now,
+% just before passing the control to \next.
+% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
+% either the null string, or it ends with \^^M---thus there is no danger
+% that a pair of braces would be stripped.
+%
+% But first, we have to remove the trailing space token.
+%
+\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}
+
+% \parseargdef\foo{...}
+%	is roughly equivalent to
+% \def\foo{\parsearg\Xfoo}
+% \def\Xfoo#1{...}
+%
+% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
+% favourite TeX trick.  --kasal, 16nov03
+
+\def\parseargdef#1{%
+  \expandafter \doparseargdef \csname\string#1\endcsname #1%
+}
+\def\doparseargdef#1#2{%
+  \def#2{\parsearg#1}%
+  \def#1##1%
+}
+
+% Several utility definitions with active space:
+{
   \obeyspaces
-  \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
-\endgroup
+  \gdef\obeyedspace{ }
+
+  % Make each space character in the input produce a normal interword
+  % space in the output.  Don't allow a line break at this space, as this
+  % is used only in environments like @example, where each line of input
+  % should produce a line of output anyway.
+  %
+  \gdef\sepspaces{\obeyspaces\let =\tie}
+
+  % If an index command is used in an @example environment, any spaces
+  % therein should become regular spaces in the raw index file, not the
+  % expansion of \tie (\leavevmode \penalty \@M \ ).
+  \gdef\unsepspaces{\let =\space}
+}
 
 
 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
 
-%% These are used to keep @begin/@end levels from running away
-%% Call \inENV within environments (after a \begingroup)
-\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
-\def\ENVcheck{%
-\ifENV\errmessage{Still within an environment; press RETURN to continue}
-\endgroup\fi} % This is not perfect, but it should reduce lossage
-
-% @begin foo  is the same as @foo, for now.
+% Define the framework for environments in texinfo.tex.  It's used like this:
+%
+%   \envdef\foo{...}
+%   \def\Efoo{...}
+%
+% It's the responsibility of \envdef to insert \begingroup before the
+% actual body; @end closes the group after calling \Efoo.  \envdef also
+% defines \thisenv, so the current environment is known; @end checks
+% whether the environment name matches.  The \checkenv macro can also be
+% used to check whether the current environment is the one expected.
+%
+% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
+% are not treated as enviroments; they don't open a group.  (The
+% implementation of @end takes care not to call \endgroup in this
+% special case.)
+
+
+% At runtime, environments start with this:
+\def\startenvironment#1{\begingroup\def\thisenv{#1}}
+% initialize
+\let\thisenv\empty
+
+% ... but they get defined via ``\envdef\foo{...}'':
+\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
+\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
+
+% Check whether we're in the right environment:
+\def\checkenv#1{%
+  \def\temp{#1}%
+  \ifx\thisenv\temp
+  \else
+    \badenverr
+  \fi
+}
+
+% Evironment mismatch, #1 expected:
+\def\badenverr{%
+  \errhelp = \EMsimple
+  \errmessage{This command can appear only \inenvironment\temp,
+    not \inenvironment\thisenv}%
+}
+\def\inenvironment#1{%
+  \ifx#1\empty
+    out of any environment%
+  \else
+    in environment \expandafter\string#1%
+  \fi
+}
+
+% @end foo executes the definition of \Efoo.
+% But first, it executes a specialized version of \checkenv
+%
+\parseargdef\end{%
+  \if 1\csname iscond.#1\endcsname
+  \else
+    % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
+    \expandafter\checkenv\csname#1\endcsname
+    \csname E#1\endcsname
+    \endgroup
+  \fi
+}
+
 \newhelp\EMsimple{Press RETURN to continue.}
 
-\outer\def\begin{\parsearg\beginxxx}
-
-\def\beginxxx #1{%
-\expandafter\ifx\csname #1\endcsname\relax
-{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
-\csname #1\endcsname\fi}
-
-% @end foo executes the definition of \Efoo.
-%
-\def\end{\parsearg\endxxx}
-\def\endxxx #1{%
-  \removeactivespaces{#1}%
-  \edef\endthing{\the\toks0}%
-  %
-  \expandafter\ifx\csname E\endthing\endcsname\relax
-    \expandafter\ifx\csname \endthing\endcsname\relax
-      % There's no \foo, i.e., no ``environment'' foo.
-      \errhelp = \EMsimple
-      \errmessage{Undefined command `@end \endthing'}%
-    \else
-      \unmatchedenderror\endthing
-    \fi
-  \else
-    % Everything's ok; the right environment has been started.
-    \csname E\endthing\endcsname
-  \fi
-}
-
-% There is an environment #1, but it hasn't been started.  Give an error.
-%
-\def\unmatchedenderror#1{%
-  \errhelp = \EMsimple
-  \errmessage{This `@end #1' doesn't have a matching `@#1'}%
-}
-
-% Define the control sequence \E#1 to give an unmatched @end error.
-%
-\def\defineunmatchedend#1{%
-  \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
-}
-
-
-% Single-spacing is done by various environments (specifically, in
-% \nonfillstart and \quotations).
-\newskip\singlespaceskip \singlespaceskip = 12.5pt
-\def\singlespace{%
-  % Why was this kern here?  It messes up equalizing space above and below
-  % environments.  --karl, 6may93
-  %{\advance \baselineskip by -\singlespaceskip
-  %\kern \baselineskip}%
-  \setleading \singlespaceskip
-}
 
 %% Simple single-character @ commands
 
 \let\{=\mylbrace
 \let\}=\myrbrace
 \begingroup
-  % Definitions to produce actual \{ & \} command in an index.
-  \catcode`\{ = 12 \catcode`\} = 12
+  % Definitions to produce \{ and \} commands for indices,
+  % and @{ and @} for the aux/toc files.
+  \catcode`\{ = \other \catcode`\} = \other
   \catcode`\[ = 1 \catcode`\] = 2
-  \catcode`\@ = 0 \catcode`\\ = 12
-  @gdef@lbracecmd[\{]%
-  @gdef@rbracecmd[\}]%
-@endgroup
+  \catcode`\! = 0 \catcode`\\ = \other
+  !gdef!lbracecmd[\{]%
+  !gdef!rbracecmd[\}]%
+  !gdef!lbraceatcmd[@{]%
+  !gdef!rbraceatcmd[@}]%
+!endgroup
+
+% @comma{} to avoid , parsing problems.
+\let\comma = ,
 
 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
-% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
+% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
 \let\, = \c
 \let\dotaccent = \.
 \def\ringaccent#1{{\accent23 #1}}
 \let\ubaraccent = \b
 \let\udotaccent = \d
 
-% Other special characters: @questiondown @exclamdown
-% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
+% Other special characters: @questiondown @exclamdown @ordf @ordm
+% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
 \def\questiondown{?`}
 \def\exclamdown{!`}
+\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
+\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
 
 % Dotless i and dotless j, used for accents.
 \def\imacro{i}
   \fi\fi
 }
 
+% The \TeX{} logo, as in plain, but resetting the spacing so that a
+% period following counts as ending a sentence.  (Idea found in latex.)
+%
+\edef\TeX{\TeX \spacefactor=1000 }
+
+% @LaTeX{} logo.  Not quite the same results as the definition in
+% latex.ltx, since we use a different font for the raised A; it's most
+% convenient for us to use an explicitly smaller font, rather than using
+% the \scriptstyle font (since we don't reset \scriptstyle and
+% \scriptscriptstyle).
+%
+\def\LaTeX{%
+  L\kern-.36em
+  {\setbox0=\hbox{T}%
+   \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
+  \kern-.15em
+  \TeX
+}
+
 % Be sure we're in horizontal mode when doing a tie, since we make space
 % equivalent to this in @example-like environments. Otherwise, a space
 % at the beginning of a line will start with \penalty -- and
 % @* forces a line break.
 \def\*{\hfil\break\hbox{}\ignorespaces}
 
+% @/ allows a line break.
+\let\/=\allowbreak
+
 % @. is an end-of-sentence period.
-\def\.{.\spacefactor=3000 }
+\def\.{.\spacefactor=\endofsentencespacefactor\space}
 
 % @! is an end-of-sentence bang.
-\def\!{!\spacefactor=3000 }
+\def\!{!\spacefactor=\endofsentencespacefactor\space}
 
 % @? is an end-of-sentence query.
-\def\?{?\spacefactor=3000 }
+\def\?{?\spacefactor=\endofsentencespacefactor\space}
+
+% @frenchspacing on|off  says whether to put extra space after punctuation.
+% 
+\def\onword{on}
+\def\offword{off}
+%
+\parseargdef\frenchspacing{%
+  \def\temp{#1}%
+  \ifx\temp\onword \plainfrenchspacing
+  \else\ifx\temp\offword \plainnonfrenchspacing
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @frenchspacing option `\temp', must be on/off}%
+  \fi\fi
+}
 
 % @w prevents a word break.  Without the \leavevmode, @w at the
 % beginning of a paragraph, when TeX is still in vertical mode, would
 % therefore, no glue is inserted, and the space between the headline and
 % the text is small, which looks bad.
 %
-\def\group{\begingroup
-  \ifnum\catcode13=\active \else
+% Another complication is that the group might be very large.  This can
+% cause the glue on the previous page to be unduly stretched, because it
+% does not have much material.  In this case, it's better to add an
+% explicit \vfill so that the extra space is at the bottom.  The
+% threshold for doing this is if the group is more than \vfilllimit
+% percent of a page (\vfilllimit can be changed inside of @tex).
+%
+\newbox\groupbox
+\def\vfilllimit{0.7}
+%
+\envdef\group{%
+  \ifnum\catcode`\^^M=\active \else
     \errhelp = \groupinvalidhelp
     \errmessage{@group invalid in context where filling is enabled}%
   \fi
-  %
-  % The \vtop we start below produces a box with normal height and large
-  % depth; thus, TeX puts \baselineskip glue before it, and (when the
-  % next line of text is done) \lineskip glue after it.  (See p.82 of
-  % the TeXbook.)  Thus, space below is not quite equal to space
-  % above.  But it's pretty close.
-  \def\Egroup{%
-    \egroup           % End the \vtop.
-    \endgroup         % End the \group.
-  }%
-  %
-  \vtop\bgroup
-    % We have to put a strut on the last line in case the @group is in
-    % the midst of an example, rather than completely enclosing it.
-    % Otherwise, the interline space between the last line of the group
-    % and the first line afterwards is too small.  But we can't put the
-    % strut in \Egroup, since there it would be on a line by itself.
-    % Hence this just inserts a strut at the beginning of each line.
-    \everypar = {\strut}%
-    %
-    % Since we have a strut on every line, we don't need any of TeX's
-    % normal interline spacing.
-    \offinterlineskip
-    %
-    % OK, but now we have to do something about blank
-    % lines in the input in @example-like environments, which normally
-    % just turn into \lisppar, which will insert no space now that we've
-    % turned off the interline space.  Simplest is to make them be an
-    % empty paragraph.
-    \ifx\par\lisppar
-      \edef\par{\leavevmode \par}%
-      %
-      % Reset ^^M's definition to new definition of \par.
-      \obeylines
-    \fi
-    %
+  \startsavinginserts
+  %
+  \setbox\groupbox = \vtop\bgroup
     % Do @comment since we are called inside an environment such as
     % @example, where each end-of-line in the input causes an
     % end-of-line in the output.  We don't want the end-of-line after
     \comment
 }
 %
+% The \vtop produces a box with normal height and large depth; thus, TeX puts
+% \baselineskip glue before it, and (when the next line of text is done)
+% \lineskip glue after it.  Thus, space below is not quite equal to space
+% above.  But it's pretty close.
+\def\Egroup{%
+    % To get correct interline space between the last line of the group
+    % and the first line afterwards, we have to propagate \prevdepth.
+    \endgraf % Not \par, as it may have been set to \lisppar.
+    \global\dimen1 = \prevdepth
+  \egroup           % End the \vtop.
+  % \dimen0 is the vertical size of the group's box.
+  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
+  % \dimen2 is how much space is left on the page (more or less).
+  \dimen2 = \pageheight   \advance\dimen2 by -\pagetotal
+  % if the group doesn't fit on the current page, and it's a big big
+  % group, force a page break.
+  \ifdim \dimen0 > \dimen2
+    \ifdim \pagetotal < \vfilllimit\pageheight
+      \page
+    \fi
+  \fi
+  \box\groupbox
+  \prevdepth = \dimen1
+  \checkinserts
+}
+%
 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
 % message, so this ends up printing `@group can only ...'.
 %
 
 \newdimen\mil  \mil=0.001in
 
-\def\need{\parsearg\needx}
-
 % Old definition--didn't work.
-%\def\needx #1{\par %
+%\parseargdef\need{\par %
 %% This method tries to make TeX break the page naturally
 %% if the depth of the box does not fit.
 %{\baselineskip=0pt%
 %\prevdepth=-1000pt
 %}}
 
-\def\needx#1{%
+\parseargdef\need{%
   % Ensure vertical mode, so we don't make a big box in the middle of a
   % paragraph.
   \par
   \fi
 }
 
-% @br   forces paragraph break
+% @br   forces paragraph break (and is undocumented).
 
 \let\br = \par
 
-% @dots{} output an ellipsis using the current font.
-% We do .5em per period so that it has the same spacing in a typewriter
-% font as three actual period characters.
-%
-\def\dots{%
-  \leavevmode
-  \hbox to 1.5em{%
-    \hskip 0pt plus 0.25fil minus 0.25fil
-    .\hss.\hss.%
-    \hskip 0pt plus 0.5fil minus 0.5fil
-  }%
-}
-
-% @enddots{} is an end-of-sentence ellipsis.
-%
-\def\enddots{%
-  \leavevmode
-  \hbox to 2em{%
-    \hskip 0pt plus 0.25fil minus 0.25fil
-    .\hss.\hss.\hss.%
-    \hskip 0pt plus 0.5fil minus 0.5fil
-  }%
-  \spacefactor=3000
-}
-
-
-% @page    forces the start of a new page
+% @page forces the start of a new page.
 %
 \def\page{\par\vfill\supereject}
 
 \newskip\exdentamount
 
 % This defn is used inside fill environments such as @defun.
-\def\exdent{\parsearg\exdentyyy}
-\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
+\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
 
 % This defn is used inside nofill environments such as @example.
-\def\nofillexdent{\parsearg\nofillexdentyyy}
-\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
-\leftline{\hskip\leftskip{\rm#1}}}}
+\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
+  \leftline{\hskip\leftskip{\rm#1}}}}
 
 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
 % paragraph.  For more general purposes, use the \margin insertion
 % @inmargin{TEXT [, RIGHT-TEXT]}
 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
 % else use TEXT for both).
-% 
+%
 \def\inmargin#1{\parseinmargin #1,,\finish}
 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
-  \setbox0 = \hbox{\ignorespaces #2}% 
+  \setbox0 = \hbox{\ignorespaces #2}%
   \ifdim\wd0 > 0pt
     \def\lefttext{#1}%  have both texts
     \def\righttext{#2}%
 }
 
 % @include file    insert text of that file as input.
-% Allow normal characters that  we make active in the argument (a file name).
-\def\include{\begingroup
-  \catcode`\\=12
-  \catcode`~=12
-  \catcode`^=12
-  \catcode`_=12
-  \catcode`|=12
-  \catcode`<=12
-  \catcode`>=12
-  \catcode`+=12
-  \parsearg\includezzz}
-% Restore active chars for included file.
-\def\includezzz#1{\endgroup\begingroup
-  % Read the included file in a group so nested @include's work.
+%
+\def\include{\parseargusing\filenamecatcodes\includezzz}
+\def\includezzz#1{%
+  \pushthisfilestack
   \def\thisfile{#1}%
-  \input\thisfile
-\endgroup}
+  {%
+    \makevalueexpandable
+    \def\temp{\input #1 }%
+    \expandafter
+  }\temp
+  \popthisfilestack
+}
+\def\filenamecatcodes{%
+  \catcode`\\=\other
+  \catcode`~=\other
+  \catcode`^=\other
+  \catcode`_=\other
+  \catcode`|=\other
+  \catcode`<=\other
+  \catcode`>=\other
+  \catcode`+=\other
+  \catcode`-=\other
+}
+
+\def\pushthisfilestack{%
+  \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
+}
+\def\pushthisfilestackX{%
+  \expandafter\pushthisfilestackY\thisfile\StackTerm
+}
+\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
+  \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
+}
+
+\def\popthisfilestack{\errthisfilestackempty}
+\def\errthisfilestackempty{\errmessage{Internal error:
+  the stack of filenames is empty.}}
 
 \def\thisfile{}
 
-% @center line   outputs that line, centered
-
-\def\center{\parsearg\centerzzz}
-\def\centerzzz #1{{\advance\hsize by -\leftskip
-\advance\hsize by -\rightskip
-\centerline{#1}}}
+% @center line
+% outputs that line, centered.
+%
+\parseargdef\center{%
+  \ifhmode
+    \let\next\centerH
+  \else
+    \let\next\centerV
+  \fi
+  \next{\hfil \ignorespaces#1\unskip \hfil}%
+}
+\def\centerH#1{%
+  {%
+    \hfil\break
+    \advance\hsize by -\leftskip
+    \advance\hsize by -\rightskip
+    \line{#1}%
+    \break
+  }%
+}
+\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
 
 % @sp n   outputs n lines of vertical space
 
-\def\sp{\parsearg\spxxx}
-\def\spxxx #1{\vskip #1\baselineskip}
+\parseargdef\sp{\vskip #1\baselineskip}
 
 % @comment ...line which is ignored...
 % @c is the same as @comment
 
 % @paragraphindent NCHARS
 % We'll use ems for NCHARS, close enough.
-% We cannot implement @paragraphindent asis, though.
-% 
+% NCHARS can also be the word `asis' or `none'.
+% We cannot feasibly implement @paragraphindent asis, though.
+%
 \def\asisword{asis} % no translation, these are keywords
 \def\noneword{none}
 %
-\def\paragraphindent{\parsearg\doparagraphindent}
-\def\doparagraphindent#1{%
+\parseargdef\paragraphindent{%
   \def\temp{#1}%
   \ifx\temp\asisword
   \else
 % We'll use ems for NCHARS like @paragraphindent.
 % It seems @exampleindent asis isn't necessary, but
 % I preserve it to make it similar to @paragraphindent.
-\def\exampleindent{\parsearg\doexampleindent}
-\def\doexampleindent#1{%
+\parseargdef\exampleindent{%
   \def\temp{#1}%
   \ifx\temp\asisword
   \else
   \fi
 }
 
+% @firstparagraphindent WORD
+% If WORD is `none', then suppress indentation of the first paragraph
+% after a section heading.  If WORD is `insert', then do indent at such
+% paragraphs.
+%
+% The paragraph indentation is suppressed or not by calling
+% \suppressfirstparagraphindent, which the sectioning commands do.
+% We switch the definition of this back and forth according to WORD.
+% By default, we suppress indentation.
+%
+\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
+\def\insertword{insert}
+%
+\parseargdef\firstparagraphindent{%
+  \def\temp{#1}%
+  \ifx\temp\noneword
+    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
+  \else\ifx\temp\insertword
+    \let\suppressfirstparagraphindent = \relax
+  \else
+    \errhelp = \EMsimple
+    \errmessage{Unknown @firstparagraphindent option `\temp'}%
+  \fi\fi
+}
+
+% Here is how we actually suppress indentation.  Redefine \everypar to
+% \kern backwards by \parindent, and then reset itself to empty.
+%
+% We also make \indent itself not actually do anything until the next
+% paragraph.
+%
+\gdef\dosuppressfirstparagraphindent{%
+  \gdef\indent{%
+    \restorefirstparagraphindent
+    \indent
+  }%
+  \gdef\noindent{%
+    \restorefirstparagraphindent
+    \noindent
+  }%
+  \global\everypar = {%
+    \kern -\parindent
+    \restorefirstparagraphindent
+  }%
+}
+
+\gdef\restorefirstparagraphindent{%
+  \global \let \indent = \ptexindent
+  \global \let \noindent = \ptexnoindent
+  \global \everypar = {}%
+}
+
+
 % @asis just yields its argument.  Used with @table, for example.
 %
 \def\asis#1{#1}
 
-% @math means output in math mode.
-% We don't use $'s directly in the definition of \math because control
-% sequences like \math are expanded when the toc file is written.  Then,
-% we read the toc file back, the $'s will be normal characters (as they
-% should be, according to the definition of Texinfo).  So we must use a
-% control sequence to switch into and out of math mode.
-%
-% This isn't quite enough for @math to work properly in indices, but it
-% seems unlikely it will ever be needed there.
-%
-\let\implicitmath = $
-\def\math#1{\implicitmath #1\implicitmath}
+% @math outputs its argument in math mode.
+%
+% One complication: _ usually means subscripts, but it could also mean
+% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
+% _ active, and distinguish by seeing if the current family is \slfam,
+% which is what @var uses.
+{
+  \catcode\underChar = \active
+  \gdef\mathunderscore{%
+    \catcode\underChar=\active
+    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
+  }
+}
+% Another complication: we want \\ (and @\) to output a \ character.
+% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
+% this is not advertised and we don't care.  Texinfo does not
+% otherwise define @\.
+%
+% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
+\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
+%
+\def\math{%
+  \tex
+  \mathunderscore
+  \let\\ = \mathbackslash
+  \mathactive
+  $\finishmath
+}
+\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.
+
+% Some active characters (such as <) are spaced differently in math.
+% We have to reset their definitions in case the @math was an argument
+% to a command which sets the catcodes (such as @item or @section).
+%
+{
+  \catcode`^ = \active
+  \catcode`< = \active
+  \catcode`> = \active
+  \catcode`+ = \active
+  \gdef\mathactive{%
+    \let^ = \ptexhat
+    \let< = \ptexless
+    \let> = \ptexgtr
+    \let+ = \ptexplus
+  }
+}
 
 % @bullet and @minus need the same treatment as @math, just above.
-\def\bullet{\implicitmath\ptexbullet\implicitmath}
-\def\minus{\implicitmath-\implicitmath}
+\def\bullet{$\ptexbullet$}
+\def\minus{$-$}
+
+% @dots{} outputs an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in a typewriter
+% font as three actual period characters.
+%
+\def\dots{%
+  \leavevmode
+  \hbox to 1.5em{%
+    \hskip 0pt plus 0.25fil
+    .\hfil.\hfil.%
+    \hskip 0pt plus 0.5fil
+  }%
+}
+
+% @enddots{} is an end-of-sentence ellipsis.
+%
+\def\enddots{%
+  \dots
+  \spacefactor=\endofsentencespacefactor
+}
+
+% @comma{} is so commas can be inserted into text without messing up
+% Texinfo's parsing.
+%
+\let\comma = ,
 
 % @refill is a no-op.
 \let\refill=\relax
 % So open here the files we need to have open while reading the input.
 % This makes it possible to make a .fmt file for texinfo.
 \def\setfilename{%
+   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
    \iflinks
-     \readauxfile
+     \tryauxfile
+     % Open the new aux file.  TeX will close it automatically at exit.
+     \immediate\openout\auxfile=\jobname.aux
    \fi % \openindices needs to do some work in any case.
    \openindices
-   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
-   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
+   \let\setfilename=\comment % Ignore extra @setfilename cmds.
    %
    % If texinfo.cnf is present on the system, read it.
    % Useful for site-wide @afourpaper, etc.
-   % Just to be on the safe side, close the input stream before the \input.
    \openin 1 texinfo.cnf
-   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
-   \closein1
-   \temp
+   \ifeof 1 \else \input texinfo.cnf \fi
+   \closein 1
    %
    \comment % Ignore the actual filename.
 }
 \newif\ifpdf
 \newif\ifpdfmakepagedest
 
+% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
+% can be set).  So we test for \relax and 0 as well as \undefined,
+% borrowed from ifpdf.sty.
 \ifx\pdfoutput\undefined
-  \pdffalse
-  \let\pdfmkdest = \gobble
-  \let\pdfurl = \gobble
-  \let\endlink = \relax
-  \let\linkcolor = \relax
-  \let\pdfmakeoutlines = \relax
 \else
-  \pdftrue
-  \pdfoutput = 1
+  \ifx\pdfoutput\relax
+  \else
+    \ifcase\pdfoutput
+    \else
+      \pdftrue
+    \fi
+  \fi
+\fi
+
+% PDF uses PostScript string constants for the names of xref targets, to
+% for display in the outlines, and in other places.  Thus, we have to
+% double any backslashes.  Otherwise, a name like "\node" will be
+% interpreted as a newline (\n), followed by o, d, e.  Not good.
+% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
+% (and related messages, the final outcome is that it is up to the TeX
+% user to double the backslashes and otherwise make the string valid, so
+% that's we do).
+
+% double active backslashes.
+% 
+{\catcode`\@=0 \catcode`\\=\active
+ @gdef@activebackslash{@catcode`@\=@active @otherbackslash}
+ @gdef@activebackslashdouble{%
+   @catcode@backChar=@active
+   @let\=@doublebackslash}
+}
+
+% To handle parens, we must adopt a different approach, since parens are
+% not active characters.  hyperref.dtx (which has the same problem as
+% us) handles it with this amazing macro to replace tokens.  I've
+% tinkered with it a little for texinfo, but it's definitely from there.
+% 
+% #1 is the tokens to replace.
+% #2 is the replacement.
+% #3 is the control sequence with the string.
+% 
+\def\HyPsdSubst#1#2#3{%
+  \def\HyPsdReplace##1#1##2\END{%
+    ##1%
+    \ifx\\##2\\%
+    \else
+      #2%
+      \HyReturnAfterFi{%
+        \HyPsdReplace##2\END
+      }%
+    \fi
+  }%
+  \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
+}
+\long\def\HyReturnAfterFi#1\fi{\fi#1}
+
+% #1 is a control sequence in which to do the replacements.
+\def\backslashparens#1{%
+  \xdef#1{#1}% redefine it as its expansion; the definition is simply
+             % \lastnode when called from \setref -> \pdfmkdest.
+  \HyPsdSubst{(}{\backslashlparen}{#1}%
+  \HyPsdSubst{)}{\backslashrparen}{#1}%
+}
+
+{\catcode\exclamChar = 0 \catcode\backChar = \other
+ !gdef!backslashlparen{\(}%
+ !gdef!backslashrparen{\)}%
+}
+
+\ifpdf
   \input pdfcolor
+  \pdfcatalog{/PageMode /UseOutlines}%
   \def\dopdfimage#1#2#3{%
     \def\imagewidth{#2}%
     \def\imageheight{#3}%
+    % without \immediate, pdftex seg faults when the same image is
+    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
     \ifnum\pdftexversion < 14
-      \pdfimage
+      \immediate\pdfimage
     \else
-      \pdfximage
+      \immediate\pdfximage
     \fi
       \ifx\empty\imagewidth\else width \imagewidth \fi
       \ifx\empty\imageheight\else height \imageheight \fi
-      {#1.pdf}%
+      \ifnum\pdftexversion<13
+         #1.pdf%
+       \else
+         {#1.pdf}%
+       \fi
     \ifnum\pdftexversion < 14 \else
       \pdfrefximage \pdflastximage
     \fi}
-  \def\pdfmkdest#1{\pdfdest name{#1@} xyz}
-  \def\pdfmkpgn#1{#1@}
+  \def\pdfmkdest#1{{%
+    % We have to set dummies so commands such as @code, and characters
+    % such as \, aren't expanded when present in a section title.
+    \atdummies
+    \activebackslashdouble
+    \def\pdfdestname{#1}%
+    \backslashparens\pdfdestname
+    \pdfdest name{\pdfdestname} xyz%
+  }}%
+  %
+  % used to mark target names; must be expandable.
+  \def\pdfmkpgn#1{#1}%
+  %
   \let\linkcolor = \Blue  % was Cyan, but that seems light?
   \def\endlink{\Black\pdfendlink}
   % Adding outlines to PDF; macros for calculating structure of outlines
   \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
     \else \csname#1\endcsname \fi}
   \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
-    \advance\tempnum by1
+    \advance\tempnum by 1
     \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
-  \def\pdfmakeoutlines{{%
-    \openin 1 \jobname.toc
-    \ifeof 1\else\bgroup
-      \closein 1 
-      \indexnofonts
-      \def\tt{}
-      \let\_ = \normalunderscore
-      % Thanh's hack / proper braces in bookmarks  
+  %
+  % #1 is the section text, which is what will be displayed in the
+  % outline by the pdf viewer.  #2 is the pdf expression for the number
+  % of subentries (or empty, for subsubsections).  #3 is the node text,
+  % which might be empty if this toc entry had no corresponding node.
+  % #4 is the page number
+  %
+  \def\dopdfoutline#1#2#3#4{%
+    % Generate a link to the node text if that exists; else, use the
+    % page number.  We could generate a destination for the section
+    % text in the case where a section has no node, but it doesn't
+    % seem worth the trouble, since most documents are normally structured.
+    \def\pdfoutlinedest{#3}%
+    \ifx\pdfoutlinedest\empty
+      \def\pdfoutlinedest{#4}%
+    \else
+      % Doubled backslashes in the name.
+      {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
+       \backslashparens\pdfoutlinedest}%
+    \fi
+    %
+    % Also double the backslashes in the display string.
+    {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
+     \backslashparens\pdfoutlinetext}%
+    %
+    \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
+  }
+  %
+  \def\pdfmakeoutlines{%
+    \begingroup
+      % Thanh's hack / proper braces in bookmarks
       \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
       \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
       %
-      \def\chapentry ##1##2##3{}
-      \def\unnumbchapentry ##1##2{}
-      \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
-      \def\unnumbsecentry ##1##2{}
-      \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
-      \def\unnumbsubsecentry ##1##2{}
-      \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
-      \def\unnumbsubsubsecentry ##1##2{}
+      % Read toc silently, to get counts of subentries for \pdfoutline.
+      \def\numchapentry##1##2##3##4{%
+	\def\thischapnum{##2}%
+	\def\thissecnum{0}%
+	\def\thissubsecnum{0}%
+      }%
+      \def\numsecentry##1##2##3##4{%
+	\advancenumber{chap\thischapnum}%
+	\def\thissecnum{##2}%
+	\def\thissubsecnum{0}%
+      }%
+      \def\numsubsecentry##1##2##3##4{%
+	\advancenumber{sec\thissecnum}%
+	\def\thissubsecnum{##2}%
+      }%
+      \def\numsubsubsecentry##1##2##3##4{%
+	\advancenumber{subsec\thissubsecnum}%
+      }%
+      \def\thischapnum{0}%
+      \def\thissecnum{0}%
+      \def\thissubsecnum{0}%
+      %
+      % use \def rather than \let here because we redefine \chapentry et
+      % al. a second time, below.
+      \def\appentry{\numchapentry}%
+      \def\appsecentry{\numsecentry}%
+      \def\appsubsecentry{\numsubsecentry}%
+      \def\appsubsubsecentry{\numsubsubsecentry}%
+      \def\unnchapentry{\numchapentry}%
+      \def\unnsecentry{\numsecentry}%
+      \def\unnsubsecentry{\numsubsecentry}%
+      \def\unnsubsubsecentry{\numsubsubsecentry}%
+      \readdatafile{toc}%
+      %
+      % Read toc second time, this time actually producing the outlines.
+      % The `-' means take the \expnumber as the absolute number of
+      % subentries, which we calculated on our first read of the .toc above.
+      %
+      % We use the node names as the destinations.
+      \def\numchapentry##1##2##3##4{%
+        \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
+      \def\numsecentry##1##2##3##4{%
+        \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
+      \def\numsubsecentry##1##2##3##4{%
+        \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
+      \def\numsubsubsecentry##1##2##3##4{% count is always zero
+        \dopdfoutline{##1}{}{##3}{##4}}%
+      %
+      % PDF outlines are displayed using system fonts, instead of
+      % document fonts.  Therefore we cannot use special characters,
+      % since the encoding is unknown.  For example, the eogonek from
+      % Latin 2 (0xea) gets translated to a | character.  Info from
+      % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
+      %
+      % xx to do this right, we have to translate 8-bit characters to
+      % their "best" equivalent, based on the @documentencoding.  Right
+      % now, I guess we'll just let the pdf reader have its way.
+      \indexnofonts
+      \setupdatafile
+      \activebackslash
       \input \jobname.toc
-      \def\chapentry ##1##2##3{%
-        \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
-      \def\unnumbchapentry ##1##2{%
-        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
-      \def\secentry ##1##2##3##4{%
-        \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
-      \def\unnumbsecentry ##1##2{%
-        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
-      \def\subsecentry ##1##2##3##4##5{%
-        \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
-      \def\unnumbsubsecentry ##1##2{%
-        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
-      \def\subsubsecentry ##1##2##3##4##5##6{%
-        \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
-      \def\unnumbsubsubsecentry ##1##2{%
-        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
-      \input \jobname.toc
-    \egroup\fi
-  }}
-  \def\makelinks #1,{%
-    \def\params{#1}\def\E{END}%
-    \ifx\params\E
-      \let\nextmakelinks=\relax
-    \else
-      \let\nextmakelinks=\makelinks
-      \ifnum\lnkcount>0,\fi
-      \picknum{#1}%
-      \startlink attr{/Border [0 0 0]} 
-        goto name{\pdfmkpgn{\the\pgn}}%
-      \linkcolor #1%
-      \advance\lnkcount by 1%
-      \endlink
-    \fi
-    \nextmakelinks
+    \endgroup
   }
-  \def\picknum#1{\expandafter\pn#1}
-  \def\pn#1{%
-    \def\p{#1}%
-    \ifx\p\lbrace
-      \let\nextpn=\ppn
-    \else
-      \let\nextpn=\ppnn
-      \def\first{#1}
-    \fi
-    \nextpn
-  }
-  \def\ppn#1{\pgn=#1\gobble}
-  \def\ppnn{\pgn=\first}
-  \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
-  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+  %
   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
     \ifx\PP\D\let\nextsp\relax
     \else\let\nextsp\skipspaces
   \def\pdfurl#1{%
     \begingroup
       \normalturnoffactive\def\@{@}%
+      \makevalueexpandable
       \leavevmode\Red