Synch up with the trunk.
authorueno <ueno>
Sun, 28 Aug 2005 07:39:05 +0000 (07:39 +0000)
committerueno <ueno>
Sun, 28 Aug 2005 07:39:05 +0000 (07:39 +0000)
72 files changed:
AUTHORS
ChangeLog
NEWS
NEWS.ja
README
README.ja
acinclude.m4
doc/HACKING [new file with mode: 0644]
doc/HACKING.ja [new file with mode: 0644]
doc/Makefile.am
doc/riece-ja.texi
lisp/COMPILE
lisp/ChangeLog
lisp/Makefile.am
lisp/aproxy.rb [new file with mode: 0644]
lisp/riece-300.el
lisp/riece-addon-modules.el [new file with mode: 0644]
lisp/riece-addon.el
lisp/riece-alias.el
lisp/riece-async.el
lisp/riece-biff.el
lisp/riece-button.el
lisp/riece-coding.el
lisp/riece-commands.el
lisp/riece-ctcp.el
lisp/riece-ctlseq.el
lisp/riece-debug.el
lisp/riece-display.el
lisp/riece-doctor.el
lisp/riece-emacs.el
lisp/riece-eval-ruby.el [new file with mode: 0644]
lisp/riece-eval.el
lisp/riece-filter.el
lisp/riece-foolproof.el
lisp/riece-globals.el
lisp/riece-google.el
lisp/riece-guess.el
lisp/riece-hangman.el
lisp/riece-highlight.el
lisp/riece-history.el
lisp/riece-icon.el
lisp/riece-identity.el
lisp/riece-ignore.el
lisp/riece-irc.el
lisp/riece-kakasi.el
lisp/riece-keepalive.el
lisp/riece-keyword.el
lisp/riece-layout.el
lisp/riece-log.el
lisp/riece-lsdb.el
lisp/riece-menu.el
lisp/riece-message.el
lisp/riece-mini.el
lisp/riece-ndcc.el
lisp/riece-options.el
lisp/riece-rdcc.el
lisp/riece-ruby.el
lisp/riece-server.el
lisp/riece-shrink-buffer.el [new file with mode: 0644]
lisp/riece-skk-kakutei.el
lisp/riece-toolbar.el
lisp/riece-unread.el
lisp/riece-url.el
lisp/riece-xemacs.el
lisp/riece-xface.el
lisp/riece-yank.el
lisp/riece.el
lisp/rubyserv.rb [deleted file]
lisp/server.rb [new file with mode: 0644]
lisp/test/test-riece-addon.el
lisp/test/test-riece-log.el
lisp/test/test-riece-ruby.el [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index 7f09ddc..ff3e9a9 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
-Copyright (C) 1998-2003 Daiki Ueno
+Copyright (C) 1998-2005 Daiki Ueno
 Copyright (C) 1989 Tor Lillqvist
 
 Riece is mainly written by Daiki Ueno <ueno@unixuser.org>.
@@ -10,9 +10,9 @@ written by the same author of Riece.  Tor Lillqvist <tml@iki.fi> is
 the original author of Irchat.  See doc/irchat-copyright.el for the
 original copyright statement of Irchat.
 
-Riece has code borrowed from other elisp packages such as Gnus,
-Emacs-w3m, ECB, and SEMI.  I would like to thank the developers of
-these packages.
+Riece has many code borrowed from other GPL'ed elisp packages such as
+Gnus, Emacs-w3m, ECB, and SEMI.  I would like to thank the developers
+of these packages.
 
 Other authors:
 
index e6d8657..ae848ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-08-06  Daiki Ueno  <ueno@unixuser.org>
+
+       * Makefile.am (EXTRA_DIST): Add HACKING.ja.
+
 2005-03-06  Daiki Ueno  <ueno@unixuser.org>
 
        * Riece: Version 1.0.8 released.
diff --git a/NEWS b/NEWS
index 8ad3a68..3289563 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,47 @@
+* Major changes in 2.0.0
+
+** Support uninstall, unload (dangerous) operations for add-ons.
+   Now you can fully customize riece-addons in the add-on listing
+   mode. (ueno)
+
+** New mechanism for executing Ruby programs.  To use it, see the
+   commentary section of riece-ruby.el. (ueno)
+
+** New add-on riece-eval-ruby.el, which regards user input prefixed by
+   ",ruby " as a Ruby program and sends the result to the current
+   channel. (ueno)
+
+** New add-on riece-shrink-buffer.el, which now takes care of periodic
+   buffer shrinking.  If you have set riece-max-buffer-size, you will
+   need to enable the riece-shrink-buffer add-on in the add-on listing
+   mode. (ueno)
+
+** Don't signal an error when a user is quitting, and who has joined a
+   channel where you left. (ueno)
+
+** When saving a log file, suffix the name of the coding-system used
+   onto the filename.  This will avoid mojibake even
+   riece-log-coding-system is not set. (ueno)
+
+** While traversing channel list with C-c g, offer channels in order
+   of precedence where they have newer unread messages. (ueno)
+
+** Allow "@" instead of " " as a separator of a channel name and an
+   IRC server name. (ueno)
+
+** Rewrite the Japanese manual (riece-ja.texi) for IRC & Emacs
+   newbies. (ueno)
+
+** Allow users to hide *Others* buffer. (ueno)
+
+** Use seperate buffer to store debugging output. (ueno)
+
+** Added new make rule for byte-compiling elisp files individually.
+   To use it, after configure, do "make compile-individually" in
+   lisp/.  (ueno)
+
+** Include a document for developers (doc/HACKING.ja) (ueno)
+
 * Major changes in 1.0.8
 
 ** Mitigate file locking scheme of riece-log. (ueno)
diff --git a/NEWS.ja b/NEWS.ja
index 140b1e4..256a388 100644 (file)
--- a/NEWS.ja
+++ b/NEWS.ja
@@ -1,3 +1,42 @@
+* Riece 2.0.0 \e$B$N<g$JJQ99E@\e(B
+
+** \e$B%"%I%*%s$N\e(B uninstall, unload (\e$B4m81\e(B) \e$B$KBP1~!#\e(B
+   \e$B%"%I%*%s0lMw%b!<%I$G\e(B riece-addons \e$B$N%+%9%?%^%$%:$,2DG=\e(B (ueno)
+
+** Ruby \e$B$N%W%m%0%i%`$rI>2A$9$k5!9=$NF3F~!#\e(B
+   \e$BMxMQJ}K!$O\e(B riece-ruby.el \e$BKAF,$N%3%a%s%H$r;2>H\e(B (ueno)
+
+** \e$B?75,%"%I%*%s\e(B riece-eval-ruby.el \e$B$rF3F~!#\e(B",ruby " \e$B$KB3$$$FG$0U$N\e(B 
+   Ruby \e$B$N%W%m%0%i%`$rH/8@$9$k$H!"I>2A7k2L$r%A%c%s%M%k$KAw?.$9$k\e(B (ueno)
+
+** \e$BDj4|E*$K%P%C%U%!$r@Z$j5M$a$k5!G=$r%"%I%*%s$KJ,N%\e(B
+   \e$B$3$l$^$G\e(B riece-max-buffer-size \e$B$r@_Dj$7$F$$$??M$O!"\e(B
+   riece-shrink-buffer \e$B%"%I%*%s$rM-8z$K$9$kI,MW$,$"$k$N$GCm0U\e(B (ueno)
+
+** \e$BN%C&$7$?%A%c%s%M%k$K;22C$7$F$$$?%f!<%6$,\e(B IRC \e$B$r$d$a$?>l9g$K!"%(%i!<\e(B
+   \e$B$,H/@8$9$kIT6q9g$N=$@5\e(B (ueno)
+
+** \e$B%m%0$NJ]B8;~$K!";HMQ$7$?\e(B coding-system \e$B$NL>A0$r%U%!%$%kL>$KKd$a9~$`\e(B
+   \e$B$h$&$K$7$?!#$3$l$K$h$j\e(B riece-log-coding-system \e$B$r@_Dj$7$J$/$F$bJ8;z\e(B
+   \e$B2=$1$,H/@8$7$K$/$/$J$C$?\e(B (ueno)
+
+** C-c g \e$B$G%A%c%s%M%k$r0\F0$9$k:]$K!"?7$7$$H/8@$,$"$C$?%A%c%s%M%k$+$i\e(B
+   \e$BC)$k$h$&$K$7$?\e(B (ueno)
+
+** \e$B%A%c%s%M%kL>$H%5!<%PL>$N6h@Z$jJ8;zNs$H$7$F\e(B " " \e$B0J30$K\e(B "@" \e$B$b5v$9$h\e(B
+   \e$B$&$K$7$?\e(B (ueno)
+
+** \e$BF|K\8l%^%K%e%"%k\e(B (riece-ja.texi) \e$B$r=i?4<T$rBP>]$K=q$-D>$7$?\e(B (ueno)
+
+** *Others* \e$B%P%C%U%!$r1#$;$k$h$&$K$7$?\e(B (ueno)
+
+** \e$B%G%P%C%0=PNO$r@lMQ$N%P%C%U%!$KJ,N%\e(B (ueno)
+
+** elisp \e$B%U%!%$%k$r#1$D$:$D\e(B byte-compile \e$B$9$k\e(B make \e$B%k!<%k$r@_$1$?!#\e(B
+   configure \e$B8e!"\e(Blisp/ \e$B0J2<$G\e(B make compile-individually (ueno)
+
+** \e$B3+H/<T8~$1$NJ8=q\e(B (doc/HACKING.ja) \e$B$rF1:-\e(B (ueno)
+
 * Riece 1.0.8 \e$B$N<g$JJQ99E@\e(B
 
 ** riece-log \e$B$N%m%C%/$N4KOB\e(B (ueno)
diff --git a/README b/README
index bf99db3..b80dfa7 100644 (file)
--- a/README
+++ b/README
@@ -24,28 +24,27 @@ doc/  - Documentation files.
 * Requirements
 
 - Emacs 20.7 or later / XEmacs 21.4 or later
-- Ruby 1.6 or later (optional)
+- Ruby 1.8 or later (optional)
 
 * Installation
 
 $ ./configure
 $ sudo make install
 
+Add the following line to your Emacs startup file such as ~/.emacs.
+
+  (autoload 'riece "riece" "Start Riece" t)
+
 If you are using XEmacs and want to install as a package, supply
 "--with-xemacs" option to the configure script and use
 "install-package" target instead of "install".
 
-* Bug reports
-
-If you write bug reports and/or suggestions for improvement, 
-please send them to the Liece Mailing List.
-
-This mailing list is also for other general discussions (about
-future enhancements, customization, etc). To join the Liece ML,
-send an e-mail to:
+* Manuals
 
-     liece-ctl@unixuser.org
+Info manuals are available after installation.  To read, start Emacs
+and type M-x info and select "Riece-en".
 
-with the message body, 
+* Bug reports
 
-     subscribe Your Name
+If you write a bug report, please send them to the Liece Mailing List
+(liece@unixuser.org).
index c7ba011..faa6686 100644 (file)
--- a/README.ja
+++ b/README.ja
@@ -5,7 +5,7 @@ Riece \e$B$O\e(B Emacs \e$B8~$1\e(B IRC \e$B%/%i%$%"%s%H$G$9!#\e(B
 Riece \e$B$K$O0J2<$K5s$2$kFCD9$,$"$j$^$9\e(B:
 
 - \e$BJ#?t$N\e(B IRC \e$B%5!<%P$KF1;~$K@\B32DG=\e(B
-- \e$B%"%I%*%s$K$h$j5!G=$NDI2C$d<h$j30$7$,2DG=\e(B
+- \e$B%"%I%*%s$K$h$j3HD%5!G=$NDI2C$d<h$j30$7$,2DG=\e(B
 - \e$BB>$N\e(B elisp \e$B%Q%C%1!<%8$K0MB8$7$J$$$?$a!"%$%s%9%H!<%k$,4JC1\e(B
 - \e$B@_Dj$,4JC1$G!"A02s5/F0;~$N@_Dj$r5-O?!&I|85$9$k;EAH$_$rDs6!\e(B
 - \e$BCJ3,E*$JA`:n@bL@=q\e(B (info \e$B7A<0\e(B) \e$B$,ImB0\e(B
@@ -20,29 +20,32 @@ doc/  - \e$BJ8=q%U%!%$%k\e(B
 
 * \e$BI,MW$J$b$N\e(B
 
-- Emacs 20.7 \e$B0J>e!"$^$?$O\e(B XEmacs 21.4 \e$B0J>e\e(B
-- Ruby 1.6 \e$B0J>e\e(B (\e$BG$0U\e(B)
+- Emacs 20.7 \e$B0J9_!"$^$?$O\e(B XEmacs 21.4 \e$B0J9_\e(B
+- Ruby 1.8 \e$B0J9_\e(B (\e$BG$0U\e(B)
 
 * \e$B%$%s%9%H!<%k\e(B
 
 $ ./configure
 $ sudo make install
 
-XEmacs \e$B$r;H$C$F$$$F!"%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$7$?$$>l9g$K$O!"\e(B
-"--with-xemacs" \e$B%*%W%7%g%s$r\e(B configure \e$B%9%/%j%W%H$KM?$($F$/$@$5$$!#\e(B
-\e$B$^$?!"\e(B"install" \e$B%?!<%2%C%H$NBe$o$j$K\e(B "install-package" \e$B$r;H$C$F$/$@$5$$!#\e(B
+~/.emacs \e$BEy$K0J2<$N0l9T$rDI2C$7$F$/$@$5$$!#\e(B
 
-* \e$B%P%0Js9p\e(B
+  (autoload 'riece "riece" "Start Riece" t)
 
-\e$B%P%0Js9p$d!"2~A1MW5a$r=q$$$?$i!"$I$&$>\e(B Liece \e$B%a!<%j%s%0%j%9%H$KAw$C$F$/$@$5$$!#\e(B
+XEmacs \e$B$G;H$&>l9g$K$O\e(B "--with-xemacs" \e$B%*%W%7%g%s$r\e(B configure \e$B%9%/%j%W\e(B
+\e$B%H$KM?$($F$/$@$5$$!#$^$?!"\e(B"make install" \e$B$NBe$o$j$K\e(B "make
+install-package" \e$B$H$9$k$3$H$G\e(BXEmacs \e$B$N%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$9$k\e(B
+\e$B$3$H$,$G$-$^$9!#\e(B
 
-\e$B$3$N%a!<%j%s%0%j%9%H$O!">-Mh$N3HD%$d@_DjJ}K!$J$I!"B>$N0lHLE*$J5DO@$K$b\e(B
-\e$BMQ$$$i$l$^$9!#\e(BLiece ML \e$B$K;22C$9$k$K$O!"K\J8$K\e(B
+* \e$B%^%K%e%"%k\e(B
 
-     subscribe \e$B$"$J$?$NL>A0\e(B
+\e$B;H$$J}$OF1:-$N%^%K%e%"%k$K5-:\$5$l$F$$$^$9!#\e(B
+\e$B%^%K%e%"%k$rFI$`$K$O\e(B "M-x info" \e$B$G0J2<$N%a%K%e!<$rA*Br$7$^$9!#\e(B
 
-\e$B$H=q$$$?%a!<%k$r\e(B
+  * Riece-ja: (riece-ja).                   An IRC client for Emacsen
 
-     liece-ctl@unixuser.org
+* \e$B%P%0Js9p\e(B
 
-\e$B$^$GAw$C$F$/$@$5$$!#\e(B
+\e$B%P%0Js9p$O!"\e(BLiece \e$B%a!<%j%s%0%j%9%H\e(B (liece@unixuser.org) \e$B$K$*Aw$j$/$@$5\e(B
+\e$B$$!#\e(BRiece \e$B$N<B9TCf$K\e(B "M-x riece-submit-bug-report" \e$B$G%P%0Js9p$N%F%s%W\e(B
+\e$B%l!<%H$r:n@.$G$-$^$9!#\e(B
index a83d640..ad09542 100644 (file)
@@ -56,7 +56,7 @@ fi
 ])
 
 AC_DEFUN([AC_CHECK_EMACS_FLAVOR],
- [AC_MSG_CHECKING([what a flavor does $EMACS have])
+ [AC_MSG_CHECKING([what flavor does $EMACS have])
 
   dnl Ignore cache.
   unset EMACS_cv_SYS_flavor;
diff --git a/doc/HACKING b/doc/HACKING
new file mode 100644 (file)
index 0000000..4d59013
--- /dev/null
@@ -0,0 +1,444 @@
+-*- mode: text -*-
+
+This document is for Riece developers.  The information necessary for
+Riece development is explained (i.e. its development process and the
+internals.)
+
+* Development process
+
+** Bug report
+
+You can create a template of a bug report by clicking the "bug" button
+in a toolbar, or M-x riece-submit-bug-report.  It is necessary to set
+riece-debug to t before preparing a bug report.
+
+** Debug output
+
+If the riece-debug variable is set to t, Riece begins to collect
+debugging information in *Debug* buffer.  Interactions with IRC
+servers are stored in " *IRC*<IRC-server-name>" buffers.  Note that
+these buffers have names starting with a whitespace character (" ").
+
+** Joining the development
+
+To join the development, send us a patch or an add-on.
+
+** CVS
+
+Development of Riece uses CVS.  Latest developing version is available
+at CVS.  Please note that the version from CVS may NOT be reliable,
+and you can only use it at your own risk.  We may ignore bug reports
+for that version.  The instruction to access the CVS server is below.
+
+(1) logging in to anonymous CVS server
+
+    cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/root login
+    CVS password: [CR] # NULL string
+
+(2) checkout modules
+
+    cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/root checkout riece
+
+(3) generate configure script
+
+    autoreconf -f -i -v
+
+You will need newer version of GNU Automake.
+
+* Internals
+
+** Modules
+
+Riece consists of many elisp modules listed below, ordered by the
+number of dependencies they have.
+
+- riece-globals
+  This module defines global variables.
+
+- riece-options
+  This module defines user options.
+
+- riece-version
+  This module defines the version of Riece.
+
+- riece-coding
+  This module provides functions which support character code conversions.
+
+- riece-complete
+  This module provides functions which support tab completion feature
+  in a mini buffer.
+
+- riece-addon
+  This module manages add-ons.
+
+- riece-mode
+  This module manages modes of riece-channel/riece-user objects.
+
+- riece-identity
+  This module defines the riece-identity object type which represents
+  global names of riece-channel/riece-user objects.
+
+- riece-channel
+  This module defines the riece-channel object type.
+
+- riece-user
+  This module defines the riece-user object type.
+
+- riece-misc
+  This module provides miscellaneous functions.
+
+- riece-signal
+  This module defines the riece-signal object type used to manage
+  display events.
+
+- riece-layout
+  This module manages window layouts.
+
+- riece-display
+  This module manages display events.
+
+- riece-server
+  This module manages connections to IRC servers.
+
+- riece-naming
+  This module is a so called the Mediator design pattern.  It knows
+  relationships of riece-channel/riece-user objects.
+
+- riece-message
+  This module defines the riece-message object type.
+
+- riece-filter
+  This module only provides the process filter function.
+
+- riece-handle
+  This module provides handler functions for IRC messages.  These
+  functions are called from riece-filter.
+
+- riece-000
+  This module provides handler functions for numeric replies whose
+  response codes are in 000 to 100 range.  These handlers are called
+  from riece-filter.
+
+- riece-200
+  This module provides handler functions for numeric replies whose
+  response codes are in 200 to 300 range.  These handlers are called
+  from riece-filter.
+
+- riece-300
+  This module provides handler functions for numeric replies whose
+  response codes are in 300 to 400 range.  These handlers are called
+  from riece-filter.
+
+- riece-400
+  This module provides handler functions for numeric replies whose
+  response codes are in 400 to 500 range.  These handlers are called
+  from riece-filter.
+
+- riece-500
+  This module provides handler functions for numeric replies whose
+  response codes are in 500 to 600 range.  These handlers are called
+  from riece-filter.
+
+- riece-commands
+  This module provides user commands.
+
+- riece-irc
+  This module provides the binding for the IRC protocol.
+
+- riece
+  This module is the entry point of M-x riece.
+
+** Namespace management
+
+Riece is capable to connect to several IRC servers.
+
+Riece has separate namespace (obarray) for each connection.  These
+namespaces can be accessed as buffer local variables of process
+buffer.
+
+*** Obtaining server buffer
+
+To access to the buffer local variables of process buffer, it is
+needed to distinguish process object of each connection by its name.
+
+It can be known by:
+
+(1) checking the value of riece-overriding-server-name,
+
+(2) checking the value of riece-server-name,
+    (If the variable riece-server-name is local to the current buffer,
+    you are already in the process buffer.)
+
+(3) or parsing riece-identity objects
+
+Once you get the name of the IRC server, you can get the process
+object by passing the name to the function riece-server-process.
+
+*** riece-identity objects
+
+A riece-identity object represents a name of a channel/user.  It is
+used to distinguish a channel/user among several servers.
+
+A riece-identity object is actually a vector, which consists of two
+elements listed below.
+
+- prefix
+  A channel/user name local to an IRC server.
+
+- server
+  The name of the IRC server.
+
+Methods to manipulate riece-identity object are listed below.
+
+- riece-make-identity prefix &optional server
+  Create a new riece-identity object.  If the server argument is
+  omitted, it sets the server part to the value returned by the
+  riece-find-server-name function.
+
+- riece-identity-prefix identity
+  Return the prefix element from the given riece-identity object.
+
+- riece-identity-server identity
+  Return the server element from the given riece-identity object.
+
+- riece-identity-equal ident1 ident2
+  Return t, if two riece-identity objects are equal.
+
+- riece-identity-equal-no-server ident1 ident2
+  Return t, if two riece-identity objects are equal.  This function
+  only consider a prefix part of a riece-identity object.
+
+- riece-identity-member elt list
+  Return non-nil if a riece-identity object is an element of a list.
+
+*** Channels and users
+
+A riece-channel object provides an abstraction of a channel.
+Likewise, a riece-user object provides an abstraction of a user.
+
+**** riece-channel objects
+
+A riece-channel object has many information about a channel.  A
+riece-channel object is actually a vector whose seven elements are listed
+below.
+
+- users
+  A list of nicknames which are of users in this channel.
+
+- operators
+  A list of nicknames which are of channel operators in this channel.
+
+- speakers
+  A list of nicknames which are of users who have the right to speak
+  in this channel.
+
+- modes
+  An alist which represents modes of this channel.
+
+- banned
+  A list of patterns set by MODE +b.
+
+- invited
+  A list of patterns set by MODE +I.
+
+- uninvited
+  A list of patterns set by MODE +e.
+
+**** riece-user objects
+
+A riece-user object has many information about a user.  A riece-user
+object is actually a vector whose four elements are listed below.
+
+- channels
+  A list of channel names this user is participating.
+
+- user-at-host
+  Connection information of this user, set in "<user>@<host>" format.
+
+- modes
+  An alist which represents modes of this user.
+
+- away
+  A flag represent whether this user is AWAY.
+
+**** The Mediator pattern
+
+The riece-naming module is used to manage relationships between
+channels and users.  It utilizes the Mediator design pattern.
+
+Using the riece-naming module allows to safely access to the namespace
+rather than directly connects riece-channel/riece-user objects.
+
+The riece-naming module provides the following functions.
+
+- riece-naming-assert-join user-name channel-name
+  Assert that a user is a member of a channel.
+
+- riece-naming-assert-part user-name channel-name
+  Assert that a user is no longer a member of a channel.
+
+- riece-naming-assert-rename old-name new-name
+  Assert that a user changed his nickname.
+
+** Signals
+
+There is a mechanism to connect events and display objects (windows,
+buffers, and modeline indicators).  This is done by signals.
+
+When it is needed to redraw, a signal is emitted.  The concept of
+signals is corresponding to signals in generic window system toolkit
+such as Qt or GTK+.
+
+To emit a signal, use riece-emit-signal.
+
+- riece-emit-signal signal-name &rest args
+  Emit a signal named signal-name with args.
+
+To define a function called when a signal is emitted, use
+riece-connect-signal.
+
+- riece-connect-signal signal-name slot-function &optional
+                       filter-function handback
+
+  Give a signal a slot-function.  The slot-function gets two
+  arguments: the signal object itself and a handback object given as
+  the fourth argument of riece-connect-signal.
+
+  If the third argument filter-function is specified, the
+  slot-function is called conditionally.  The filter-function gets the
+  signal object and returns nil or t.  If the return value is nil, the
+  slot-function is not called.
+
+To access to a signal object, use the following functions.
+
+- riece-signal-name signal
+  Return the name of a signal.
+
+- riece-signal-args
+  Return the data of a signal.
+
+Below is a list of signal names reserved.
+
+- channel-list-changed
+  Need update the channel list.
+
+- user-list-changed
+  Need update the user list.
+  (This signal gets a riece-identity object as an argument which
+  represents the channel.)
+
+- channel-switched
+  A user selected another channel.
+
+- user-joined-channel
+  A user joined a channel.
+  (This signal gets two riece-identity objects as arguments
+  corresponding to the user and the channel respectively.)
+
+- user-left-channel
+  A user left a channel.
+  (This signal gets two riece-identity objects as arguments
+  corresponding to the user and the channel respectively.)
+
+- user-renamed
+  A user changed his nickname.
+  (This signal gets two riece-identity objects as arguments
+  corresponding to the old and the new nickname respectively.)
+
+- user-away-changed
+  A user changed his AWAY status.
+  (This signal gets a riece-identity object as an argument which
+  represents the user.)
+
+- user-operator-changed
+  A user changed his IRC operator status. 
+  (This signal gets a riece-identity object as an argument which
+  represents the user.)
+
+- channel-topic-changed
+  A topic of a channel changed.
+  (This signal gets a riece-identity object as an argument which
+  represents the channel.)
+
+- channel-modes-changed
+  Modes of a channel changed.
+  (This signal gets a riece-identity object as an argument which
+  represents the channel.)
+
+- channel-operators-changed
+  A list of operators in a channel changed.
+  (This signal gets a riece-identity object as an argument which
+  represents the channel.)
+
+- channel-speakers-changed
+  A list of users who have the right to speak in a channel changed.
+  (This signal gets a riece-identity object as an argument which
+  represents the channel.)
+
+- buffer-freeze-changed
+  A buffer is frozen or unfrozen.
+  (This signal gets a buffer as an argument.)
+
+** Writing add-ons
+
+Elisp modules that satisfy add-on spec should provide the following
+functions.
+
+- <module-name>-requires
+  Return a list of names of other add-ons this add-on depends. (optional)
+
+- <module-name>-insinuate
+  Called on initialization of this module.
+
+It is recommended to set short explanation of the add-on to
+<module-name>-description variable which is displayed on add-on
+listing shown up by C-c ^ (M-x riece-command-list-addons).
+
+Add-ons that support enabling/disabling set the current status to
+<module-name>-enabled variable.  If this variable is nil, the add-on
+is regarded as currently disabled.  In addition, the add-on must
+provide the following two functions.
+
+- <module-name>-enable
+  Called to enable this add-on.
+
+- <module-name>-disable
+  Called to disable this add-on.
+
+Riece does the following process when startup.
+
+(1) Load add-ons listed in the riece-addons variable.
+
+(2) Call <module-name>-requires on each add-on (if exists) and build a
+    dependency graph.
+
+(3) Sort the dependency graph.
+
+(4) Call <module-name>-insinuate on each add-on in order of the
+    dependencies.
+
+(5) Call <module-name>-enable on each add-on, iff it supports
+    enabling/disabling and is not disabled explicitly.
+
+Add-ons are loaded from directories listed in load-path, or from
+~/.riece/addons/.
+
+** Handler hooks
+
+There are hooks called "handler hooks " which have special meaning in
+Riece.  Handler hooks are called before/after processing IRC messages.
+
+- riece-<message>-hook
+  Called before processing an IRC message.
+
+- riece-after-<message>-hook
+  Called after processing an IRC message.
+
+Where <message> is a type of IRC message and consists only lowercase
+characters.
+
+If riece-<message>-hook returns non-nil, <message> is not processed.
+In this case riece-after-<message>-hook is not called.
+
+Handler hooks gets two arguments corresponding to prefix and
+parameters in RFC2812.
diff --git a/doc/HACKING.ja b/doc/HACKING.ja
new file mode 100644 (file)
index 0000000..3deebfc
--- /dev/null
@@ -0,0 +1,419 @@
+-*- mode: text; coding: iso-2022-jp -*-
+
+\e$B$3$NJ8=q$G$O!"\e(BRiece \e$B$N3+H/%W%m%;%9$dFbIt9=B$$J$I!"3+H/$KI,MW$J>pJs$r$^\e(B
+\e$B$H$a$F$$$^$9!#\e(B
+
+* \e$B3+H/%W%m%;%9\e(B
+
+** \e$B%P%0Js9p\e(B
+
+\e$B%P%0Js9p$O!"%D!<%k%P!<$NCn$N%"%$%3%s$r%/%j%C%/$9$k$+!"\e(B
+M-x riece-submit-bug-report \e$B$G:n@.$7$F$/$@$5$$!#$^$?!"%P%0Js9p$N:n@.$N\e(B
+\e$BA0$K%G%P%C%0=PNO$rM-8z$K$7$F$*$/I,MW$,$"$j$^$9!#\e(B
+
+** \e$B%G%P%C%0=PNO\e(B
+
+\e$BJQ?t\e(B riece-debug \e$B$r\e(B t \e$B$K@_Dj$9$k$H!"\e(BRiece \e$B$N<B9TCf$K%G%P%C%0>pJs$,=PNO\e(B
+\e$B$5$l$k$h$&$K$J$j$^$9!#%G%P%C%0>pJs$O\e(B *Debug* \e$B%P%C%U%!$KC_@Q$5$l$^$9!#\e(B
+
+\e$B$^$?!"\e(BIRC \e$B%5!<%P$H$N$d$j$H$j$,\e(B " *IRC*<IRC \e$B%5!<%P$NL>A0\e(B>" \e$B%P%C%U%!$KC_\e(B
+\e$B@Q$5$l$^$9!#%P%C%U%!$NL>A0$,6uGr\e(B " " \e$B$G;O$^$k$3$H$K$4Cm0U$/$@$5$$!#\e(B
+
+** \e$B3+H/$X$N;22C\e(B
+
+\e$B%Q%C%A$+%"%I%*%s$r=q$$$FAw$C$F$/$@$5$$!#E,@Z$J$b$N$G$"$l$P<h$j9~$_$^$9!#\e(B
+
+** CVS
+
+Riece \e$B$N3+H/$K$O\e(B CVS \e$B$rMxMQ$7$F$$$^$9!#8x3+\e(B CVS \e$B%5!<%P$+$i:G?7HG$N%=!<\e(B
+\e$B%9%3!<%I$r<hF@$9$k$K$O0J2<$N$h$&$K$7$^$9!#\e(B
+
+CVS \e$BHG$N%=!<%9%3!<%I$O!"$"$/$^$G3+H/ES>e$N$b$N$G$"$j!"MxMQ$O8D?M$N@UG$\e(B
+\e$B$G$*4j$$$7$^$9!#\e(BCVS \e$BHG$K4X$9$k%P%0Js9p$O<u$1IU$1$^$;$s!#\e(B
+
+(1) CVS \e$B%5!<%P$X$N%m%0%$%s\e(B
+
+    cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/root login
+    CVS password: [CR] # NULL string
+
+(2) \e$B%b%8%e!<%k$N%A%'%C%/%"%&%H\e(B
+
+    cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/root checkout riece
+
+(3) configure \e$B%9%/%j%W%H$N@8@.\e(B
+
+    autoreconf -f -i -v
+
+\e$B$3$N:n6H$K$O:G?7$N\e(B GNU Automake \e$B$,I,MW$+$b$7$l$^$;$s!#\e(B
+
+* \e$BFbIt9=B$\e(B
+
+** \e$B%b%8%e!<%k$N9=@.\e(B
+
+Riece \e$B$r9=@.$9$k\e(B elisp \e$B%b%8%e!<%k$r0J2<$KNs5s$7$^$9!#0MB84X78$N>e0L$K\e(B
+\e$B$"$k$b$N$r@h$K5s$2$^$9!#\e(B
+
+- riece-globals
+  \e$BBg0hJQ?t$NDj5A\e(B
+
+- riece-options
+  \e$B%f!<%6%*%W%7%g%s$NDj5A\e(B
+
+- riece-version
+  \e$B%P!<%8%g%s$NDj5A\e(B
+
+- riece-coding
+  \e$B%3!<%G%#%s%0%7%9%F%`4XO"$N4X?t$NDj5A\e(B
+
+- riece-complete
+  \e$B%_%K%P%C%U%!$G$NJd40$r=u$1$k4X?t$NDj5A\e(B
+
+- riece-addon
+  \e$B%"%I%*%s4IM}\e(B
+
+- riece-mode
+  riece-channel/riece-user \e$B%*%V%8%'%/%H$N%b!<%I4IM}\e(B
+
+- riece-identity
+  riece-channel/riece-user \e$B%*%V%8%'%/%H\e(B \e$B$NBg0hI=5-$rA`:n$9$k4X?t$NDj5A\e(B
+
+- riece-channel
+  riece-channel \e$B%*%V%8%'%/%H\e(B \e$B4XO"$NDj5A\e(B
+
+- riece-user
+  riece-user \e$B%*%V%8%'%/%H\e(B \e$B4XO"$NDj5A\e(B
+
+- riece-misc
+  \e$B;(B?$J4X?t$NDj5A\e(B
+
+- riece-signal
+  \e$B%7%0%J%k4IM}\e(B
+
+- riece-layout
+  \e$B%&%#%s%I%&%l%$%"%&%H4IM}\e(B
+
+- riece-display
+  \e$BI=<(MQ%P%C%U%!$N4IM}\e(B
+
+- riece-server
+  IRC \e$B%5!<%P$H$N@\B34IM}\e(B
+
+- riece-naming
+  \e$B%A%c%s%M%k$X$N%f!<%6$N;22C!&N%C&$r4IM}$9$k\e(B mediator
+
+- riece-message
+  riece-message \e$B%*%V%8%'%/%H\e(B \e$B4XO"$NDj5A\e(B
+
+- riece-filter
+  \e$B%W%m%;%9%U%#%k%?$N%(%s%H%j%]%$%s%H\e(B
+
+- riece-handle
+  \e$BDL>o$N%a%C%;!<%8$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B
+
+- riece-000
+  000\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B
+
+- riece-200
+  200\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B
+
+- riece-300
+  300\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B
+
+- riece-400
+  400\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B
+
+- riece-500
+  500\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B
+
+- riece-commands
+  \e$B%3%^%s%I$NDj5A\e(B
+
+- riece-irc
+  IRC \e$B%W%m%H%3%k$KBP1~$7$?\e(B process-filter \e$B$J$I$N@_Dj\e(B
+
+- riece
+  \e$B5/F0;~$N%(%s%H%j%]%$%s%H!#3F%P%C%U%!$N%a%8%c!<%b!<%I$N@_Dj$J$I\e(B
+
+** \e$BL>A06u4V$N4IM}\e(B
+
+Riece \e$B$OF1;~$KJ#?t$N\e(B IRC \e$B%5!<%P$K@\B3$G$-$k$N$G!"\e(BIRC \e$B%5!<%PKh$KJL!9$N\e(B
+\e$BL>A06u4V$r4IM}$9$kI,MW$,$"$j$^$9!#$3$N$h$&$JL>A06u4V$K$O!"\e(BIRC \e$B%5!<%P$H\e(B
+\e$B$N@\B3%W%m%;%9$K7k$SIU$1$i$l$?%P%C%U%!$N%m!<%+%kJQ?t$r2p$7$F%"%/%;%9$7\e(B
+\e$B$^$9!#\e(B
+
+*** \e$B%W%m%;%9%P%C%U%!$N<hF@\e(B
+
+IRC \e$B%5!<%P$H$N@\B3%W%m%;%9$r<hF@$9$k$K$O\e(B IRC \e$B%5!<%P$NL>A0$rCN$kI,MW$,\e(B
+\e$B$"$j$^$9!#\e(BIRC \e$B%5!<%P$NL>A0$O0J2<$K5s$2$k$$$/$D$+$NJ}K!$G<hF@$G$-$^$9!#\e(B
+
+(1) \e$BJQ?t\e(B riece-overrinding-server-name \e$B$NCM\e(B
+
+(2) \e$BJQ?t\e(B riece-server-name \e$B$NCM\e(B
+
+    riece-server-name \e$B$,%+%l%s%H%P%C%U%!$N%m!<%+%kJQ?t$G$"$k$J$i$P!"4{$K%W\e(B
+    \e$B%m%;%9$N%P%C%U%!$K$$$k$H$_$J$;$k$N$G!"\e(Briece-server-name \e$B$NCM$=$N$b$N\e(B
+
+(3) \e$BA*BrCf$N%A%c%s%M%k$rI=$9\e(B riece-identity \e$B%*%V%8%'%/%H$+$i@Z$j=P$7$?\e(B 
+    IRC \e$B%5!<%P$NL>A0\e(B
+
+\e$B$3$&$7$F<hF@$7$?\e(B IRC \e$B%5!<%P$NL>A0$r0z?t$K4X?t\e(B riece-server-process \e$B$r\e(B
+\e$B8F=P$7!"%5!<%P$N%W%m%;%9$r<hF@$7$^$9!#\e(B
+
+*** riece-identity \e$B%*%V%8%'%/%H\e(B
+
+\e$BJ#?t$N\e(B IRC \e$B%5!<%P$K@\B3$7$F$$$k>l9g!"%A%c%s%M%kL>$d%K%C%/%M!<%`$rBg0h\e(B
+\e$BE*$K6hJL$9$kI,MW$,@8$8$^$9!#$3$N$h$&$JL>A0$rI=8=$9$k$N$,\e(B
+riece-identity \e$B%*%V%8%'%/%H$G$9!#\e(B
+
+riece-identity \e$B%*%V%8%'%/%H$O0J2<$N\e(B 2 \e$B$D$NMWAG$r$b$D%Y%/%?!<$G$9!#\e(B
+
+- prefix
+  \e$B%A%c%s%M%kL>$d%K%C%/%M!<%`$J$I!"\e(BIRC \e$B%5!<%P$K8GM-$NL>A0\e(B
+
+- server
+  IRC \e$B%5!<%P$NL>A0\e(B
+
+riece-identity \e$B%*%V%8%'%/%H$KE,MQ2DG=$JA`:n$K$O0J2<$N$h$&$J$b$N$,$"$j$^$9!#\e(B
+
+- riece-make-identity prefix &optional server
+  riece-identity \e$B%*%V%8%'%/%H$r?75,$K:n@.$7$^$9!#\e(Bserver \e$B0z?t$,>JN,$5$l$?\e(B
+  \e$B>l9g$K$O!"4X?t\e(B riece-find-server-name \e$B$G<hF@$7$?%5!<%PL>$r;H$$$^$9\e(B
+
+- riece-identity-prefix identity
+  riece-identity \e$B%*%V%8%'%/%H$+$i\e(B IRC \e$B%5!<%P$K8GM-$NL>A0$r@Z$j=P$7$^$9!#\e(B
+
+- riece-identity-server identity
+  riece-identity \e$B%*%V%8%'%/%H$+$i%5!<%P$NL>A0$r@Z$j=P$7$^$9!#\e(B
+
+- riece-identity-equal ident1 ident2
+  2 \e$B$D$N\e(B riece-identity \e$B%*%V%8%'%/%H$,F1Ey$G$"$k$+D4$Y$^$9!#\e(B
+
+- riece-identity-equal-no-server ident1 ident2
+  2 \e$B$D$N\e(B riece-identity \e$B%*%V%8%'%/%H$N!"\e(BIRC \e$B%5!<%P$K8GM-$NL>A0$,F1Ey$G$"\e(B
+  \e$B$k$+D4$Y$^$9!#\e(B
+
+- riece-identity-member elt list
+  riece-identity \e$B%*%V%8%'%/%H\e(B elt \e$B$,\e(B list \e$B$K4^$^$l$k$+D4$Y$^$9!#\e(B
+
+*** \e$B%A%c%s%M%k$H%f!<%6$N4IM}\e(B
+
+riece-identity \e$B%*%V%8%'%/%H$+$i@Z$j=P$5$l$?\e(B IRC \e$B%5!<%P$K8GM-$NL>A0!"$9\e(B
+\e$B$J$o$A%A%c%s%M%kL>$H$H%K%C%/%M!<%`$K$h$jI=$o$5$l$k%A%c%s%M%k$H%f!<%6$N\e(B
+\e$B<BBN$O$=$l$>$l\e(B riece-channel \e$B%*%V%8%'%/%H$H\e(B riece-user \e$B%*%V%8%'%/%H$G\e(B
+\e$BI=8=$5$l$^$9!#\e(B
+
+**** riece-channel \e$B%*%V%8%'%/%H\e(B
+
+riece-channel \e$B$O%A%c%s%M%k$rI=$9%*%V%8%'%/%H$G!"0J2<$NMWAG$r;}$A$^$9!#\e(B
+
+- users
+  \e$B;22C$7$F$$$k%f!<%6$N%K%C%/%M!<%`$N%j%9%H\e(B
+
+- operators
+  \e$B%*%Z%l!<%?8"8B$r$b$D%f!<%6$N%K%C%/%M!<%`$N%j%9%H\e(B
+
+- speakers
+  \e$BH/8@8"$r$b$D%f!<%6$N%K%C%/%M!<%`$N%j%9%H\e(B
+
+- modes
+  \e$B%A%c%s%M%k$N%b!<%I\e(B
+
+- banned
+  MODE +b \e$B$G;XDj$5$l$?%Q%?!<%s$N0lMw\e(B
+
+- invited
+  MODE +I \e$B$G;XDj$5$l$?%Q%?!<%s$N0lMw\e(B
+
+- uninvited
+  MODE +e \e$B$G;XDj$5$l$?%Q%?!<%s$N0lMw\e(B
+
+**** riece-user \e$B%*%V%8%'%/%H\e(B
+
+riece-user \e$B$O!"\e(BIRC \e$B$K;22C$7$F$$$k%f!<%6$rI=$9%*%V%8%'%/%H$G!"0J2<$NMW\e(B
+\e$BAG$r;}$A$^$9!#\e(B
+
+- channels
+  \e$B;22C$7$F$$$k%A%c%s%M%kL>$N%j%9%H\e(B
+
+- user-at-host
+  "<user>@<host>" \e$B$N7A$GM?$($i$l$k%f!<%6$N@\B3>pJs\e(B
+
+- modes
+  \e$B%f!<%6$N%b!<%I\e(B
+
+- away
+  \e$BN%@JCf$+$I$&$+\e(B
+
+**** Mediator \e$B%Q%?!<%s\e(B
+
+\e$B%A%c%s%M%k$X$N%f!<%6$N;22C!&N%C&$r4IM}$9$k$?$a$K!"\e(B riece-naming \e$B%b%8%e!<\e(B
+\e$B%k$r;H$$$^$9!#\e(Briece-naming \e$B$O!"%G%6%$%s%Q%?!<%s$G$$$&$H$3$m$N\e(B Mediator
+\e$B%Q%?!<%s$KAjEv$9$k$b$N$G$9!#\e(B
+
+riece-naming \e$B$r2p$9$k$3$H$G!"A0=R$N\e(B riece-channel, riece-user \e$B%*%V%8%'\e(B
+\e$B%/%H$rD>@\A`:n$9$k$3$H$J$/!"0BA4$KL>A06u4V$K%"%/%;%9$9$k$3$H$,$G$-$^$9!#\e(B
+
+riece-naming \e$B$,Ds6!$9$k<g$J4X?t$O0J2<$N\e(B 3 \e$B$D$G$9!#\e(B
+
+- riece-naming-assert-join user-name channel-name
+  \e$B%f!<%6$,%A%c%s%M%k$K;22C$7$?$3$H$rI=L@$7$^$9\e(B
+
+- riece-naming-assert-part user-name channel-name
+  \e$B%f!<%6$,%A%c%s%M%k$+$iN%C&$7$?$3$H$rI=L@$7$^$9\e(B
+
+- riece-naming-assert-rename old-name new-name
+  \e$B%f!<%6$NL>A0$,JQ99$5$l$?$3$H$rI=L@$7$^$9\e(B
+
+** \e$B%7%0%J%k\e(B
+
+\e$B%7%0%J%k$H$O!"2hLL$N:FIA2h$r8zN(NI$/9T$&$?$a$K!"%$%Y%s%H$HIA2hBP>]$N%*\e(B
+\e$B%V%8%'%/%H\e(B(\e$B%P%C%U%!$d!"%b!<%I%i%$%s$N0u\e(B)\e$B$r7k$SIU$1$k5!9=$G$9!#\e(B
+
+\e$B%&%#%s%I%&$N:FIA2h$rH<$&%$%Y%s%H$,H/@8$9$k$H!"%7%0%J%k$,Aw=P$5$l$^$9!#\e(B
+\e$B%7%0%J%k$N35G0$O!"\e(BQt \e$B$d\e(B GTK+ \e$B$H$$$C$?0lHLE*$J\e(B GUI \e$B%D!<%k%-%C%H$KMQ0U$5\e(B
+\e$B$l$F$$$k$b$N$HF1MM$G$9!#\e(B
+
+\e$B%7%0%J%k$rAw?.$9$k$K$O!"\e(Briece-emit-signal \e$B$r;H$$$^$9!#\e(B
+
+- riece-emit-signal signal-name &rest args
+  \e$B0z?t\e(B signal-name \e$B$G;X<($5$l$k%7%0%J%k$r!"0z?t\e(B args \e$B$H$H$b$KAw=P$7$^\e(B
+  \e$B$9\e(B
+
+\e$B%7%0%J%k$K1~Ez$9$k=hM}$O!"\e(Briece-connect-signal \e$B$r;H$C$FDj5A$7$^$9!#\e(B
+
+- riece-connect-signal signal-name slot-function &optional
+                       filter-function handback
+
+  \e$B0z?t\e(B signal-name \e$B$G;XDj$5$l$?%7%0%J%k$K1~Ez$9$k4X?t\e(B slot-function \e$B$r\e(B
+  \e$B@_Dj$7$^$9!#\e(Bslot-function \e$B$K;XDj$5$l$?4X?t$O\e(B 2 \e$B$D$N0z?t$r<h$j$^$9!#\e(B
+  \e$B$R$H$D$O%7%0%J%k$G!"$b$&0l$D$O!"0z?t\e(B handback \e$B$GM?$($i$l$?%*%V%8%'%/\e(B
+  \e$B%H$,$=$N$^$^EO$5$l$^$9!#\e(B
+
+  \e$B0z?t\e(B filter-function \e$B$O!"<u?.$7$?%7%0%J%k$K1~Ez$9$Y$-$+$I$&$+$rH=Dj\e(B
+  \e$B$9$k4X?t$G$9!#$3$N4X?t$O0z?t$H$7$F%7%0%J%k%*%V%8%'%/%H$r<u$1<h$j!"\e(B
+  nil \e$B$^$?$O\e(B t \e$B$rJV$7$^$9!#JV$jCM$,\e(B nil \e$B$N>l9g$K$O!"\e(Bslot-function \e$B$O<B\e(B
+  \e$B9T$5$l$^$;$s!#\e(B
+
+\e$B%7%0%J%k%*%V%8%'%/%H$K%"%/%;%9$9$k$K$O!"0J2<$N4X?t$r;H$$$^$9!#\e(B
+
+- riece-signal-name signal
+  \e$B%7%0%J%k$NL>A0$rJV$7$^$9!#\e(B
+
+- riece-signal-args
+  \e$B%7%0%J%k$NAw?.;~$KM?$($i$l$?0z?t$rJV$7$^$9!#\e(B
+
+\e$B8=:_!"0J2<$N%7%0%J%k$,;HMQ$5$l$F$$$^$9!#\e(B
+
+- channel-list-changed
+  \e$B;22C$7$F$$$k%A%c%s%M%k$N0lMw$NJQ2=\e(B
+
+- user-list-changed
+  \e$B%A%c%s%M%k$N;22C<T0lMw$NJQ2=\e(B
+  (\e$B0z?t$O%A%c%s%M%k$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- channel-switched
+  \e$B8=:_$N%A%c%s%M%k$r0\F0\e(B
+
+- user-joined-channel
+  \e$B%f!<%6$,%A%c%s%M%k$K;22C\e(B
+  (\e$B0z?t$O!"%f!<%6$*$h$S%A%c%s%M%k$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- user-left-channel
+  \e$B%f!<%6$,%A%c%s%M%k$+$iN%C&\e(B
+  (\e$B0z?t$O!"%f!<%6$*$h$S%A%c%s%M%k$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- user-renamed
+  \e$B%f!<%6$,L>A0$rJQ99\e(B
+  (\e$B0z?t$O!"0JA0$H8=:_$NL>A0$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- user-away-changed
+  \e$B%f!<%6$NN%@J>uBV$NJQ2=\e(B
+  (\e$B0z?t$O!"%f!<%6$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- user-operator-changed
+  \e$B%f!<%6$N%*%Z%l!<%?>uBV$NJQ2=\e(B
+  (\e$B0z?t$O!"%f!<%6$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- channel-topic-changed
+  \e$B%A%c%s%M%k$N%H%T%C%/$NJQ2=\e(B
+  (\e$B0z?t$O!"%A%c%s%M%k$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- channel-modes-changed
+  \e$B%A%c%s%M%k$N%b!<%I$NJQ2=\e(B
+  (\e$B0z?t$O!"%A%c%s%M%k$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- channel-operators-changed
+  \e$B%A%c%s%M%k$G%*%Z%l!<%?8"8B$r;}$D%f!<%6$N0lMw$NJQ2=\e(B
+  (\e$B0z?t$O!"%A%c%s%M%k$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- channel-speakers-changed
+  \e$B%A%c%s%M%k$GH/8@8"$r;}$D%f!<%6$N0lMw$NJQ2=\e(B
+  (\e$B0z?t$O!"%A%c%s%M%k$KAjEv$9$k\e(B riece-identity \e$B%*%V%8%'%/%H\e(B)
+
+- buffer-freeze-changed
+  \e$B%P%C%U%!$NE`7k>uBV$NJQ2=\e(B
+  (\e$B0z?t$O%P%C%U%!\e(B)
+
+** \e$B%"%I%*%s$N=q$-J}\e(B
+
+\e$B%"%I%*%s$N>r7o$rK~$?$9%b%8%e!<%k$O0J2<$N4X?t$rDs6!$7$^$9!#\e(B
+
+- <\e$B%b%8%e!<%kL>\e(B>-requires
+  \e$B0MB8$9$kB>$N%"%I%*%s\e(B(\e$B%7%s%\%k$N%j%9%H\e(B)\e$B$rJV$7$^$9\e(B(\e$B%*%W%7%g%s\e(B)
+
+- <\e$B%b%8%e!<%kL>\e(B>-insinuate
+  \e$B=i4|2==hM}$r9T$$$^$9\e(B
+
+\e$B$^$?!"%"%I%*%s$N4JC1$J@bL@$r!"JQ?t\e(B <\e$B%b%8%e!<%kL>\e(B>-description \e$B$K@_Dj$9\e(B
+\e$B$k$HNI$$$G$7$g$&!#$3$NJ8;zNs$O\e(B C-c ^ (M-x riece-command-list-addons)
+\e$B$K$h$k%"%I%*%s$N0lMw$GI=<($5$l$^$9!#\e(B
+
+\e$BM-8z2=!&L58z2=$KBP1~$7$?%"%I%*%s$O!"JQ?t\e(B <\e$B%b%8%e!<%kL>\e(B>-enabled \e$B$K8=:_\e(B
+\e$B$N>uBV$rJ];}$7$^$9!#$3$NJQ?t$NCM$,\e(B nil \e$B$G$"$l$PL58z!"\e(Bt \e$B$G$"$l$PM-8z$G\e(B
+\e$B$9!#2C$($F!"0J2<$N4X?t$rDs6!$7$^$9!#\e(B
+
+- <\e$B%b%8%e!<%kL>\e(B>-enable
+\e$B%"%I%*%s$rM-8z$K$7$^$9\e(B
+
+- <\e$B%b%8%e!<%kL>\e(B>-disable
+\e$B%"%I%*%s$rL58z$K$7$^$9\e(B
+
+Riece \e$B$O5/F0;~$K0J2<$N=hM}$r9T$$$^$9!#\e(B
+
+(1) \e$BJQ?t\e(B riece-addons \e$B$KNs5s$5$l$?%b%8%e!<%k$rFI$_9~$`\e(B
+
+(2) \e$B$=$l$>$l$N%b%8%e!<%k$KBP$7!"\e(B<\e$B%b%8%e!<%kL>\e(B>-requires \e$B$,MQ0U\e(B
+    \e$B$5$l$F$$$l$P8F$S=P$7!"0MB8%0%i%U$r:n$k\e(B
+
+(3) \e$B0MB8%0%i%U$KBP$7$F%H%]%m%8%+%k%=!<%H$r9T$&\e(B
+
+(4) \e$BF@$i$l$?0MB8=g=x$K=>$C$F\e(B <\e$B%b%8%e!<%kL>\e(B>-insinuate \e$B8F$S=P$9\e(B
+
+(5) \e$B$b$7!"%"%I%*%s$,M-8z2=!&L58z2=$KBP1~$7$F$*$j!"L@<(E*$KL58z2=$5$l$F\e(B
+    \e$B$$$J$1$l$P!"\e(B<\e$B%b%8%e!<%kL>\e(B>-enable \e$B$r8F$S=P$9!#\e(B
+
+\e$B:n@.$7$?%"%I%*%s$O!"\e(Bload-path \e$B$NDL$C$?%G%#%l%/%H%j$+!"\e(B
+~/.riece/addons/ \e$B0J2<$KG[CV$9$k$HAH$_9~$_2DG=$J>uBV$K$J$j$^$9!#\e(B
+
+** \e$B%O%s%I%i%U%C%/\e(B
+
+Riece \e$B$K$O!"%O%s%I%i%U%C%/$H8F$P$l$kFCJL$J0UL#$r;}$D%U%C%/$,$"$j$^$9!#\e(B
+\e$B%O%s%I%i%U%C%/$O\e(B IRC \e$B$N%a%C%;!<%8$r<u$1<h$C$?A08e$G<B9T$5$l$^$9!#\e(B
+
+<message> \e$B$r\e(B IRC \e$B$N%a%C%;!<%8$r>.J8;z$K$7$?$b$N$H$9$k$H!"%O%s%I%i%U%C\e(B
+\e$B%/$O<!$NFs$D$G$9!#\e(B
+
+- riece-<message>-hook
+  \e$B%a%C%;!<%8$,FO$$$?$H$-$K:G=i$K8F$P$l$k%U%C%/\e(B
+
+- riece-after-<message>-hook
+  \e$B%a%C%;!<%8$N=hM}$,=*$o$C$?8e$K8F$P$l$k%U%C%/\e(B
+
+\e$BNc$($P!"\e(BPRIVMSG \e$B$K4X$7$F$O!"\e(Briece-privmsg-hook,
+riece-after-privmsg-hook \e$B$NFs$D$N%U%C%/$,8F$P$l$^$9!#\e(B
+
+\e$B$3$3$G\e(B riece-<message>-hook \e$B$NJV$jCM$K$O0UL#$,$"$j!"\e(Bt \e$B$rJV$9$b$N$,$"$l\e(B
+\e$B$P!"$=$N8e$N=hM}$r$*$3$J$$$^$;$s!#$^$?!"$=$N>l9g$K$O\e(B
+riece-after-<message>-hook \e$B$b8F$S=P$5$l$^$;$s!#\e(B
+
+\e$B%U%C%/$N0z?t$K$O\e(B RFC2812 \e$B$N\e(B prefix \e$B$H\e(B parameters \e$B$,EO$j$^$9!#\e(B
\ No newline at end of file
index 61a0e6b..77d585d 100644 (file)
@@ -1,4 +1,5 @@
-EXTRA_DIST = texinfo.tex infohack.el ptexinfmt.el irchat-copyright.el
+EXTRA_DIST = texinfo.tex infohack.el ptexinfmt.el irchat-copyright.el \
+       HACKING HACKING.ja
 
 info_TEXINFOS = riece-ja.texi riece-en.texi
 
index 1b06f13..b6fddc6 100644 (file)
@@ -49,15 +49,16 @@ Free Documentation License".
 @node Top, Overview, (dir), (dir)
 @top Riece user's manual
 
-Riece \e$B$O\e(B Emacs \e$B$G\e(B IRC (Internet Relay Chat) \e$B$K;22C$9$k$?$a$N%W%m%0%i%`$G$9!#\e(B
+\e$B$3$N%^%K%e%"%k$G$O!"\e(BRiece \e$B%P!<%8%g%s\e(B @value{VERSION} \e$B$K$D$$$F2r@b$7$^$9!#\e(B
+\e$B$3$N%^%K%e%"%k$G07$&HO0O$r1[$($?>pJs$O\e(B Riece \e$B$N8x<0%[!<%`%Z!<%8\e(B 
+@uref{http://www.nongnu.org/riece/} \e$B$+$iF@$i$l$k$+$b$7$l$^$;$s!#\e(B
 
 @menu
-* Overview::                    Riece \e$B$H$O2?$+\e(B
-* Getting started::             
+* Overview::                    \e$B$O$8$a$KFI$s$G$M\e(B
+* Getting started::             IRC \e$B%5!<%P$K@\B3$7$F2qOC$7$F$_$h$&\e(B
 * Basic usage::                 \e$B4pK\E*$J;H$$J}\e(B
 * Advanced usage::              \e$B?J$s$@;H$$J}\e(B
 * Tips::                        \e$BJXMx$J@_Dj\e(B
-* Development::                 \e$B3+H/<T8~$1>pJs\e(B
 * Index::                       
 * Function Index::              
 * Variable Index::              
@@ -66,141 +67,97 @@ Riece \e$B$O\e(B Emacs \e$B$G\e(B IRC (Internet Relay Chat) \e$B$K;22C$9$k$?$a$N%W%m%
 @node Overview, Getting started, Top, Top
 @chapter Overview
 
-Riece \e$B$O!"D9$$4V%a%s%F%J%s%9IT2DG=$J>uBV$K$"$C$?\e(B Liece \e$B$N%3!<%I$r40A4$K\e(B
-\e$B=q$-D>$7$?$b$N$G$9!#%f!<%6%$%s%?!<%U%'!<%9$NBgItJ,$O\e(B Liece \e$B$N$b$N$rF'=1\e(B
-\e$B$7$F$$$^$9!#\e(B
+Riece \e$B$O\e(B IRC (Internet Relay Chat) \e$B$N@$3&$G%A%c%C%H$r3Z$7$`$?$a$N%f!<%6\e(B
+\e$B%$%s%?!<%U%'!<%9$G$9!#\e(BRiece \e$B$O!V$j!<$9!W$HFI$_$^$9!#\e(B
 
-Riece \e$B$K$O\e(B Liece \e$B$K$O$J$$FCD9$,$$$/$D$+$"$j$^$9!#\e(B
-\e$B0J2<$K$=$l$i$N0lIt$r5s$2$^$9!#\e(B
+Riece \e$B$N<g$JFCD9$O0J2<$NDL$j$G$9!#\e(B
 
 @itemize @bullet
 @item \e$BJ#?t$N\e(B IRC \e$B%5!<%P$KF1;~$K@\B32DG=\e(B
-@item \e$B%"%I%*%s$K$h$j5!G=$NDI2C$d<h$j30$7$,2DG=\e(B
+@item \e$B%"%I%*%s$K$h$j5!G=$NDI2C$d<h$j30$7$,MF0W\e(B
 @item \e$BB>$N\e(B elisp \e$B%Q%C%1!<%8$K0MB8$7$J$$$?$a!"%$%s%9%H!<%k$,4JC1\e(B
 @item \e$B@_Dj$,4JC1$G!"A02s5/F0;~$N@_Dj$r5-O?!&I|85$9$k;EAH$_$rDs6!\e(B
 @item \e$BCJ3,E*$JA`:n@bL@=q$,ImB0\e(B
 @item \e$B:G?7$N\e(B IRC \e$B$N%/%i%$%"%s%H%W%m%H%3%k\e(B (RFC2812) \e$B$K=`5r\e(B
 @end itemize
 
-\e$B$h$j>\$7$$>pJs$O!"0J2<$N%Z!<%8$r8fMw$/$@$5$$!#\e(B
-
-@itemize @bullet
-@item http://www.nongnu.org/riece/
-@end itemize
-
 @node Getting started, Basic usage, Overview, Top
 @chapter Getting started
 
-@menu
-* Required Environments::       \e$BF0:n4D6-\e(B
-* Installation::                \e$B%$%s%9%H!<%kJ}K!\e(B
-* Startup File::                \e$B@_Dj%U%!%$%k\e(B
-@end menu
+Riece \e$B$r5/F0$9$k<j=g$O<!$NDL$j$G$9!#\e(B
 
-@node Required Environments, Installation, Getting started, Getting started
-@section Required Environments
-
-\e$B<!$K5s$2$k4D6-$GF0:n$r3NG'$7$F$$$^$9!#\e(B
+@enumerate
+@item
+@kbd{M-x load-library riece}
 
-@itemize @bullet
-@item Emacs 20.7 \e$B0J>e\e(B
-@item XEmacs 21.4 \e$B0J>e\e(B
-@end itemize
+@item
+@kbd{M-x riece}
+@end enumerate
 
-@node Installation, Startup File, Required Environments, Getting started
-@section Installation
+\e$B$b$7\e(B (1) \e$B$G\e(B @samp{Cannot open load file: riece} \e$B$N%(%i!<$,H/@8$9$k>l9g$K\e(B
+\e$B$O%$%s%9%H!<%k$K<:GT$7$F$$$^$9!#<+J,$G%=!<%9$+$i%$%s%9%H!<%k$7$?>l9g$K$O\e(B 
+README \e$B$r$b$&0lEYFI$_D>$7$F$/$@$5$$!#\e(BOS\e$B!&%G%#%9%H%j%S%e!<%7%g%s$N%Q%C%1!<\e(B
+\e$B%8$+$i%$%s%9%H!<%k$7$?>l9g$K$O!"%Q%C%1!<%8$K4^$^$l$kJ8=q$r$43NG'$/$@$5$$!#\e(B
 
-Riece \e$B$N:G?7HG$O!"\e(B
-@uref{http://wiliki.designflaw.org/riece.cgi} \e$B$GG[I[$7$F$$$^\e(B
-\e$B$9!#E83+$7$?$i!"0J2<$N%3%^%s%I$r<B9T$9$k$3$H$G<j85$N4D6-$K%$%s%9%H!<%k$G\e(B
-\e$B$-$^$9\e(B
+Riece \e$B$r5/F0$9$k$H!"\e(BIRC \e$B%5!<%P$NL>A0$rJ9$+$l$^$9!#8x6&$KMxMQ2DG=$J\e(B IRC 
+\e$B%5!<%P$N0lMw$O\e(B Web \e$B%Z!<%8$J$I$+$iF@$k$3$H$,$G$-$^$9!#\e(B
 
-@example
-./configure
-make
-make install
-@end example
+@itemize @bullet
+@item http://irc.kyoto-u.ac.jp
+@item http://freenode.net
+@end itemize
 
-XEmacs \e$B$N%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$9$k>l9g$K$O0J2<$N$h$&$K$7$^$9!#\e(B
+\e$B$^$?!"0J2<$N$h$&$J%a%C%;!<%8$,I=<($5$l$k$+$b$7$l$^$;$s!#\e(B
 
 @example
-./configure --with-xemacs[=xemacs-21.4.17]
-make package
-make install-package
+Nickname "ueno" already in use.  Choose a new one: 
 @end example
 
-XEmacs \e$B$N%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$7$?>l9g$K$OI,MW$"$j$^$;$s$,!"\e(B
-@kbd{M-x riece} \e$B$G5/F0$9$k$?$a$K$O!"\e(Bautoload \e$B$N@_Dj$r8f<+J,$N\e(B Emacs \e$B$N@_\e(B
-\e$BDj%U%!%$%k$K2C$($kI,MW$,$"$j$^$9!#\e(B
+IRC \e$B$G$O!";22C<T$rI=$9$N$K\e(B@emph{\e$B%K%C%/%M!<%`\e(B}\e$B$H8F$P$l$kC;$$8F>N$,;H$o$l\e(B
+\e$B$^$9!#$b$74uK>$N%K%C%/%M!<%`$,B>$NC/$+$K;HMQ$5$l$F$$$k>l9g!"JL$N%K%C%/%M!<\e(B
+\e$B%`$rA*$VI,MW$,$"$j$^$9!#\e(B
 
-@lisp
-(autoload 'riece "riece" "Start Riece" t)
-@end lisp
-
-@node Startup File,  , Installation, Getting started
-@section Startup file
-
-\e$B$3$N>O$G$O!"@_Dj%U%!%$%k$K$D$$$F2r@b$7$^$9!#\e(B
-
-\e$B;n$7$K;H$C$F$_$k>l9g$K$O!"FC$K2?$b@_Dj$9$kI,MW$O$"$j$^$;$s!#\e(B
-\e$B$3$N>O$OFI$_Ht$P$7$F$b9=$$$^$;$s!#\e(B
+IRC \e$B%5!<%P$K@\B3$G$-$?$i!"<!$O2qOC$r$7$F$_$^$7$g$&!#\e(BIRC \e$B$G$O\e(B@emph{\e$B%A%c%s%M%k\e(B}
+\e$B$H8F$P$l$k2>A[E*$J2q5D<<$K;22C$7$F2qOC$r9T$J$$$^$9!#%A%c%s%M%k$KF~$k$K$O\e(B 
+@kbd{C-c j} \e$B$H%?%$%W$7$^$9!#;22C$9$k%A%c%s%M%kL>$r?R$M$i$l$?$i!"E,@Z$J%A%c\e(B
+\e$B%s%M%kL>$rF~NO$7$^$7$g$&!#\e(BIRCnet \e$B$K$O\e(B @samp{#Riece} \e$B$H$$$&%A%c%s%M%k$,$"\e(B
+\e$B$k$N$G!"%F%9%H$r$7$?$$>l9g$K$O<+M3$K$*;H$$$/$@$5$$!#\e(B
 
-Riece \e$B$O@_Dj%U%!%$%k$rJQ?t\e(B @code{riece-directory} \e$B$G;X<($5$l$k%G%#%l%/%H\e(B
-\e$B%j\e(B (\e$B%G%U%)%k%H$O\e(B @file{~/.riece/}) \e$B$+$iFI$_9~$_$^$9!#$3$N%G%#%l%/%H%j$K\e(B
-\e$B$O0J2<$N\e(B 2 \e$B$D$N@_Dj%U%!%$%k$,G[CV$5$l$^$9!#\e(B
+\e$B%A%c%s%M%k$KF~$k$H!"2<$N?^$K<($9$h$&$J\e(B 5 \e$B$D$N%&%#%s%I%&\e(B
+@footnote{\e$B$^$.$i$o$7$$$G$9$,!"\e(BEmacs \e$B$N@$3&$G$O%P%C%U%!$rI=<($9$kNN0h$r%&%#\e(B
+\e$B%s%I%&$H8F$S$^$9!#\e(B}\e$B$+$i$J$k2hLL$K@Z$jBX$o$j$^$9!#\e(B
 
-@table @code
-@item riece-saved-variables-file
-@vindex riece-saved-variables-file
-\e$BA02s$N%;%C%7%g%s$G99?7$5$l$?@_Dj$,<+F0E*$KJ]B8$5$l$^$9\e(B(\e$B%G%U%)%k%H$O\e(B @file{~/.riece/save})
-@item riece-variables-file
-@vindex riece-variables-file
-\e$B%f!<%6$K8GM-$N@_Dj$r5-=R$7$^$9\e(B(\e$B%G%U%)%k%H$O\e(B @file{~/.riece/init})
-@end table
+@example
++-----+-----------------+
+|     |                 |
+|     |                 |
+| (1) |       (2)       |
+|     |                 |
+|     |                 |
++-----+-----------------+
+|     |       (4)       |
+|     +-----------------+
+| (3) |                 |
+|     |       (5)       |
+|     |                 |
++-----+-----------------+
+@end example
 
-\e$B5/F0;~$K$O!":G=i$K\e(B @code{riece-saved-variables-file} \e$B$r!"<!$K\e(B 
-@code{riece-variables-file} \e$B$rFI$_9~$_$^$9!#$D$^$j!"\e(B
-@file{~/.riece/save} \e$B$K<+F0E*$KJ]B8$5$l$?FbMF$O!"\e(B@file{~/.riece/init} \e$B$K\e(B
-\e$B5-=R$5$l$?FbMF$G>e=q$-$5$l$^$9!#\e(B
+(4) \e$B$N%&%#%s%I%&$KI=<($5$l$k%P%C%U%!$KJ8>O$rF~NO$7$F%j%?!<%s%-!<$r2!$9$H\e(B
+\e$BH/8@$G$-$^$9!#B>$N;22C<T$NH/8@$O\e(B (2) \e$B$N%&%#%s%I%&$KI=<($5$l$^$9!#\e(B
 
 @node Basic usage, Advanced usage, Getting started, Top
 @chapter Basic usage
 
-@kbd{M-x riece} \e$B$H$9$k$3$H$G5/F0$7$^$9!#%5!<%PL>$rJ9$+$l$k$N$GEz$($^$9!#\e(B
-\e$B@\B32DG=$J\e(B IRC \e$B%5!<%P$O3F\e(B IRC \e$B%M%C%H%o!<%/Kh$K0[$J$j$^$9$,!"BgDq$O\e(B Web 
-\e$B%Z!<%8$K0lMw$,$^$H$a$F$"$k$3$H$,B?$$$G$7$g$&!#\e(B
-
-@itemize @bullet
-@item http://irc.kyoto-u.ac.jp
-@item http://freenode.net
-@end itemize
-
-\e$B$b$7%K%C%/%M!<%`$,4{$K;HMQ$5$l$F$$$k>l9g!"JL$N%K%C%/%M!<%`$NF~NO$rB%$5$l$^$9!#\e(B
-\e$B%K%C%/%M!<%`$N=i4|CM$O\e(B @code{riece-nickname} \e$B$G@_Dj$7$^$9!#%G%U%)%k%H$G$O!"\e(B
-\e$B%f!<%6$N%m%0%$%sL>$,$=$N$^$^;H$o$l$^$9!#\e(B
-@vindex riece-nickname
-
-\e$BL5;v$K@\B3$G$-$?$i!"<!$O%A%c%s%M%k$K;22C$7$F2qOC$r$7$F$_$^$7$g$&!#\e(B
-@kbd{C-c j} \e$B$H%?%$%W$9$k$H;22C$9$k%A%c%s%M%kL>$r?R$M$i$l$k$N$G!"E,Ev$J%A%c\e(B
-\e$B%s%M%kL>$rF~NO$7$^$7$g$&!#\e(BIRCnet \e$B$K$O\e(B @samp{#Riece} \e$B$H$$$&%A%c%s%M%k$,$"\e(B
-\e$B$k$N$G!"%F%9%H$K$*;H$$$/$@$5$$!#\e(B
-
-\e$B%A%c%s%M%k$KF~$k$3$H$,$G$-$?$i!"J8>O$rF~NO$7$F%j%?!<%s%-!<$r2!$9$HH/8@$9\e(B
-\e$B$k$3$H$,$G$-$^$9!#B>$N?M$N2qOC$O2hLL1&>e$N%P%C%U%!$KI=<($5$l$^$9!#\e(B
-
 @menu
 * Windows::                     \e$B2hLL9=@.\e(B
 * Indicators::                  \e$B<+J,$N>uBV$NI=<(\e(B
 * Commands::                    \e$B%3%^%s%I$N0lMw\e(B
-* Connecting to multiple servers::  \e$BJ#?t$N%5!<%P$K$D$J$0$K$O\e(B
 @end menu
 
 @node Windows, Indicators, Basic usage, Basic usage
 @section Windows
 
-\e$B%G%U%)%k%H$N@_Dj$G$O!"%A%c%s%M%k$KF~$k$H!"2<$N?^$K<($9$h$&$J\e(B 5 \e$B$D$N%&%#%s\e(B
-\e$B%I%&$+$i$J$k2hLL$K@Z$jBX$o$j$^$9!#\e(B
-
 @example
 +-----+-----------------+
 |     |                 |
@@ -217,59 +174,68 @@ Riece \e$B$O@_Dj%U%!%$%k$rJQ?t\e(B @code{riece-directory} \e$B$G;X<($5$l$k%G%#%l%/%
 +-----+-----------------+
 @end example
 
-\e$B$3$l$i$N3F%&%#%s%I%&$KI=<($5$l$k%P%C%U%!$NLr3d$O0J2<$NDL$j$G$9!#\e(B
+\e$B3F%&%#%s%I%&$KI=<($5$l$k%P%C%U%!$NLr3d$O0J2<$NDL$j$G$9!#\e(B
 
 @enumerate
 @item
-\e$B%f!<%6%j%9%H%P%C%U%!\e(B (@samp{*Users XXX*})\e$B!#%A%c%s%M%k$K$$$k%f!<%6$N0lMw\e(B
-\e$B$,I=<($5$l$^$9!#\e(B
+\e$B%f!<%6%j%9%H%P%C%U%!\e(B (@samp{ *Users*})\e$B!#%A%c%s%M%k$K;22C$7$F$$$k%f!<\e(B
+\e$B%6$N%K%C%/%M!<%`$N0lMw$,I=<($5$l$^$9!#\e(B
 
 @item
-\e$B%A%c%s%M%k%P%C%U%!\e(B (@samp{*Channel XXX*})\e$B!#%A%c%s%M%kFb$N2qOC$,I=<($5$l\e(B
+\e$B%A%c%s%M%k%P%C%U%!\e(B (@samp{ *Channel:XXX*})\e$B!#%A%c%s%M%kFb$N2qOC$,I=<($5$l\e(B
 \e$B$^$9!#\e(B
 
 @item
-\e$B%A%c%s%M%k%j%9%H%P%C%U%!\e(B (@samp{*Channels*})\e$B!#;22C$7$F$$$k%A%c%s%M%k$N0l\e(B
-\e$BMw$,I=<($5$l$^$9!#\e(B
+\e$B%A%c%s%M%k%j%9%H%P%C%U%!\e(B (@samp{ *Channels*})\e$B!#<+J,$,;22C$7$F$$$k%A%c%s%M\e(B
+\e$B%k$N0lMw$,I=<($5$l$^$9!#\e(B
 
 @item
-\e$B%3%^%s%I%P%C%U%!\e(B (@samp{*Commands*})\e$B!#J8>O$d%3%^%s%I$rAw?.$9$k$?$a$K;H$$\e(B
+\e$B%3%^%s%I%P%C%U%!\e(B (@samp{*Command*})\e$B!#J8>O$d%3%^%s%I$rAw?.$9$k$?$a$K;H$$\e(B
 \e$B$^$9!#\e(B
 
 @item
-\e$B%"%6!<%:%P%C%U%!\e(B (@samp{*Others*})\e$B!#8=:_$N%A%c%s%M%k0J30$N2qOC$,N.$l$^$9!#\e(B
+\e$B%"%6!<%:%P%C%U%!\e(B (@samp{ *Others*})\e$B!#8=:_A*BrCf$N%A%c%s%M%k0J30$N2qOC$,N.\e(B
+\e$B$l$^$9!#\e(B
 @end enumerate
 
 @node Indicators, Commands, Windows, Basic usage
 @section Indicators
 
-\e$B%3%^%s%I%P%C%U%!$d%A%c%s%M%k%P%C%U%!$N%b!<%I%i%$%s$N:8C<$K$O!"\e(B
-\e$B<+J,$N8=:_$N>uBV$r<($90u$,I=<($5$l$^$9!#\e(B
+\e$B%b!<%I%i%$%s$N:8C<$K$O!"8=:_$N<+J,$N>uBV$r<($90u$,I=<($5$l$^$9!#\e(B
+@footnote{\e$B$b$72hA|$rI=<($G$-$k\e(B Emacs \e$B$r$*;H$$$J$i!":8C<$K\e(B "R" \e$B$N%"%$%3%s\e(B
+\e$B$,I=<($5$l$^$9!#\e(B}
 
 @example
-Riece: --- ueno #Riece [n]
+Riece: ---- ueno #Riece [n]
 @end example
 
-\e$B$3$3$G!"\e(B@samp{---} \e$B$NItJ,$K$O:8$+$i=g$K0J2<$N0UL#$,$"$j$^$9!#\e(B
+\e$B$3$3$G!"\e(B@samp{----} \e$B$NItJ,$K$O:8$+$i=g$K0J2<$N0UL#$,$"$j$^$9!#\e(B
 
 @enumerate
 @item
 \e$BN%@J>uBV\e(B (\e$BN%@J$7$F$$$l$P\e(B @samp{A})
 
 @item
-\e$B%*%Z%l!<%?>uBV\e(B (IRC \e$B%*%Z%l!<%?$G$"$l$P\e(B @samp{O})
+IRC \e$B%*%Z%l!<%?>uBV\e(B (IRC \e$B%M%C%H%o!<%/$N4IM}<T8"8B$r;}$C$F$$$l$P\e(B @samp{O})
+
+@item
+\e$B%&%#%s%I%&$N<+F0%9%/%m!<%k$N6X;_\e(B (\e$B40A4$K6X;_$7$F$$$l$P\e(B @samp{F}\e$B!"<+J,$N\e(B
+\e$B<!2s$NH/8@$^$G6X;_$7$F$$$k$N$G$"$l$P\e(B @samp{f})
 
 @item
-\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$N%9%/%m!<%k6X;_>uBV\e(B
-(\e$B40A4$K6X;_$7$F$$$l$P\e(B @samp{F}\e$B!"<+J,$N<!2s$NH/8@$^$G6X;_$7$F$$$k$N$G$"$l\e(B
-\e$B$P\e(B @samp{f})
+\e$B%A%c%s%M%k%*%Z%l!<%?>uBV\e(B (\e$B%A%c%s%M%k$N4IM}<T8"8B$r;}$C$F$$$l$P\e(B @samp{@@})
 @end enumerate
 
-@node Commands, Connecting to multiple servers, Indicators, Basic usage
+@node Commands,  , Indicators, Basic usage
 @section Commands
 
-\e$BJ8>O$rF~NO$7$?%P%C%U%!$O!"%3%^%s%I%P%C%U%!$H8F$P$l!"%3%^%s%I%P%C%U%!$+$i\e(B
-\e$B$OMM!9$J%3%^%s%I$rH/9T$9$k$3$H$,$G$-$^$9!#0J2<$K0lIt$r5s$2$^$9!#\e(B
+@ref{Basic usage}\e$B$GJ8>O$rF~NO$7$?%P%C%U%!$O%3%^%s%I%P%C%U%!$H8F$P$l$^$9!#\e(B
+\e$B%3%^%s%I%P%C%U%!$+$i$OJ8>O$rAw?.$9$k0J30$K!"MM!9$J%3%^%s%I$rH/9T$9$k$3$H\e(B
+\e$B$,$G$-$^$9!#0J2<$K0lIt$r5s$2$^$9!#\e(B
+
+\e$B:G=i$O$J$+$J$+3P$($K$/$$$G$9$,!"\e(B@kbd{C-h b}
+ (@kbd{M-x describe-bindings}) \e$B$G;HMQ2DG=$J%-!<A`:n$N0lMw$,I=<($5$l$k$N\e(B
+\e$B$G>/$7$:$D3P$($F$$$/$HNI$$$G$7$g$&!#\e(B
 
 @subsection IRC commands
 @table @kbd
@@ -320,47 +286,44 @@ IRC \e$B$r$d$a$^$9\e(B(@code{riece-command-quit})
 \e$B%A%c%s%M%k$N%b!<%I$r@_Dj$7$^$9\e(B(@code{riece-command-change-mode})
 @item C-c o
 @findex riece-command-set-operators
-\e$B%f!<%6$K%*%Z%l!<%?8"8B$rM?$($^$9!#A0CV0z?t\e(B (@kbd{C-u}) \e$B$rM?$($k$H!"%f!<%6$+$i%*%Z%l!<%?8"8B$rC%$$$^$9\e(B(@code{riece-command-set-operators})
+\e$B%f!<%6$K%A%c%s%M%k$N4IM}<T8"8B$rM?$($^$9!#\e(B@kbd{C-u C-c o} \e$B$G$O5U$K!"%f!<%6$+$i%A%c%s%M%k$N4IM}<T8"8B$rC%$$$^$9\e(B(@code{riece-command-set-operators})
 @item C-c v
 @findex riece-command-set-speakers
-\e$B%f!<%6$KH/8@8"$rM?$($^$9!#A0CV0z?t\e(B (@kbd{C-u}) \e$B$rM?$($k$H!"%f!<%6$+$iH/8@8"$rC%$$$^$9\e(B(@code{riece-command-set-speakers})
+\e$B%f!<%6$K%A%c%s%M%k$G$NH/8@8"$rM?$($^$9!#\e(B@kbd{C-u C-c v} \e$B$G$O5U$K!"%f!<%6$+$i%A%c%s%M%k$G$NH/8@8"$rC%$$$^$9\e(B(@code{riece-command-set-speakers})
 @item C-c V
 @findex riece-version
-Riece \e$B$N%P!<%8%g%s$rI=<($7$^$9!#A0CV0z?t\e(B (@kbd{C-u}) \e$B$rM?$($k$H!"$h$j>\:Y$J>pJs$rI=<($7$^$9!#\e(B
+Riece \e$B$N%P!<%8%g%s$rI=<($7$^$9!#\e(B(@kbd{C-u C-c V}) \e$B$G!"$h$j>\:Y$J>pJs$rI=<($7$^$9!#\e(B
 @item C-c /
 @findex riece-command-raw
-\e$B@8$N\e(B IRC \e$B%3%^%s%I$rAw$j$^$9\e(B(@code{riece-command-raw})
+IRC \e$B%3%^%s%I$rD>@\Aw$j$^$9\e(B(@code{riece-command-raw})
 @end table
 
 @subsection Window manipulating commands
 @table @kbd
 @item C-c r
 @findex riece-command-configure-windows
-\e$B%&%#%s%I%&$r:FIA2h$7$^$9\e(B(@code{riece-command-configure-windows})
-@item C-c C-j
+\e$B%U%l!<%`A4BN$r:FIA2h$7$^$9\e(B(@code{riece-command-configure-windows})
+@item C-c C-j \e$B$^$?$O\e(B C-c >
 @findex riece-command-next-channel
-\e$B<!$N%A%c%s%M%k$K0\$j$^$9\e(B(@code{riece-command-next-channel})
+\e$B%A%c%s%M%k0lMw$G<!$N%A%c%s%M%k$rA*Br$7$^$9\e(B(@code{riece-command-next-channel})
 @item C-c <
 @findex riece-command-previous-channel
-\e$BA0$N%A%c%s%M%k$K0\$j$^$9\e(B(@code{riece-command-previous-channel})
-@item C-c >
-@findex riece-command-next-channel
-\e$B<!$N%A%c%s%M%k$K0\$j$^$9\e(B(@code{riece-command-next-channel})
+\e$B%A%c%s%M%k0lMw$GA0$N%A%c%s%M%k$rA*Br$7$^$9\e(B(@code{riece-command-previous-channel})
 @item C-c ^
 @findex riece-command-list-addons
 \e$B%"%I%*%s$N0lMw$rI=<($7$^$9\e(B(@code{riece-command-list-addons})
 @item C-c \e$B?t;z\e(B
 @findex riece-command-switch-to-channel-by-number
-@var{n}\e$BHVL\$N%A%c%s%M%k$K0\F0$7$^$9\e(B(@code{riece-command-switch-to-channel-by-number})
+\e$B%A%c%s%M%k0lMw$G\e(B @var{n}\e$BHVL\$N%A%c%s%M%k$rA*Br$7$^$9\e(B(@code{riece-command-switch-to-channel-by-number})
 @item C-c C-c \e$B?t;z\e(B
 @findex riece-command-switch-to-channel-by-number
-@var{n} + 10\e$BHVL\$N%A%c%s%M%k$K0\F0$7$^$9\e(B(@code{riece-command-switch-to-channel-by-number})
+\e$B%A%c%s%M%k0lMw$G\e(B @var{n} + 10\e$BHVL\$N%A%c%s%M%k$rA*Br$7$^$9\e(B(@code{riece-command-switch-to-channel-by-number})
 @item C-c Home
 @findex riece-command-beginning-of-buffer
-\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$N%S%e!<$r>eC<$^$G0\F0$7$^$9\e(B(@code{riece-command-beginning-of-buffer})
+\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$r>eC<$^$G%9%/%m!<%k$7$^$9\e(B(@code{riece-command-beginning-of-buffer})
 @item C-c $
 @findex riece-command-end-of-buffer
-\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$N%S%e!<$r2<C<$^$G0\F0$7$^$9\e(B(@code{riece-command-end-of-buffer})
+\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$r2<C<$^$G%9%/%m!<%k$7$^$9\e(B(@code{riece-command-end-of-buffer})
 @item C-c SPC
 @findex riece-command-scroll-up
 \e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$r>eJ}8~$K%9%/%m!<%k$7$^$9\e(B(@code{riece-command-scroll-up})
@@ -382,103 +345,85 @@ Riece \e$B$N%P!<%8%g%s$rI=<($7$^$9!#A0CV0z?t\e(B (@kbd{C-u}) \e$B$rM?$($k$H!"$h$j>\
 \e$B%f!<%6%j%9%H%P%C%U%!$NI=<(!&HsI=<($r@Z$jBX$($^$9\e(B(@code{riece-command-toggle-user-list-buffer-mode})
 @item C-c C-t f
 @findex riece-command-toggle-freeze
-\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$rE`7k\e(B(\e$B%9%/%m!<%k$r6X;_\e(B)\e$B$7$^\e(B
+\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$N<+F0%9%/%m!<%k$r6X;_$7$^\e(B
 \e$B$9\e(B(@code{riece-command-toggle-freeze})
 @item C-c C-t o
 @findex riece-command-toggle-own-freeze
-\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$r!"<+J,$,H/8@$9$k$^$GE`7k$7\e(B
-\e$B$^$9\e(B(@code{riece-command-toggle-own-freeze})
+\e$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$r!"<+J,$,H/8@$9$k$^$G!"<+F0\e(B
+\e$B%9%/%m!<%k$r6X;_$7$^$9\e(B(@code{riece-command-toggle-own-freeze})
 @item C-c C-t a
 @findex riece-command-toggle-away
 \e$B<+J,$NN%@J>uBV$r@Z$jBX$($^$9\e(B(@code{riece-command-toggle-away})
 @end table
 
-@node Connecting to multiple servers,  , Commands, Basic usage
-@section Connecting to multiple servers
-
-Riece \e$B$NBg$-$JFCD9$K!"J#?t$N%5!<%P$KF1;~$K@\B3$9$k5!G=$,$"$j$^$9!#\e(B
-
-\e$B?7$?$J%5!<%P$K@\B3$7!"$=$N%5!<%P>e$N%A%c%s%M%k$K;22C$9$k<j=g$O0J2<$N$h$&\e(B
-\e$B$K$J$j$^$9!#\e(B
-
-@enumerate
-@item
-@kbd{C-c O} (@code{riece-command-open-server}) \e$B$H$7$^$9!#%5!<%PL>$rJ9$+$l$k$N$GEz$($^$9!#\e(B
-
-@item
-@kbd{C-c j} (@code{riece-command-join}) \e$B$G%A%c%s%M%k$K;22C$7$^$9!#$3$3$G!"\e(B
-\e$B%A%c%s%M%kL>$N8e$K6uGr$G6h@Z$C$F%5!<%PL>$rB3$1$^$9!#6uGr$rF~NO$9$k$K$O!"\e(B
-@kbd{C-q} \e$B$r;H$$$^$9!#$?$H$($P!"%5!<%P\e(B @samp{irc6} \e$B>e$N\e(B @samp{#Riece} \e$B$K;22C$9$k$K$O\e(B @kbd{C-c j #Riece C-q SPC irc6} \e$B$H%?%$%W$9$k$3$H$K$J$j$^$9!#\e(B
-@end enumerate
-
-\e$B%A%c%s%M%k$KF~$i$:$K%3%^%s%I$rAw$k$K$O!"\e(B@kbd{C-c M}
-(@code{riece-command-universal-server-name-argument}) \e$B$,JXMx$G$9!#\e(B
-
-\e$B%5!<%P$H$N@\B3$K4X$9$k%3%^%s%I$O0J2<$NDL$j$G$9!#\e(B
-
-@table @kbd
-@item C-c O
-@findex riece-command-open-server
-\e$BJL$N%5!<%P$K@\B3$7$^$9\e(B(@code{riece-command-open-server})
-@item C-c C
-@findex riece-command-close-server
-\e$B%5!<%P$H$N@\B3$r@ZCG$7$^$9\e(B(@code{riece-command-close-server})
-@item C-c M
-@findex riece-command-universal-server-name-argument
-\e$BFCDj$N%5!<%P$KBP$7$F!"B3$/%3%^%s%I$rH/9T$7$^$9\e(B(@code{riece-command-universal-server-name-argument})
-@end table
-
 @node Advanced usage, Tips, Basic usage, Top
 @chapter Advanced usage
 
 \e$B$3$N>O$G$O!"$b$C$H?J$s$@;H$$J}$r2r@b$7$^$9!#\e(B
 
 @menu
+* Startup File::                \e$B@_Dj%U%!%$%k\e(B
 * Server settings::             \e$B%5!<%P$N>\:Y@_Dj\e(B
+* Connecting to multiple servers::  \e$BF1;~$KJ#?t$N%5!<%P$K@\B3$9$k$K$O\e(B
 * Add-ons::                     \e$B%"%I%*%s$H$O\e(B
 @end menu
 
-@node Server settings, Add-ons, Advanced usage, Advanced usage
+@node Startup File, Server settings, Advanced usage, Advanced usage
+@section Startup file
+
+\e$B$3$N>O$G$O!"@_Dj%U%!%$%k$K$D$$$F2r@b$7$^$9!#\e(BRiece \e$B$N@_Dj$O\e(B Emacs \e$B$N@_Dj\e(B
+\e$B%U%!%$%k$K=q$$$F$bNI$$$G$9$,!"\e(BRiece \e$B$K8GM-$N@_Dj$O$J$k$Y$/\e(B 
+@file{~/.riece/init} \e$B$K=q$/$3$H$r4+$a$^$9!#\e(B
+
+\e$B$^$?!"\e(BRiece \e$B$r;H$$;O$a$k$H\e(B @file{~/.riece/save} \e$B$H$$$&%U%!%$%k$,:n@.$5$l\e(B
+\e$B$^$9!#$3$N%U%!%$%k$K$OA02s5/F0;~$N@_Dj$N0lIt\e(B(\e$B%&%#%s%I%&9=@.Ey\e(B)\e$B$,<+F0E*$K\e(B
+\e$BJ]B8$5$l$^$9!#\e(B
+
+\e$B5/F0;~$K$O!":G=i$K\e(B @file{~/.riece/save} \e$B$r!"<!$K\e(B @file{~/.riece/init}\e$B$r\e(B
+\e$BFI$_9~$_$^$9!#$D$^$j!"A02s5/F0;~$K\e(B @file{~/.riece/save} \e$B$KJ]B8$5$l$?FbMF\e(B
+\e$B$O!"\e(B@file{~/.riece/init} \e$B$NFbMF$G>e=q$-$5$l$^$9!#\e(B
+
+@node Server settings, Connecting to multiple servers, Startup File, Advanced usage
 @section Server settings
 
-\e$B5/F0;~$K%G%U%)%k%H$G@\B3$9$k\e(B IRC \e$B%5!<%P$O\e(B @code{riece-server} \e$B$G;XDj$7$^$9!#\e(B
+\e$B5/F0;~$K@\B3$9$k\e(B IRC \e$B%5!<%P$NL>A0$OJQ?t\e(B @code{riece-server} \e$B$G;XDj$7$^$9!#\e(B
 @vindex riece-server
 
-\e$B$3$3$G\e(B @code{riece-server} \e$B$OJ8;zNs$G$"$j!"$=$N%U%)!<%^%C%H$O<!$N$h$&$K\e(B
-\e$B$J$j$^$9!#\e(B
+@code{riece-server} \e$B$N7A<0$O<!$NDL$j$G$9!#\e(B
 @example
- "<\e$B%5!<%P$N%[%9%HL>\e(B>:<\e$B%]!<%HHV9f\e(B>[:<\e$B%Q%9%o!<%I\e(B>]"
+<\e$B%5!<%P$N%[%9%HL>\e(B>:<\e$B%]!<%HHV9f\e(B>[:<\e$B%Q%9%o!<%I\e(B>]
 @end example
 
-@code{riece-server-alist} \e$B$rE,@Z$K@_Dj$9$k$H!"%-!<%o!<%I$r;H$C$F!"$h$j>\\e(B
-\e$B:Y$J;XDj$,2DG=$K$J$j$^$9!#0J2<$OI.<T$N@_Dj$+$iH4$-=P$7$?Nc$G$9!#\e(B
+@code{riece-server-alist} \e$B$r@_Dj$9$k$H!"$h$jJ#;($J;XDj$,2DG=$K$J$j$^$9!#\e(B
 @vindex riece-server-alist
 
+\e$B0J2<$NNc$r9M$($^$9!#\e(B
+
 @example
 (setq riece-server-alist
-      '(("irc6" :host "irc6.nara.wide.ad.jp")
-        ("plum" :host "localhost" :service 26667
-         :function relay-open-network-stream))
-      riece-server "irc6")
+      '(("foo" :host "irc.example.com" :coding shift_jis)
+        ("bar" :host "irc.example.net" :nickname "baz")))
+
+(setq riece-server "foo")
 @end example
 
-@code{riece-server-alist} \e$B$N3FMWAG$N0UL#$O0J2<$NDL$j$G$9!#\e(B
+\e$B$3$N@_Dj$N0UL#$O0J2<$NDL$j$G$9!#\e(B
 
 @itemize
 @item
-@samp{irc6} \e$B$H$$$&N,5-L>$G\e(B @samp{irc6.nara.wide.ad.jp} \e$B$K@\B3\e(B
+@samp{foo} \e$B$H$$$&L>A0$N\e(B IRC \e$B%5!<%P$N%[%9%HL>$O\e(B @samp{irc.example.com} \e$B$G!";HMQ$9$kJ8;z%3!<%I$O\e(B Shift_JIS
 
 @item
-@samp{plum} \e$B$H$$$&N,5-L>$G\e(B @code{relay-open-network-stream} \e$B$rDL$8$F\e(B (SSH \e$B7PM3$G\e(B) \e$B@\B3\e(B
+@samp{bar} \e$B$H$$$&L>A0$N\e(B IRC \e$B%5!<%P$N%[%9%HL>$O\e(B @samp{irc.example.com} \e$B$G!"$3$N%5!<%P$G$O%K%C%/%M!<%`\e(B @samp{baz} \e$B$r;H$&\e(B
 @end itemize
 
-\e$B;XDj2DG=$J%-!<%o!<%I$O0J2<$NDL$j$G$9!#\e(B
+\e$B;XDj$G$-$k%-!<%o!<%I$N0lMw$O0J2<$NDL$j$G$9!#\e(B
 
 @table @code
 @item :host
 \e$B%5!<%P$N%[%9%HL>$^$?$O\e(B IP \e$B%"%I%l%9\e(B
 @item :service
-\e$B%5!<%P$N%5!<%S%9L>$^$?$O%]!<%HHV9f\e(B (\e$B%G%U%)%k%H$O\e(B 6667)
+\e$B%5!<%P$N%5!<%S%9L>$^$?$O%]!<%HHV9f\e(B
 @item :nickname
 \e$B@\B3;~$N%K%C%/%M!<%`\e(B
 @item :username
@@ -488,10 +433,39 @@ Riece \e$B$NBg$-$JFCD9$K!"J#?t$N%5!<%P$KF1;~$K@\B3$9$k5!G=$,$"$j$^$9!#\e(B
 @item :function
 \e$B@\B3MQ4X?t\e(B
 @item :coding
-\e$B%3!<%G%#%s%0%7%9%F%`\e(B (\e$B%G%U%)%k%H$O\e(B @code{riece-default-coding-system} \e$B$NCM\e(B)
+\e$BJ8;z%3!<%I\e(B
 @end table
 
-@node Add-ons,  , Server settings, Advanced usage
+@node Connecting to multiple servers, Add-ons, Server settings, Advanced usage
+@section Connecting to multiple servers
+
+\e$BF1;~$KJ#?t$N%5!<%P$K@\B3$9$k<j=g$r0J2<$K<($7$^$9!#\e(B
+
+\e$B4{$KFCDj$N%5!<%P$K@\B3$7$F$$$k>uBV$G!"JL$N%5!<%P$K@\B3$9$k$K$O\e(B @kbd{C-c O} (@code{riece-command-open-server}) \e$B$r;H$$$^$9!#\e(B
+
+\e$BJL$N%5!<%P>e$N%A%c%s%M%k$K;22C$9$k$K$O!"\e(B@kbd{C-c j} (@code{riece-command-join})\e$B$G%A%c%s%M%kL>$K%5!<%PL>$rB3$1$^$9!#\e(B
+
+\e$B$?$H$($P!"%5!<%P\e(B @samp{irc.freenode.net} \e$B>e$N\e(B @samp{#Riece} \e$B$O<!$N$h$&$KI=5-$7$^$9!#\e(B
+
+@example
+#Riece@@irc.freenode.net
+@end example
+
+\e$BJ#?t$N@\B3$rA`:n$9$k%3%^%s%I$r0J2<$K$^$H$a$^$9!#\e(B
+
+@table @kbd
+@item C-c O
+@findex riece-command-open-server
+\e$BJL$N%5!<%P$K@\B3$7$^$9\e(B(@code{riece-command-open-server})
+@item C-c C
+@findex riece-command-close-server
+\e$B%5!<%P$H$N@\B3$r@ZCG$7$^$9\e(B(@code{riece-command-close-server})
+@item C-c M
+@findex riece-command-universal-server-name-argument
+\e$BFCDj$N%5!<%P$KBP$7$F!"B3$/%3%^%s%I$rH/9T$7$^$9\e(B(@code{riece-command-universal-server-name-argument})
+@end table
+
+@node Add-ons,  , Connecting to multiple servers, Advanced usage
 @section Add-ons
 
 Riece \e$B$G$O!"%f!<%6$,?7$?$J5!G=$rDI2C$7!"<+M3$K<h$j30$7$G$-$k$h$&!"%"%I%*\e(B
@@ -566,42 +540,38 @@ PING \e$B$K1~Ez$9$k\e(B local proxy \e$B7PM3$G\e(B IRC \e$B%5!<%P$K@\B3\e(B
 \e$B%-!<%o!<%I$r\e(B Google \e$B$G8!:w\e(B
 @item riece-keepalive
 IRC \e$B%5!<%P$H$N@\B3$rJ];}\e(B
+@item riece-eval-ruby
+\e$BF~NO$5$l$?J8;zNs$r\e(B Ruby \e$B$N<0$H$7$FI>2A\e(B
 @end table
 
 \e$B$3$l$i$N$&$A!"\e(B@samp{riece-highlight} \e$B$H\e(B @samp{riece-ctcp}\e$B!"\e(B
 @samp{riece-url}\e$B!"\e(B @samp{riece-unread}\e$B!"\e(B @samp{riece-guess}\e$B!"\e(B
 @samp{riece-history}\e$B!"\e(B @samp{riece-button}\e$B!"\e(B@samp{riece-menu}\e$B!"\e(B
 @samp{riece-ignore}\e$B!"\e(B@samp{riece-log}\e$B!"\e(B@samp{riece-alias}\e$B!"\e(B
-@samp{riece-ctlseq}\e$B!"\e(B@samp{riece-keyword} \e$B$O%G%U%)%k%H$GAH$_9~$^$l$F$$$^$9!#\e(B
+@samp{riece-ctlseq}\e$B!"\e(B@samp{riece-keyword} \e$B$OI8=`$GAH$_9~$^$l$F$$$^$9!#\e(B
 
 \e$B%"%I%*%s$rAH$_9~$`$K$O\e(B @code{riece-addons} \e$B$r@_Dj$7$^$9!#$?$H$($P\e(B 
-@samp{riece-alias} \e$B$rAH$_9~$`>l9g$K$O!"\e(B@file{~/.riece/init.el} \e$B$K0J2<$N$h\e(B
+@samp{riece-alias} \e$B$rAH$_9~$`>l9g$K$O!"\e(B@file{~/.riece/init} \e$B$K0J2<$N$h\e(B
 \e$B$&$K5-=R$7$^$9!#\e(B
 @vindex riece-addons
 
 @example
-(add-to-list 'riece-addons 'riece-alias)
+(add-to-list 'riece-addons 'riece-keyword)
 @end example
 
-@node Tips, Development, Advanced usage, Top
+@node Tips, Index, Advanced usage, Top
 @comment  node-name,  next,  previous,  up
 @chapter Tips
 
-\e$B$3$N>O$G$O!"$h$/J9$+$l$k<ALd$KBP$9$kEz$($d!"JXMx$J@_Dj$r>R2p$7$^$9!#\e(B
-
-@section \e$B%A%c%s%M%kL>!V\e(B#\e$B$[$2\e(B:*.jp\e$B!W$r!V\e(B%\e$B$[$2!W$HN,5-$7$?$$\e(B
-
-\e$B0J2<$N9T$r\e(B @file{~/.riece/init.el} \e$B$KDI2C$7$^$9!'\e(B
-
-@example
-(add-to-list 'riece-addons 'riece-alias)
-@end example
+\e$B$3$N>O$G$O!"$h$/J9$+$l$k<ALd$KBP$9$kEz$($HJXMx$J@_DjNc$r>R2p$7$^$9!#\e(B
 
-@section \e$BD>A0$K$$$?%A%c%s%M%k$KLa$j$?$$\e(B
+@section \e$BD>A0$KA*Br$7$F$$$?%A%c%s%M%k$K0\F0$7$?$$\e(B
 @vindex riece-guess-channel-try-functions
 
-\e$B0J2<$N9T$r\e(B @file{~/.riece/init.el} \e$B$KDI2C$9$k$3$H$G!"\e(B
-@kbd{C-c g} \e$B$GMzNr$rC)$j$D$D0\F0$G$-$^$9!#\e(B
+\e$B0J2<$N9T$r\e(B @file{~/.riece/init} \e$B$KDI2C$9$k$3$H$G!"\e(B@kbd{C-c g} \e$B$GMzNr$rC)\e(B
+\e$B$j$D$D0\F0$G$-$^$9!#\e(B@samp{riece-guess} \e$B%"%I%*%s$O!"%A%c%s%M%kA*Br$NMzNr\e(B
+\e$B$dL$FI%a%C%;!<%8$NM-L5$J$I$+$i<!$KA*Br$9$k%A%c%s%M%k$r?dB,$7$F$/$l$k%"%I\e(B
+\e$B%*%s$G!"I8=`$GAH$_9~$^$l$F$$$^$9!#\e(B
 
 @example
 (add-hook 'riece-guess-channel-try-functions
@@ -610,50 +580,36 @@ IRC \e$B%5!<%P$H$N@\B3$rJ];}\e(B
 
 @section \e$BH/8@$,$"$k$H%P%C%U%!$,%9%/%m!<%k$9$k$N$r;_$a$?$$\e(B
 
-@kbd{C-c C-t f} \e$B$G$9!#\e(B(irchat \e$B$G$O\e(B @kbd{C-c C-f}) "t"oggle "f"reeze \e$B$H3P\e(B
-\e$B$($^$7$g$&!#\e(B
+@kbd{C-c C-t f} \e$B$G$9!#\e(B@emph{t}oggle @emph{f}reeze \e$B$H3P$($k$HNI$$$G$7$g$&!#\e(B
 
-@section \e$BGI<j$JAu>~$rM^@)$7$?$$\e(B
+@section \e$BAu>~$rM^@)$7$?$$\e(B
 
-@code{riece-addons} \e$B$+$i!"?'IU$1\e(B (@samp{riece-highlight})\e$B!"%\%?%s\e(B 
-(@samp{riece-button})\e$B!"%"%$%3%s\e(B (@samp{riece-icon}) \e$B$r=|$-$^$9!#\e(B
+@code{riece-addons} \e$B$+$iAu>~$N$?$a$N%"%I%*%s$r=|30$7$^$9!#\e(B
+\e$BDL>oM-8z$K$J$C$F$$$kAu>~$N$?$a$N%"%I%*%s$O<!$NDL$j$G$9!#\e(B
 
-\e$B$?$H$($P?'IU$1$r$d$a$?$$$N$G$"$l$P!"0J2<$N9T$r\e(B @file{~/.riece/init.el} 
-\e$B$KDI2C$7$^$9!'\e(B
+@itemize
+@item
+\e$B?'IU$1\e(B (@samp{riece-highlight})
 
-@example
-(setq riece-addons (delq 'riece-highlight riece-addons))
-@end example
+@item
+\e$B%\%?%sI=<(\e(B (@samp{riece-button})
 
-@section \e$B%-!<%o!<%I$KH?1~$7$F2;$rLD$i$7$?$$\e(B
-@vindex riece-keyword-notify-functions
+@item
+\e$B%"%$%3%s2hA|$NI=<(\e(B (@samp{riece-icon})
+@end itemize
 
-XEmacs \e$B$G$O!"0J2<$N@_Dj$r\e(B @file{~/.riece/init.el} \e$B$K2C$($k$3$H$G!"\e(B"\e$B$[$2\e(B" 
-\e$B$d\e(B "\e$B$U$,\e(B" \e$B$KH?1~$7$F8z2L2;\e(B(\e$B$3$NNc$G$O!"%+%C%3!<$NLD$-@<\e(B)\e$B$rLD$i$9$3$H$,$G\e(B
-\e$B$-$^$9!#\e(B
+\e$B$?$H$($P?'IU$1$r$d$a$?$$$N$G$"$l$P!"0J2<$N9T$r\e(B @file{~/.riece/init} \e$B$KDI\e(B
+\e$B2C$7$^$9!'\e(B
 
 @example
-(load-default-sounds)
-(setq riece-keywords '("\e$B$[$2\e(B" "\e$B$U$,\e(B"))
-(add-hook 'riece-keyword-notify-functions
-          (lambda (keyword message) (play-sound 'cuckoo)))
+(setq riece-addons (delq 'riece-highlight riece-addons))
 @end example
 
-Emacs \e$B$N>l9g$O\e(B,\e$B0J2<$N@_Dj$r\e(B @file{~/.riece/init.el} \e$B$K2C$($k$3$H$G\e(B,
-"\e$B$[$2\e(B" \e$B$d\e(B "\e$B$U$,\e(B" \e$B$KH?1~$7$F2;$rLD$i$9$3$H$,$G$-$^$9!#\e(B
-
-@example
-(defun cuckoo ()
-  "play cuckoo.au"
-  (call-process "play" nil 0 t
-                ".../cuckoo.au"))
-  (setq riece-keywords '("\e$B$[$2\e(B" "\e$B$U$,\e(B"))
-  (add-hook 'riece-keyword-notify-functions
-            (lambda (keyword message) (cuckoo)))
-@end example
+@section \e$BFCDj$NJ8;zNs$r<u?.$7$?$i2;$rLD$i$7$?$$\e(B
+@vindex riece-keyword-notify-functions
 
-\e$B8z2L2;$G$O$J$/%7%s%W%k$K%S!<%W2;$rLD$i$7$?$$>l9g$O!"0J2<$N@_Dj$r\e(B 
-@file{~/.riece/init.el} \e$B$K2C$($^$9!#\e(B
+\e$B0J2<$N@_Dj$r\e(B @file{~/.riece/init} \e$B$K2C$($^$9!#\e(B@samp{riece-keywords} \e$B%"%I\e(B
+\e$B%*%s$r;H$&$HFCDj$NJ8;zNs$r<u?.$7$?:]$NF0:n$r;XDj$G$-$^$9!#\e(B
 
 @example
 (setq riece-keywords '("\e$B$[$2\e(B" "\e$B$U$,\e(B"))
@@ -661,61 +617,86 @@ Emacs \e$B$N>l9g$O\e(B,\e$B0J2<$N@_Dj$r\e(B @file{~/.riece/init.el} \e$B$K2C$($k$3$H$
           (lambda (keyword message) (ding)))
 @end example
 
-@section SKK \e$B$r;H$C$F$$$F!"JQ49%b!<%I$N0u\e(B (\e$B"&\e(B) \e$B$rAw?.$7$?$/$J$$\e(B
+@section SKK \e$B$r;H$C$F$$$F!"JQ49Cf$N0u\e(B (\e$B"&\e(B) \e$B$rAw?.$7$F$7$^$&$3$H$,$"$k\e(B
 
-\e$B0J2<$N9T$r\e(B @file{~/.riece/init.el} \e$B$KDI2C$7$^$9!'\e(B
+\e$B0J2<$N9T$r\e(B @file{~/.riece/init} \e$B$KDI2C$7$^$9!#\e(B
 
 @example
 (add-to-list 'riece-addons 'riece-skk-kakutei)
 @end example
 
-@section \e$B%A%c%s%M%k$NHV9f$r8GDj$7$?$$\e(B
+@section \e$B%A%c%s%M%k0lMw$NJB$S=g$r8GDj$7$?$$\e(B
 @vindex riece-default-channel-binding
 
-\e$B0J2<$N9T$r\e(B @file{~/.riece/init.el} \e$B$KDI2C$7$^$9!'\e(B
+\e$B0J2<$N9T$r\e(B @file{~/.riece/init} \e$B$KDI2C$7$^$9!#\e(B
 
 @example
 (setq riece-default-channel-binding
      '("#Riece" "#emacsen" nil "#debianjp"))
 @end example
 
-1: #Riece, 2: #emacsen, 4: #debianjp \e$B$N$h$&$K3dEv$F$i$l$^$9!#\e(Bnil \e$B$O%G%U%)\e(B
-\e$B%k%H$G$O<+F03dEv$F$NBP>]$K$J$i$J$$$3$H0UL#$7!"?7$?$J%A%c%s%M%k$K;22C$7$?\e(B
-\e$B>l9g!"$=$N%A%c%s%M%k$,\e(B 3 \e$BHVL\$N%A%c%s%M%k$H$7$F07$o$l$^$9!#\e(B
+\e$B$3$N@_DjNc$G$O!"%A%c%s%M%k0lMw$NJB$S=g$O<!$N$h$&$K$J$j$^$9!#\e(B
+
+@enumerate
+@item
+#Riece
+@item
+#emacsen
+@item
+\e$B$J$7\e(B
+@item
+#debianjp
+@end enumerate
+
+3 \e$BHVL\$N%A%c%s%M%k$,6u@J$H$J$C$F$$$k$3$H$K$4Cm0U$/$@$5$$!#?7$?$J%A%c%s%M\e(B
+\e$B%k$K;22C$7$?>l9g!"$=$N%A%c%s%M%k$,\e(B 3 \e$BHVL\$N0LCV$K3dEv$F$i$l$^$9!#\e(B
 
-@section \e$B5/F0;~$K%Q%9%o!<%I$D$-$N%A%c%s%M%k$K;22C$7$?$$\e(B
+@section \e$B5/F0;~$K<+F0E*$K%A%c%s%M%k$K;22C$7$?$$\e(B
 @vindex riece-startup-channel-list
-@vindex riece-startup-server-list
 
-\e$B0J2<$N9T$r\e(B @file{~/.riece/init.el} \e$B$KDI2C$7$^$9!'\e(B
+\e$BJQ?t\e(B @samp{riece-startup-channel-list} \e$B$r@_Dj$7$^$9!#\e(B
 
 @example
 (setq riece-startup-channel-list
-     '(("#secret" "password") "#Riece"))
+     '("#Riece" "#public"))
 @end example
 
-\e$BJ#?t$N%5!<%P>e$N%A%c%s%M%k$K;22C$9$k$K$O!"\e(B
-@code{riece-startup-server-list} \e$B$bJ;$;$F@_Dj$9$kI,MW$,$"$j$^$9!#\e(B
+\e$B$3$N@_DjNc$O!"\e(B@samp{#Riece} \e$B$H\e(B @samp{#public} \e$B$K;22C$9$k$3$H$r0UL#$7$F$$\e(B
+\e$B$^$9!#%A%c%s%M%k$K;22C$9$k:]$K%Q%9%o!<%I$,I,MW$J>l9g$K$O<!$N$h$&$K@_Dj$7\e(B
+\e$B$^$9!#\e(B
 
-\e$BNc$H$7$F!"\e(B@code{riece-server} \e$B$H\e(B @code{riece-server-alist} \e$B$r0J2<$N$h$&\e(B
-\e$B$K@_Dj$7$?$H$7$^$9!#\e(B
+@example
+(setq riece-startup-channel-list
+     '("#Riece" "#public" ("#private" "password")))
+@end example
+
+\e$B5/F0;~$K!"J#?t$N\e(B IRC \e$B%5!<%P$N%A%c%s%M%k$K;22C$9$k>l9g$K$O!"\e(B
+\e$BJQ?t\e(B @samp{riece-startup-server-list} \e$B$bF1;~$K@_Dj$9$kI,MW$,$"$j$^$9!#\e(B
+
+@section \e$B5/F0;~$K<+F0E*$KJ#?t$N\e(B IRC \e$B%5!<%P$K@\B3$7$?$$\e(B
+@vindex riece-startup-server-list
+
+\e$BJQ?t\e(B @samp{riece-startup-server-list} \e$B$r@_Dj$7$^$9!#\e(B
 
 @example
 (setq riece-server "ircnet"
-      riece-server-alist '(("ircnet" :host "irc6.nara.wide.ad.jp")
+      riece-server-alist '(("ircnet" :host "irc.tokyo.wide.ad.jp")
                            ("freenode" :host "irc.ipv6.freenode.net")))
 @end example
 
-\e$B$3$N>l9g!"%G%U%)%k%H$G$O\e(B "ircnet" \e$B$@$1$K@\B3$7$^$9$,!"\e(B
-@code{riece-startup-server-list} \e$B$r0J2<$N$h$&$K@_Dj$9$k$3$H$G!"\e(B
+\e$B$3$N@_DjNc$G$O!"5/F0;~$K\e(B "ircnet" \e$B$K@\B3$7$^$9!#\e(B
+@samp{riece-startup-server-list} \e$B$r0J2<$N$h$&$K@_Dj$9$k$H!"\e(B
 "freenode" \e$B$K$b@\B3$9$k$h$&$K$J$j$^$9!#\e(B
 
 @example
 (setq riece-startup-server-list '("freenode"))
 @end example
 
-@section HTTP \e$B%W%m%-%71[$7$K\e(B IRC \e$B%5!<%P$K@\B3$7$?$$\e(B
-relay.el \e$B$H\e(B connect.c \e$B$r;H$&$H!"\e(B
+\e$B5/F0;~$K!"J#?t$N\e(B IRC \e$B%5!<%P$N%A%c%s%M%k$K;22C$9$k>l9g$K$O!"\e(B
+\e$BJQ?t\e(B @samp{riece-startup-channel-list} \e$B$bF1;~$K@_Dj$9$kI,MW$,$"$j$^$9!#\e(B
+
+@section HTTP \e$B%W%m%-%7$r2p$7$F\e(B IRC \e$B%5!<%P$K@\B3$7$?$$\e(B
+@file{relay.el} \e$B$H\e(B @file{connect.c} \e$B$r;H$&$H!"\e(B
 HTTP \e$B%W%m%-%7$r2p$7$F\e(B IRC \e$B%5!<%P$K@\B3$9$k$3$H$,$G$-$^$9!#\e(B
 
 @table @asis
@@ -726,8 +707,9 @@ HTTP \e$B%W%m%-%7$r2p$7$F\e(B IRC \e$B%5!<%P$K@\B3$9$k$3$H$,$G$-$^$9!#\e(B
 @uref{http://www.taiyo.co.jp/~gotoh/ssh/connect.html}
 @end table
 
-\e$B$?$H$($P!"\e(B"proxy.example.com:8080" \e$B7PM3$G\e(B irc.tokyo.wide.ad.jp \e$B$K@\B3$9\e(B
-\e$B$k>l9g$K$O!"0J2<$N9T$r\e(B @file{~/.riece/init.el} \e$B$KDI2C$7$^$9!'\e(B
+\e$B$?$H$($P!"\e(B@samp{proxy.example.com:8080} \e$B7PM3$G\e(B 
+@samp{irc.tokyo.wide.ad.jp} \e$B$K@\B3$9$k>l9g$K$O!"0J2<$N9T$r\e(B 
+@file{~/.riece/init} \e$B$KDI2C$7$^$9!#\e(B
 
 @example
 (require 'relay)
@@ -740,444 +722,31 @@ HTTP \e$B%W%m%-%7$r2p$7$F\e(B IRC \e$B%5!<%P$K@\B3$9$k$3$H$,$G$-$^$9!#\e(B
                                riece-server-alist))
 @end example
 
-@section IRC \e$B%m%0$r%U%!%$%k$KJ]B8$7$?$$\e(B
+@section \e$B2qOC$N%m%0$r%U%!%$%k$KJ]B8$7$?$$\e(B
 @vindex riece-log-directory-map
 
-\e$B0J2<$N9T$r\e(B @file{~/.riece/init.el} \e$B$KDI2C$7$^$9!'\e(B
-
-@example
-(add-to-list 'riece-addons 'riece-log)
-@end example
+@samp{riece-log} \e$B%"%I%*%s$r;H$&$H!"2qOC$N%m%0$r%U%!%$%k$KJ]B8$7!":F5/F0\e(B
+\e$B;~$K;2>H$G$-$^$9!#\e(B@samp{riece-log} \e$B%"%I%*%s$OI8=`$GAH$_9~$^$l$F$$$^$9!#\e(B
 
-\e$B%m%0%U%!%$%k$O%G%U%)%k%H$G$O\e(B @file{~/.riece/log} \e$B$N2<$K%5!<%PL>!"%A%c%s\e(B
-\e$B%M%kL>$N%G%#%l%/%j$,:n@.$5$l!"$=$NCf$KF|$K$AKh$KJ]B8$5$l$^$9!#$?$@$7%G%U%)\e(B
-\e$B%k%H$N%5!<%P$N>l9g$O!"%5!<%PL>$N%G%#%l%/%H%j$O>JN,$5$l$^$9!#\e(B
+\e$BDL>o$O\e(B @file{~/.riece/log} \e$B$N2<$K\e(B IRC \e$B%5!<%P$NL>A0!"%A%c%s%M%kL>$N%G%#%l\e(B
+\e$B%/%j$,:n@.$5$l!"$=$NCf$KF|$K$AKh$KJ,JL$5$l$FJ]B8$5$l$^$9!#\e(B
 
-US-ASCII \e$B0J30$N%G%#%l%/%H%jL>$,J8;z2=$1$9$k$H$$$&?M$O!"\e(B
+\e$B%G%#%l%/%H%jL>$,J8;z2=$1$9$k>l9g$K$O!"\e(B
 @code{file-name-coding-system} \e$B$NCM$rE,@Z$K@_Dj$9$k$+!"$"$k$$$O\e(B 
-@code{riece-log-directory-map} \e$B$G%A%c%s%M%kL>$HJ]B8@h$N%G%#%l%/%H%jL>$H\e(B
-\e$B$NBP1~%j%9%H$r0J2<$NNc$N$h$&$K!"\e(BUS-ASCII \e$B$N$_$r;HMQ$7$?%G%#%l%/%H%jL>$K\e(B
-\e$B$J$k$h$&$K@_Dj$9$k;v$G2sHr=PMh$^$9!'\e(B
+@code{riece-log-directory-map} \e$B$r;H$C$F%A%c%s%M%kL>$r\e(B US-ASCII \e$BJ8;zNs$K\e(B
+\e$BJQ49$9$kI,MW$,$"$j$^$9!#\e(B
 
 @example
 (setq riece-log-directory-map '(("#\e$B$j!<$9\e(B" . "riece")))
 @end example
 
-@node Development, Index, Tips, Top
-@chapter Development
-
-\e$B3+H/<TJg=8Cf!#\e(B
-
-@menu
-* CVS::                         \e$B3+H/Cf$N%=!<%9$N<hF@\e(B
-* Debugging::                   \e$B%G%P%C%0$N$?$a$N@_Dj\e(B
-* Modules::                     \e$B9=@.%b%8%e!<%k$N@bL@\e(B
-* Namespace management::        
-* Signals::                     
-* Writing add-ons::             \e$B%"%I%*%s$N=q$-$+$?\e(B
-* Handler hooks::               
-@end menu
-
-@node CVS, Debugging, Development, Development
-@section CVS
-
-Riece \e$B$N3+H/$O\e(B CVS \e$B$rMxMQ$7$F9T$C$F$$$^$9!#\e(BCVS \e$B%5!<%P$+$i:G?7$N%9%J%C%W\e(B
-\e$B%7%g%C%H$r<hF@$9$k$K$O0J2<$N$h$&$K$7$^$9!#\e(B
-
-@enumerate
-@item
-CVS \e$B%5!<%P$X$N%m%0%$%s\e(B
-
-@example
-cvs -d :pserver:anonymous@@cvs.m17n.org:/cvs/root login
-CVS password: [CR] # NULL string
-@end example
-
-@item
-\e$B%b%8%e!<%k$N%A%'%C%/%"%&%H\e(B
-
-@example
-cvs -d :pserver:anonymous@@cvs.m17n.org:/cvs/root checkout riece
-@end example
-
-@item
-@file{configure} \e$B$N@8@.\e(B
-
-@example
-autoreconf -f -i -v
-@end example
-@end enumerate
-
-@node Debugging, Modules, CVS, Development
-@section Debugging
-
-@code{riece-debug} \e$B$r\e(B @code{t} \e$B$K@_Dj$9$k$H!"%G%P%C%0=PNO$,M-8z$K$J$j$^\e(B
-\e$B$9!#$^$?!"%5!<%P$+$i$N@8$N=PNO$,\e(B " *IRC*[<\e$B%5!<%PL>\e(B>]" \e$B%P%C%U%!$K>C$5$l$:\e(B
-\e$B$K;D$j$^$9!#\e(B
-@vindex riece-debug
-
-@node Modules, Namespace management, Debugging, Development
-@section Modules
-
-\e$B4pK\E*$K0MB84X78$N>e0L$K$"$k$b$N$+$i!'\e(B
-
-@table @samp
-@item riece-globals
-\e$BBg0hJQ?t$NDj5A\e(B 
-@item riece-options
-\e$B%f!<%6%*%W%7%g%s$NDj5A\e(B 
-@item riece-version
-\e$B%P!<%8%g%s$NDj5A\e(B 
-@item riece-coding
-\e$B%3!<%G%#%s%0%7%9%F%`4XO"$N4X?t$NDj5A\e(B 
-@item riece-complete
-\e$B%_%K%P%C%U%!$G$NJd40$r=u$1$k4X?t$NDj5A\e(B 
-@item riece-addon
-\e$B%"%I%*%s4IM}\e(B
-
-@item riece-mode
-channel/user \e$B$N%b!<%I4IM}\e(B
-@item riece-identity
-channel/user object \e$B$NBg0hI=5-$rA`:n$9$k4X?t$NDj5A\e(B 
-@item riece-channel
-channel object \e$B4XO"$NDj5A\e(B 
-@item riece-user
-user object \e$B4XO"$NDj5A\e(B 
-
-@item riece-misc
-\e$B;(B?$J4X?t$NDj5A\e(B
-@item riece-signal
-\e$B%7%0%J%k\e(B(@pxref{Signals})\e$B4IM}\e(B
-
-@item riece-layout
-\e$B%&%#%s%I%&%l%$%"%&%H4IM}\e(B
-@item riece-display
-\e$BI=<(MQ%P%C%U%!$N4IM}\e(B 
-@item riece-server
-IRC\e$B%5!<%P$H$N@\B34IM}\e(B 
-
-@item riece-naming
-\e$BL>A04IM}$N$?$a$N\e(B mediator \e$B$N$h$&$J$b$N\e(B 
-@item riece-message
-message object \e$B4XO"$NDj5A\e(B 
-
-@item riece-filter
-\e$B%W%m%;%9%U%#%k%?$N%(%s%H%j%]%$%s%H\e(B 
-@item riece-handle
-\e$BDL>o$N%a%C%;!<%8$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B 
-@item riece-000
-000\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B 
-@item riece-200
-200\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B 
-@item riece-300
-300\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B 
-@item riece-400
-400\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B 
-@item riece-500
-500\e$BHVBf$N\e(B numeric reply \e$B$N%O%s%I%i!#\e(Briece-filter \e$B$+$i8F$P$l$k\e(B 
-
-@item riece-commands
-\e$B%3%^%s%I$NDj5A\e(B 
-@item riece-irc
-IRC \e$B%W%m%H%3%k%$%s%?!<%U%'!<%9\e(B
-@item riece
-\e$B%(%s%H%j%]%$%s%H!#3F%P%C%U%!$N%b!<%IDj5A$J$I\e(B 
-@end table
-
-@node Namespace management, Signals, Modules, Development
-@section Namespace management
-
-Riece \e$B$OJ#?t$N%5!<%P$KF1;~$K@\B3$9$k$?$a!"%5!<%PKh$KJL!9$NL>A06u4V$r4IM}\e(B
-\e$B$7$F$$$^$9!#$3$NL>A06u4V$K$O!"%5!<%P$N%W%m%;%9$K7k$SIU$1$i$l$?%P%C%U%!$N\e(B
-\e$B%m!<%+%kJQ?t$r2p$7$F%"%/%;%9$7$^$9!#\e(B
-
-@subsection Obtaining server buffer
-\e$B%5!<%P$N%W%m%;%9$rF@$k$K$O!"$^$:$O$8$a$K%5!<%P$NL>A0$rF@$kI,MW$,$"$j\e(B
-\e$B$^$9!#%5!<%P$NL>A0$O0J2<$K5s$2$k$$$/$D$+$NJ}K!$G<hF@$G$-$^$9!#\e(B
-
-@enumerate
-@item
-@vindex riece-overrinding-server-name
-\e$BBg0hJQ?t\e(B @code{riece-overrinding-server-name} \e$B$NCM\e(B
-
-@item
-@vindex riece-server-name
-@code{riece-server-name} \e$B$,%+%l%s%H%P%C%U%!$N%m!<%+%kJQ?t$G$"$k$J$i$P!"\e(B
-\e$B4{$K%W%m%;%9$N%P%C%U%!$K$$$k$H$_$J$;$k$N$G!"\e(B@code{riece-server-name} \e$B$N\e(B
-\e$BCM$=$N$b$N\e(B
-
-@item
-@samp{riece-identity} \e$B%*%V%8%'%/%H$K7k$SIU$1$i$l$?%5!<%PL>\e(B(\e$B8e=R\e(B)
-@end enumerate
-
-\e$B$3$&$7$FF@$?%5!<%PL>$G\e(B @code{riece-server-process} \e$B$r8F=P$7!"%5!<%P$N\e(B
-\e$B%W%m%;%9$r<hF@$7$^$9!#\e(B
-@findex riece-server-process
-
-@subsection Identity
-\e$BJ#?t$N%5!<%P$K7R$$$@>l9g!"%A%c%s%M%kL>$d%K%C%/$r\e(B(\e$B%5!<%P$N%P%C%U%!>e$@\e(B
-\e$B$1$G$O$J$/\e(B)\e$BBg0hE*$K6hJL$9$kI,MW$,@8$8$^$9!#$3$N$h$&$JL>A0$rI=8=$9$k$N\e(B
-\e$B$,\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H$G$9!#\e(B
-
-@samp{riece-identity} \e$B%*%V%8%'%/%H$O0J2<$N\e(B 2 \e$B$D$NMWAG$r$b$D%Y%/%?!<$G$9!#\e(B
-
-@table @samp
-@item prefix
-\e$B%5!<%P%m!<%+%k$JL>A0\e(B
-@item server
-\e$B%5!<%P$NL>A0\e(B
-@end table
-
-@samp{riece-identity} \e$B%*%V%8%'%/%H$KBP$9$kA`:n$K$O0J2<$N$h$&$J$b$N$,$"$j$^$9!#\e(B
-
-@defun riece-make-identity prefix &optional server
-@samp{riece-identity} \e$B%*%V%8%'%/%H$r:n@.$7$^$9!#\e(Bserver \e$B$,>JN,$5$l$?>l9g$K$O!"\e(B
-riece-find-server-name \e$B$r;H$C$F<hF@$7$?%5!<%PL>$r;H$$$^$9\e(B
-@end defun
-
-@defun riece-identity-prefix identity
-@samp{riece-identity} \e$B%*%V%8%'%/%H$+$i%5!<%P%m!<%+%k$JL>A0$r<h$j=P$7$^$9!#\e(B
-@end defun
-
-@defun riece-identity-server identity
-@samp{riece-identity} \e$B%*%V%8%'%/%H$+$i%5!<%P$NL>A0$r<h$j=P$7$^$9!#\e(B
-@end defun
-
-@defun riece-identity-equal ident1 ident2
-2 \e$B$D$N\e(B@samp{riece-identity} \e$B%*%V%8%'%/%H$,F1Ey$+D4$Y$^$9!#\e(B
-@end defun
-
-@defun riece-identity-equal-no-server ident1 ident2
-2 \e$B$D$N\e(B@samp{riece-identity} \e$B%*%V%8%'%/%H$N%5!<%P%m!<%+%k$JL>A0$,F1Ey$+\e(B
-\e$BD4$Y$^$9!#\e(B
-@end defun
-
-@defun riece-identity-member elt list
-@samp{riece-identity} \e$B%*%V%8%'%/%H\e(B @var{elt} \e$B$,\e(B @var{list} \e$B$K4^$^$l$k\e(B
-\e$B$+8!::$7$^$9!#\e(B
-@end defun
-
-@subsection Channel and user management
-@samp{riece-identity} \e$B%*%V%8%'%/%H$K$h$C$F<1JL$5$l$k\e(B IRC \e$B$N%A%c%s%M%k\e(B
-\e$B$H%f!<%6$O$=$l$>$l\e(B @samp{riece-channel} \e$B%*%V%8%'%/%H$H\e(B 
-@samp{riee-user} \e$B%*%V%8%'%/%H$K$h$jI=8=$5$l$^$9!#\e(B
-
-@subsubsection Channels
-@code{riece-channel} \e$B$O!"\e(BIRC \e$B$N%A%c%s%M%k$rI=$9%*%V%8%'%/%H$G$9!#0J2<$N\e(B
-\e$BMWAG$r;}$A$^$9!#\e(B
-
-@table @samp
-@item users
-\e$B;22C$7$F$$$k%f!<%6$NL>A0\e(B(\e$B6I=jL>\e(B)\e$B$N%j%9%H\e(B 
-@item operators
-\e$B%*%Z%l!<%?8"8B$r$b$D%f!<%6$NL>A0$N%j%9%H\e(B 
-@item speakers
-\e$BH/8@8"$r$b$D%f!<%6$NL>A0$N%j%9%H\e(B 
-@item modes
-\e$B%A%c%s%M%k$N%b!<%I\e(B(\e$BJ8;z$N%j%9%H\e(B) 
-@item banned
-@samp{MODE +b} \e$B$G;XDj$5$l$?%Q%?!<%s$N0lMw\e(B 
-@item invited
-@samp{MODE +I} \e$B$G;XDj$5$l$?%Q%?!<%s$N0lMw\e(B 
-@item uninvited
-@samp{MODE +e} \e$B$G;XDj$5$l$?%Q%?!<%s$N0lMw\e(B
-@end table
-
-@subsubsection Users
-@code{riece-user} \e$B$O!"\e(BIRC \e$B$K;22C$7$F$$$k%f!<%6$rI=$9%*%V%8%'%/%H$G$9!#0J\e(B
-\e$B2<$NMWAG$r;}$A$^$9!#\e(B
-
-@table @samp
-@item channels
-\e$B;22C$7$F$$$k%A%c%s%M%k$NL>A0\e(B(\e$B6I=jL>\e(B)\e$B$N%j%9%H\e(B 
-@item user-at-host
-"<user>@@<host>" \e$B$N7A$GM?$($i$l$k%f!<%6$N>pJs\e(B 
-@item modes
-\e$B%f!<%6$N%b!<%I\e(B(\e$BJ8;z$N%j%9%H\e(B) 
-@item away
-AWAY \e$BCf$+$I$&$+\e(B 
-@end table
-
-@subsubsection Mediator
-\e$B%A%c%s%M%k$H%f!<%6$N;22C!&N%C&$r4IM}$9$k$?$a$K!"\e(B @code{riece-naming} 
-\e$B$H$$$&>e0L$N%b%8%e!<%k$rMQ0U$7$F$$$^$9!#$3$l$O!"%G%6%$%s%Q%?!<%s$G$$$&\e(B
-\e$B$H$3$m$N\e(B Mediator \e$B%Q%?!<%s$KAjEv$9$k$b$N$G$9!#\e(B
-
-@code{riece-naming} \e$B$r2p$9$k$3$H$G!"A0=R$N%A%c%s%M%k!&%f!<%6%*%V%8%'%/%H\e(B
-\e$B$KD>@\<j$r?($l$k$3$H$J$/!"L>A06u4V$K0BA4$K%"%/%;%9$9$k$3$H$,$G$-$^$9!#\e(B
-
-\e$BDs6!$9$k<g$J4X?t$O0J2<$N\e(B 3 \e$B$D$G$9!#\e(B
-
-@defun riece-naming-assert-join user-name channel-name
-\e$B%f!<%6$,%A%c%s%M%k$K;22C$7$?$3$H$rI=L@$7$^$9\e(B
-@end defun
-
-@defun riece-naming-assert-part user-name channel-name
-\e$B%f!<%6$,%A%c%s%M%k$+$iN%C&$7$?$3$H$rI=L@$7$^$9\e(B 
-@end defun
-
-@defun riece-naming-assert-rename old-name new-name
-\e$B%f!<%6$NL>A0$,JQ99$5$l$?$3$H$rI=L@$7$^$9\e(B 
-@end defun
-
-@node Signals, Writing add-ons, Namespace management, Development
-@section Signals
-
-\e$B2hLL$N:FIA2h$r8zN(NI$/9T$&$?$a$K!"%$%Y%s%H$HIA2hBP>]$N%*%V%8%'%/%H\e(B(\e$B%P%C\e(B
-\e$B%U%!$d!"%b!<%I%i%$%s$N0u\e(B @pxref{Indicators})\e$B$r7k$SIU$1$k%a%+%K%:%`$rMQ0U\e(B
-\e$B$7$F$$$^$9!#\e(B
-
-\e$B2?$i$+$N%$%Y%s%H$,H/@8$9$k$H!"%7%0%J%k$,Aw=P$5$l$^$9!#%7%0%J%k$N35G0$O!"\e(B
-Qt \e$B$d\e(B GTK+ \e$B$H$$$C$?\e(B GUI \e$B%D!<%k%-%C%H$KMQ0U$5$l$F$$$k$b$N$HF1MM$G$9!#\e(B
-
-\e$B%7%0%J%k$rAw=P$9$k$K$O!"\e(B@samp{riece-emit-signal} \e$B$r;H$$$^$9!#\e(B
-
-@defun riece-emit-signal signal-name &rest args
-@var{signal-name} \e$B$G;X<($5$l$k%7%0%J%k$r!"0z?t\e(B @var{args} \e$B$H$H$b$KAw=P$7$^$9\e(B
-@end defun
-
-\e$B%7%0%J%k$K1~Ez$9$k$K$O!"\e(B@samp{riece-connect-signal} \e$B$r;H$$$^$9!#\e(B
-
-@defun riece-connect-signal signal-name slot-function &optional filter-function handback
-@var{signal-name} \e$B$G;X<($5$l$k%7%0%J%k$K1~Ez$9$k4X?t\e(B @var{slot-function} 
-\e$B$r7k$SIU$1$^$9!#\e(B@var{slot-function} \e$B$K;XDj$5$l$?4X?t$O\e(B 2 \e$B$D$N0z?t$r<h$j$^\e(B
-\e$B$9!#Bh\e(B1\e$B$N0z?t$O$O%7%0%J%k$rI=$7$^$9!#$^$?!"Bh\e(B2\e$B$N0z?t$H$7$F!"\e(B
-@var{handback} \e$B0z?t$KM?$($i$l$?%*%V%8%'%/%H$,$=$N$^$^EO$5$l$^$9!#\e(B
-
-@var{filter-function} \e$B$O!"<u?.$7$?%7%0%J%k$K1~Ez$9$Y$-$+$I$&$+$rH=Dj$9$k\e(B
-\e$B4X?t$G$9!#$3$N4X?t$O0z?t$H$7$F%7%0%J%k%*%V%8%'%/%H$r<u$1<h$j!"\e(B@samp{nil}
-\e$B$^$?$O\e(B @samp{t} \e$B$rJV$9$3$H$,4|BT$5$l$^$9!#JV$jCM$,\e(B @samp{nil} \e$B$N>l9g$K$O!"\e(B
-@var{slot-function} \e$B$,8F$P$l$k$3$H$O$"$j$^$;$s!#\e(B
-@end defun
-
-\e$B%7%0%J%k%*%V%8%'%/%H$K%"%/%;%9$9$k$K$O!"0J2<$N4X?t$r;H$$$^$9!#\e(B
-
-@defun riece-signal-name
-\e$B%7%0%J%k$NL>A0\e(B(\e$B%7%s%\%k\e(B)\e$B$rJV$7$^$9!#\e(B
-@end defun
-
-@defun riece-signal-args
-\e$B%7%0%J%kAw=P;~$KM?$($i$l$?0z?t$rJV$7$^$9!#\e(B
-@end defun
-
-\e$B8=:_!"0J2<$N%7%0%J%k$,I8=`$GEPO?$5$l$F$$$^$9!'\e(B
-
-@table @samp
-@item channel-list-changed
-\e$B;22C$7$F$$$k%A%c%s%M%k$N0lMw$NJQ2=\e(B
-@item user-list-changed
-\e$B%A%c%s%M%k$N;22C<T0lMw$NJQ2=\e(B
-(\e$B0z?t$O%A%c%s%M%k$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item channel-switched
-\e$B8=:_$N%A%c%s%M%k$r0\F0\e(B
-@item user-joined-channel
-\e$B%f!<%6$,%A%c%s%M%k$K;22C\e(B
-(\e$B0z?t$O!"%f!<%6$*$h$S%A%c%s%M%k$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item user-left-channel
-\e$B%f!<%6$,%A%c%s%M%k$+$iN%C&\e(B
-(\e$B0z?t$O!"%f!<%6$*$h$S%A%c%s%M%k$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item user-renamed
-\e$B%f!<%6$,L>A0$rJQ99\e(B
-(\e$B0z?t$O!"0JA0$H8=:_$NL>A0$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item user-away-changed
-\e$B%f!<%6$NN%@J>uBV$NJQ2=\e(B
-(\e$B0z?t$O!"%f!<%6$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item user-operator-changed
-\e$B%f!<%6$N%*%Z%l!<%?>uBV$NJQ2=\e(B
-(\e$B0z?t$O!"%f!<%6$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item channel-topic-changed
-\e$B%A%c%s%M%k$N%H%T%C%/$NJQ2=\e(B
-(\e$B0z?t$O!"%A%c%s%M%k$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item channel-modes-changed
-\e$B%A%c%s%M%k$N%b!<%I$NJQ2=\e(B
-(\e$B0z?t$O!"%A%c%s%M%k$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item channel-operators-changed
-\e$B%A%c%s%M%k$G%*%Z%l!<%?8"8B$r;}$D%f!<%6$N0lMw$NJQ2=\e(B
-(\e$B0z?t$O!"%A%c%s%M%k$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item channel-speakers-changed
-\e$B%A%c%s%M%k$GH/8@8"$r;}$D%f!<%6$N0lMw$NJQ2=\e(B
-(\e$B0z?t$O!"%A%c%s%M%k$KAjEv$9$k\e(B @samp{riece-identity} \e$B%*%V%8%'%/%H\e(B)
-@item buffer-freeze-changed
-\e$B%P%C%U%!$NE`7k>uBV$NJQ2=\e(B
-(\e$B0z?t$O%P%C%U%!\e(B)
-@end table
-
-@node Writing add-ons, Handler hooks, Signals, Development
-@section Writing add-ons
-
-\e$B%"%I%*%s$N>r7o$rK~$?$9%b%8%e!<%k$O0J2<$N4X?t$rDs6!$7$^$9!#\e(B
-
-@table @samp
-@item <\e$B%b%8%e!<%kL>\e(B>-requires
-\e$B0MB8$9$kB>$N%"%I%*%s\e(B(\e$B%7%s%\%k$N%j%9%H\e(B)\e$B$rJV$7$^$9\e(B(\e$B%*%W%7%g%s\e(B)
-@item <\e$B%b%8%e!<%kL>\e(B>-insinuate
-\e$B=i4|2==hM}$r9T$$$^$9\e(B
-@end table
-
-\e$B$^$?!"%"%I%*%s$N@bL@$r!"JQ?t\e(B @samp{<\e$B%b%8%e!<%kL>\e(B>-description} \e$B$K@_Dj$9\e(B
-\e$B$k$3$H$b$G$-$^$9!#$3$NJ8;zNs$O\e(B @kbd{M-x riece-command-list-addons} \e$B$K$h\e(B
-\e$B$k%"%I%*%s$N0lMwI=<($K;H$o$l$^$9!#\e(B
-
-\e$BM-8z2=!&L58z2=$KBP1~$7$?%"%I%*%s$O!"JQ?t\e(B @samp{<\e$B%b%8%e!<%kL>\e(B>-enabled} 
-\e$B$K8=:_$N>uBV$rJ];}$7$^$9!#CM$,\e(B @samp{nil} \e$B$G$"$l$PL58z!"\e(B@samp{t} \e$B$G$"$l\e(B
-\e$B$PM-8z$G$9!#2C$($F!"0J2<$N4X?t$rDs6!$7$^$9!#\e(B
-
-@table @samp
-@item <\e$B%b%8%e!<%kL>\e(B>-enable
-\e$B%"%I%*%s$rM-8z$K$7$^$9\e(B
-@item <\e$B%b%8%e!<%kL>\e(B>-disable
-\e$B%"%I%*%s$rL58z$K$7$^$9\e(B
-@end table
-
-Riece \e$B$O5/F0;~$K0J2<$N=hM}$r9T$$$^$9!#\e(B
-
-@enumerate
-@item
-\e$BJQ?t\e(B @code{riece-addons} \e$B$KNs5s$5$l$?%b%8%e!<%k$rFI$_9~$`\e(B
-
-@item
-\e$B$=$l$>$l$N%b%8%e!<%k$KBP$7!"\e(B@samp{<\e$B%b%8%e!<%kL>\e(B>-requires} \e$B$,MQ0U$5$l$F$$$l$P8F$S=P$7$F0MB8%0%i%U$r:n$k\e(B
-
-@item
-\e$B0MB8%0%i%U$KBP$7$F%H%]%m%8%+%k%=!<%H\e(B (cf. tsort(1)) \e$B$r9T$&\e(B
-
-@item
-\e$BF@$i$l$?0MB8=g=x$K=>$C$F\e(B @samp{<\e$B%b%8%e!<%kL>\e(B>-insinuate} \e$B8F$S=P$9\e(B
-
-@item
-\e$B$b$7!"%"%I%*%s$,M-8z2=!&L58z2=$KBP1~$7$F$*$j!"L@<(E*$KL58z2=$5$l$F$$$J$1$l$P!"\e(B
-@samp{<\e$B%b%8%e!<%kL>\e(B>-enable}\e$B$r8F$S=P$9!#\e(B
-@end enumerate
-
-\e$B:n@.$7$?%"%I%*%s$O!"\e(B@code{load-path} \e$B$NDL$C$?%G%#%l%/%H%j!"$^$?$O\e(B 
-@code{riece-addon-directory} (\e$B%G%U%)%k%H$G$O\e(B @file{~/.riece/addons/}) \e$B$K\e(B
-\e$BCV$/$3$H$GAH$_9~$_2DG=$J>uBV$K$J$j$^$9!#\e(B
-@vindex riece-addon-directory
-
-@node Handler hooks,  , Writing add-ons, Development
-@section Handler hooks
-
-Riece \e$B$K$O!"%O%s%I%i%U%C%/$H8F$P$l$kFC<l$J%U%C%/$,$"$j$^$9!#$3$l$i$O\e(B IRC 
-\e$B$N%a%C%;!<%8$r<u$1<h$C$?A08e$G<B9T$5$l$k%U%C%/$G$9!#\e(B
-
-\e$B@bL@$N$?$a$K\e(B @samp{message} \e$B$r\e(B IRC \e$B$N%a%C%;!<%8L>\e(B(PRIVMSG \e$B$J$I\e(B)\e$B$rA4$F>.\e(B
-\e$BJ8;z$K$7$?$b$N$H$7$^$9!#\e(B
-
-@table @code
-@item riece-<message>-hook
-@samp{message} \e$B$,FO$$$?$H$-$K:G=i$K8F$P$l$k%U%C%/\e(B
-@item riece-after-<message>-hook
-@samp{message} \e$B$N=hM}$,=*$o$C$?8e$K8F$P$l$k%U%C%/\e(B
-@end table
-
-\e$B$3$3$G\e(B @code{riece-<message>-hook} \e$B$NJV$jCM$K$O0UL#$,$"$j!"Hs\e(B nil \e$B$rJV$9\e(B
-\e$B$b$N$,$"$l$P!"$=$N8e$N=hM}$r$*$3$J$$$^$;$s!#$^$?!"$=$N>l9g$K$O\e(B 
-@code{riece-after-<message>-hook} \e$B$b8F$S=P$5$l$^$;$s!#\e(B
+@section \e$B%&%#%s%I%&4V$r<+M3$K0\F0$7$?$$\e(B
 
-\e$B%U%C%/$N0z?t$O\e(B RFC2812 \e$B$N\e(B @samp{prefix} \e$B$H\e(B @samp{Parameters} \e$B$KAjEv$9$k\e(B 
-2 \e$B$D$N0z?t$,EO$j$^$9!#\e(B
+GNU Emacs \e$B$KImB0$N\e(B @samp{windmove.el} \e$B$r;H$&$HJXMx$G$9!#>\:Y$O\e(B 
+@samp{windmove.el} \e$B$N%3%a%s%H$r;2>H$/$@$5$$!#\e(B@samp{windmove.el} \e$B$O\e(B 
+\e$B:n<T$N%Z!<%8\e(B (@uref{http://hovav.net/elisp/}) \e$B$+$i$b<hF@$G$-$^$9!#\e(B
 
-@node Index, Function Index, Development, Top
+@node Index, Function Index, Tips, Top
 @chapter Index
 @printindex cp
 
index 05d2262..051a7d9 100644 (file)
@@ -11,7 +11,9 @@
                riece-version
                riece-coding
                riece-complete
+               riece-addon-modules
                riece-addon
+               riece-ruby
 
                riece-mode
                ;; riece-identity -+-> riece-channel
 
                riece-commands
                riece-irc
-               riece
-
-               ;; add-ons
-               riece-ctcp
-               riece-highlight
-               riece-log
-               riece-mini
-               riece-rdcc
-               riece-url
-               riece-unread
-               riece-doctor
-               riece-alias
-               riece-skk-kakutei
-               riece-foolproof
-               riece-guess
-               riece-history
-               riece-button
-               riece-keyword
-               riece-menu
-               riece-icon
-               riece-async
-               riece-lsdb
-               riece-xface
-               riece-ctlseq
-               riece-ignore
-               riece-hangman
-               riece-biff
-               riece-kakasi
-               riece-yank
-               riece-toolbar
-               riece-eval
-               riece-google
-               riece-keepalive))))
+               riece))))
 
 (defvar riece-icons
-  '(riece-command-quit
-    riece-command-join
-    riece-command-part
-    riece-command-previous-channel
-    riece-command-next-channel
-    riece-command-change-layout
-    riece-submit-bug-report))
+  '("riece-command-quit.xpm"
+    "riece-command-join.xpm"
+    "riece-command-part.xpm"
+    "riece-command-previous-channel.xpm"
+    "riece-command-next-channel.xpm"
+    "riece-command-change-layout.xpm"
+    "riece-submit-bug-report.xpm"))
+
+(defvar riece-scripts
+  '("server.rb"
+    "aproxy.rb"))
 
 (defun riece-compile-modules (modules)
   (let ((load-path (cons nil load-path))
   WARNING: the last build, and then reconfigure.
   WARNING: ---------------------------------------------------------\n\n")))))
 
+(defun riece-compile-module ()
+  (let ((load-path (cons nil load-path)))
+    (let ((source (expand-file-name
+                  (concat (car command-line-args-left) ".el"))))
+      (if (file-newer-than-file-p source (concat source "c"))
+         (byte-compile-file source)))))
+
 (defun riece-install-modules (modules dest just-print)
   (unless (or just-print (file-exists-p dest))
     (make-directory dest t))
   (unless (or just-print (file-exists-p dest))
     (make-directory dest t))
   (while icons
-    (let ((name (symbol-name (car icons))))
-      (when (file-exists-p (expand-file-name (concat name ".xpm")))
-       (princ (format "%s.xpm -> %s\n" name dest))
-       (unless just-print
-         (copy-file (expand-file-name (concat name ".xpm"))
-                    (expand-file-name (concat name ".xpm") dest)
-                    t t))))
+    (when (file-exists-p (expand-file-name (car icons)))
+      (princ (format "%s -> %s\n" (car icons) dest))
+      (unless just-print
+       (copy-file (expand-file-name (car icons))
+                  (expand-file-name (car icons) dest)
+                  t t)))
     (setq icons (cdr icons))))
 
+(defun riece-install-scripts (scripts dest just-print)
+  (unless (or just-print (file-exists-p dest))
+    (make-directory dest t))
+  (while scripts
+    (when (file-exists-p (expand-file-name (car scripts)))
+      (princ (format "%s -> %s\n" (car scripts) dest))
+      (unless just-print
+       (copy-file (expand-file-name (car scripts))
+                  (expand-file-name (car scripts) dest)
+                  t t)))
+    (setq scripts (cdr scripts))))
+
 (defun riece-install-just-print-p ()
   (let ((flag (getenv "MAKEFLAGS"))
        case-fold-search)
     (if flag
        (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag))))
 
+(defun riece-examine-modules ()
+  (let ((load-path (cons nil load-path)))
+    (require 'riece-addon-modules)
+    (append riece-modules
+           (mapcar #'car riece-addon-modules))))
+
+(defun riece-examine ()
+  (princ (mapconcat #'symbol-name (riece-examine-modules) " ")))
+
 (defun riece-compile ()
-  (riece-compile-modules riece-modules))
+  (riece-compile-modules (riece-examine-modules)))
 
 (defun riece-install ()
   (riece-install-modules
-   riece-modules
+   (riece-examine-modules)
    (expand-file-name "riece" (car command-line-args-left))
    (riece-install-just-print-p))
   (riece-install-icons
    riece-icons
    (expand-file-name "riece" (car command-line-args-left))
+   (riece-install-just-print-p))
+  (riece-install-scripts
+   riece-scripts
+   (expand-file-name "riece" (car command-line-args-left))
    (riece-install-just-print-p)))
 
 (defun riece-compile-package ()
   (add-to-list 'command-line-args-left ".")
   (Custom-make-dependencies)
   (riece-compile-modules
-   (append riece-modules
+   (append (riece-examine-modules)
           '(auto-autoloads custom-load))))
 
 (defun riece-install-package ()
   (riece-install-modules
-   (append riece-modules
+   (append (riece-examine-modules)
           '(auto-autoloads custom-load))
-   (expand-file-name "riece"
-                    (expand-file-name "lisp" (car command-line-args-left)))
+   (expand-file-name "lisp/riece" (car command-line-args-left))
    (riece-install-just-print-p))
   (riece-install-icons
    riece-icons
-   (expand-file-name "riece"
-                    (expand-file-name "lisp" (car command-line-args-left)))
+   (expand-file-name "etc/riece" (car command-line-args-left))
+   (riece-install-just-print-p))
+  (riece-install-scripts
+   riece-scripts
+   (expand-file-name "etc/riece" (car command-line-args-left))
    (riece-install-just-print-p)))
 
 (defun riece-test ()
index 6f15dc5..91be375 100644 (file)
@@ -1,3 +1,426 @@
+2005-08-27  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-addon.el (riece-uninstall-addon): Don't check the add-on
+       is enabled.
+       (riece-uninstall-addon): Don't use riece-remprop.
+       (riece-enable-addon): Put 'riece-addon-enabled property on the
+       add-on feature.
+       (riece-disable-addon): Ditto.
+       (riece-command-list-addons): Check 'riece-addon-enabled property
+       instead of riece-*-enabled variables.
+
+2005-08-27  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-options.el (riece-shrink-buffer-idle-time-delay):
+       Abolished; moved to riece-shrink-buffer.el.
+       (riece-max-buffer-size): Ditto.
+       (riece-shrink-buffer-remove-chars): Ditto.
+
+       * riece.el (riece-shrink-buffer-idle-timer): Abolished; moved to
+       riece-shrink-buffer.el.
+       (riece): Don't set riece-shrink-buffer-idle-timer here.
+       (riece-exit): Don't cancel riece-shrink-buffer-idle-timer here.
+
+       * riece-shrink-buffer.el: New add-on.
+       * riece-addon-modules.el (riece-addon-modules): Added
+       riece-shrink-buffer.
+       * Makefile.am (EXTRA_DIST): Added riece-shrink-buffer.el.
+
+2005-08-27  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-highlight.el (riece-highlight-uninstall): Use
+       riece-remprop instead of remprop.
+
+       * riece-addon.el (riece-uninstall-addon): Use riece-remprop
+       instead of remprop.
+
+       * riece-xemacs.el (riece-remprop): New alias.
+       * riece-emacs.el (riece-remprop): New function.
+
+       * COMPILE (riece-compile-modules): Add current directory to load-path.
+
+       * riece-history.el (riece-history-requires): New function.
+       * riece-addon.el (riece-insinuate-addon-1): Require add-on feature.
+
+2005-08-27  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-foolproof.el (riece-foolproof-description): Made it more
+       descriptive.
+
+       * riece-url.el (riece-url-uninstall): Call easy-menu-remove-item.
+
+       * riece-addon.el (riece-addon-list-mode-map): Bind
+       riece-command-unload-addon.
+       (riece-insinuate-addon-1): New function; renamed from
+       riece-insinuate-addon.
+       (riece-insinuate-addon): Use it; re-insinuate add-ons preceding to
+       the add-on.
+       (riece-addon-list-set-point): New function.
+       (riece-command-unload-addon): New command.
+
+2005-08-27  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-menu.el (riece-menu-uninstall): Call easy-menu-remove.
+
+       * riece-toolbar.el (riece-toolbar-original-toolbar) [XEmacs]: New
+       variable.
+       (riece-unset-toolbar): New function.
+       (riece-toolbar-uninstall): Call riece-unset-toolbar.
+       (riece-toolbar-command-mode-hook): Renamed from
+       riece-toolbar-insinuate-in-command-buffer.
+
+       * riece-icon.el (riece-icon-enable): Update
+       mode-line-buffer-identification here.
+       (riece-icon-disable): Ditto.
+
+2005-08-26  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-addon.el (riece-uninstall-addon): Update
+       riece-addon-dependencies.
+
+2005-08-26  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece.el (riece-command-mode): Set
+       riece-mode-line-buffer-identification.
+       (riece-dialogue-mode): Ditto.
+       (riece-channel-mode): Ditto.
+       (riece-channel-list-mode): Ditto.
+       (riece-user-list-mode): Ditto.
+       * riece-icon.el
+       (riece-icon-update-mode-line-buffer-identification): New function.
+       (riece-icon-insinuate): Use it.
+       (riece-icon-uninstall): Use it.
+       * riece-globals.el (riece-mode-line-buffer-identification): New
+       variable.
+
+2005-08-26  Daiki Ueno  <ueno@unixuser.org>
+
+       * Make add-ons uninstallable.
+
+       * riece-xface.el (riece-xface-user-list-mode-hook): New function.
+       (riece-xface-insinuate): Use it.
+       (riece-xface-uninstall): New function.
+       * riece-url.el (riece-url-command-mode-hook): New function.
+       (riece-url-insinuate): Use it.
+       (riece-url-uninstall): New function.
+       * riece-unread.el (riece-unread-uninstall): New function.
+       * riece-toolbar.el (riece-toolbar-uninstall): New function.
+       * riece-rdcc.el (riece-rdcc-uninstall): New function.
+       * riece-ndcc.el (riece-ndcc-uninstall): New function.
+       * riece-mini.el (riece-mini-uninstall): New function.
+       * riece-menu.el (riece-menu-uninstall): New function.
+       * riece-lsdb.el: New function.
+       * riece-log.el (riece-log-uninstall): New function.
+       * riece-keyword.el (riece-keyword-uninstall): New function.
+       * riece-keepalive.el (riece-keepalive-uninstall): New function.
+       * riece-kakasi.el (riece-kakasi-uninstall): New function.
+       * riece-ignore.el (riece-ignore-uninstall): New function.
+       * riece-icon.el (riece-icon-user-list-mode-hook): New function.
+       (riece-icon-channel-list-mode-hook): New function.
+       (riece-icon-original-mode-line-buffer-identification): New variable.
+       (riece-icon-insinuate): Use them.
+       (riece-icon-uninstall): New function.
+       * riece-history.el
+       (riece-history-after-switch-to-channel-functions): New function.
+       (riece-history-insinuate): Use it.
+       (riece-history-uninstall): New function.
+       * riece-highlight.el (riece-highlight-uninstall): New function.
+       * riece-hangman.el (riece-hangman-uninstall): New function.
+       * riece-google.el (riece-google-uninstall): New function.
+       * riece-foolproof.el (riece-foolproof-uninstall): New function.
+       * riece-eval.el (riece-eval-uninstall): New function.
+       * riece-eval-ruby.el (riece-eval-ruby-uninstall): New function.
+       * riece-doctor.el (riece-doctor-uninstall): New function.
+       * riece-ctlseq.el (riece-ctlseq-uninstall): New function.
+       * riece-ctcp.el (riece-ctcp-dialogue-font-lock-keywords): New variable.
+       (riece-ctcp-uninstall): New function.
+       * riece-button.el (riece-button-channel-list-mode-hook): New function.
+       * riece-biff.el (riece-biff-uninstall): New function.
+
+2005-08-26  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-options.el (riece-saved-forms): Added riece-addons.
+
+       * riece-addon.el: Require 'riece-addon-modules.
+       (riece-command-list-addons): List all available add-ons from
+       riece-addon-modules.
+       (riece-addon-list-mode-map): Bind riece-command-insinuate-addon
+       and riece-command-uninstall-addon.
+       (riece-insinuate-addon): Rebuild riece-addon-dependencies.
+       (riece-command-insinuate-addon): New command.
+       (riece-command-uninstall-addon): New command.
+
+       * COMPILE (riece-examine-modules): New function.
+       (riece-examine): Use it.
+       (riece-compile): Use it.
+       (riece-install): Use it.
+       (riece-compile-package): Use it.
+       (riece-install-package): Use it.
+
+       * Makefile.am (EXTRA_DIST): Added riece-addon-modules.el.
+
+       * riece-addon-modules.el: New file.
+
+2005-08-25  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-addon.el (riece-command-list-addons): Use
+       riece-addon-dependencies instead of riece-addons.
+       (riece-command-enable-addon): Ditto.
+       (riece-command-disable-addon): Ditto.
+       (riece-uninstall-addon): New function.
+
+2005-08-25  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece.el (riece): Don't override riece-addons setting.
+
+       * riece-globals.el (riece-addon-dependencies): New variable.
+
+       * riece-addon.el (riece-sort-addon-dependencies): Rename from
+       riece-resolve-addon-dependencies; return addon dependencies as an
+       alist, instead of returning a list of addons.
+
+2005-08-20  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-addon.el (riece-command-enable-addon): Redraw entire
+       add-on list.
+       (riece-command-disable-addon): Ditto.
+
+2005-08-17  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-filter.el (riece-handle-message): Use
+       riece-funcall-ignore-errors instead of riece-ignore-errors.
+
+       * riece-ctcp.el (riece-handle-ctcp-request): Use
+       riece-funcall-ignore-errors instead of riece-ignore-errors.
+       (riece-handle-ctcp-response): Ditto.
+
+2005-08-16  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-options.el (riece-data-directory): Use load-file-name.
+
+2005-08-15  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * riece-options.el (riece-data-directory): Avoid compile time
+       error when locate-data-directory undefined.
+
+2005-08-15  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-options.el (riece-quit-timeout): Set default to 1.
+
+       * riece-irc.el (riece-irc-quit-server-process): Display message
+       before/after sending QUIT.
+
+2005-08-14  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece.el (riece-addons-insinuated): Abolished.
+       (riece): Don't check riece-addons-insinuated.
+
+       * riece-addon.el (riece-insinuate-addon): Put
+       'riece-addon-insinuated property on add-on feature.
+
+2005-08-13  Daiki Ueno  <ueno@unixuser.org>
+
+       * COMPILE (riece-install-package): Install *.xpm and *.rb in etc/riece.
+
+       * riece-async.el (riece-async-open-network-stream): Locate Ruby
+       script files in riece-data-directory.
+       * riece-toolbar.el (riece-make-toolbar-from-menu): Locate icon
+       files in riece-data-directory.
+       * riece-ruby.el (riece-ruby-execute): Locate Ruby script files in
+       riece-data-directory.
+       * riece-options.el (riece-data-directory): New user option.
+
+2005-08-12  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-ruby.el (riece-ruby-filter): Pass timestamp of output
+       event to output-handler.
+
+2005-08-12  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-button.el (riece-user-button-popup-menu): Simplified
+       menu item titles.
+
+       * COMPILE (riece-compile-module): New function.
+       (riece-examine): New function.
+
+       * Makefile.am (compile-individually): New rule.
+
+       * riece-log.el (riece-log-file-name-regexp): New constant.
+       (riece-log-get-file): Add 2nd argument coding-system.
+       (riece-log-get-files): Add 2nd argument time.
+       (riece-log-insert): Simplified; determine coding-system from
+       suffix of each log file.
+       (riece-log-dired): Renamed from riece-log-open-directory.
+       (riece-log-open-directory-function): Abolished.
+       (riece-log-make-file-name): Renamed from riece-log-get-file.
+       (riece-log-list-files): Renamed from riece-log-get-files.
+       (riece-log-directory): Renamed from riece-log-get-directory.
+
+       * Makefile.am (EXTRA_DIST): Added aproxy.rb.
+
+       * COMPILE (riece-scripts): Added "aproxy.rb".
+
+       * riece-async.el (riece-async-buffer-size): Renamed from
+       riece-async-max-buffer-size.
+       (riece-async-backup-file): New user option.
+       (riece-async-server-program): New variable.
+       (riece-async-server-program-arguments): New variable.
+       (riece-async-open-network-stream): Use aproxy.rb.
+
+       * aproxy.rb: New file.
+
+       * riece-ruby.el (riece-ruby-out-file): New user option.
+       (riece-ruby-err-file): New user option.
+       (riece-ruby-log-file): New user option..
+       (riece-ruby-server-program-arguments): New variable.
+       (riece-ruby-filter): Call output-handler within
+       riece-debug-with-backtrace; erase process output.
+       (riece-ruby-run-exit-handler): Call exit-handler within
+       riece-debug-with-backtrace.
+
+       * server.rb: Don't bind @err in execution environment;
+       added logging feature.
+
+2005-08-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * server.rb: Connect $stdout and $stderr to StringIO objects.
+
+       * riece-async.el: Use riece-ruby (partially).
+
+       * riece-eval-ruby.el (riece-eval-ruby-prefix-regexp): New user option.
+       (riece-eval-ruby-exit-handler): Print "nil".
+
+2005-08-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-hangman.el (riece-hangman-hello-regexp): Changed regexp.
+       (riece-hangman-bye-regexp): Ditto.
+
+       * riece-doctor.el (riece-doctor-hello-regexp): Changed regexp.
+       (riece-doctor-bye-regexp): Ditto.
+
+       * riece-ruby.el: Moved add-on stuff to riece-eval-ruby.el.
+
+       * riece-eval-ruby.el: New add-on.
+       * COMPILE (riece-modules): Add riece-eval-ruby.
+       * Makefile.am (EXTRA_DIST): Add riece-eval-ruby.el.
+
+2005-08-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * server.rb (Server::unescape): Fixed.
+
+       * riece-ruby.el: Implement add-on API.
+       (riece-ruby-filter): Fixed regexp; fixed argument order of
+       output-handler.
+       (riece-ruby-run-exit-handler): Remove exit-handler entry before
+       running it to avoid recursion; call riece-ruby-clear if
+       exit-handler is specified.
+       (riece-ruby-exit-handler): Don't call riece-ruby-clear.
+
+       * riece-rdcc.el: Use riece-ruby.
+
+2005-08-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-ruby.el (riece-ruby-property-alist): New variable
+       (riece-ruby-set-property): New function.
+       (riece-ruby-property): New function.
+       (riece-ruby-execute): Locate server.rb from load-path.
+
+       * Makefile.am (EXTRA_DIST): Added riece-ruby.el and server.rb.
+
+       * COMPILE (riece-modules): Added riece-ruby.
+       (riece-icons): Use filename instead of symbol.
+       (riece-scripts): New variable.
+       (riece-install-icons): Use filename instead of symbol.
+       (riece-install-scripts): New function.
+       (riece-install): Call riece-install-scripts.
+       (riece-install-package): Ditto.
+
+2005-08-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-ruby.el: Add docs for variables.
+       (riece-ruby-substitute-variables): Substitute multiple variables.
+       (riece-ruby-filter): Call output-handler/exit-handler with program
+       name.
+
+2005-08-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * server.rb: Renamed from rubyserv.rb; s/RubyServ/Server/.
+       * riece-ruby.el (riece-ruby-server-program): Follow the filename
+       change.
+       (riece-ruby-set-output-handler): New function.
+
+2005-08-11  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-ruby.el: Fixed example.
+       (riece-ruby-server-program): New variable.
+       (riece-ruby-status-alist): New variable.
+       (riece-ruby-status): Abolished.
+       (riece-ruby-escaped-data): Renamed from riece-ruby-input.
+       (riece-ruby-reset-process-buffer): New function.
+       (riece-ruby-send-exit): New function.
+       (riece-ruby-filter): Call riece-ruby-run-exit-handler if the
+       program is exited.
+       (riece-ruby-run-exit-handler): New function.
+       (riece-ruby-execute): Don't expect program name.
+       (riece-ruby-clear): New function.
+       (riece-ruby-set-exit-handler): New function.
+
+       * rubyserv.rb (RubyServ::dispatch_eval): Don't expect program
+       name; eval under the binding of RubyServ::C.
+       (RubyServ::dispatch_poll): Don't clear @thr.
+       (RubyServ::dispatch_exit): New method.
+
+2005-08-10  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-ruby.el: New file.
+       * rubyserv.rb: Rewrite.
+
+2005-08-09  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-mini.el (riece-mini-message-no-log): Defined as a
+       function.
+       (riece-mini-requires): Fixed indent.
+
+2005-08-08  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece.el (riece-dialogue-mode-map): Bind
+       riece-command-toggle-others-buffer-mode.
+
+       * riece-commands.el (riece-command-toggle-others-buffer-mode): New
+       command.
+
+       * riece-layout.el (riece-configure-windows): Hide
+       riece-others-buffer if riece-others-buffer-mode is nil.
+
+       * riece-options.el (riece-saved-forms): Add
+       riece-others-buffer-mode and riece-channel-list-buffer-mode.
+       (riece-others-buffer-mode): New user option.
+
+2005-08-06  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-alias.el (riece-alias-alternate-separator): Set to "@".
+
+2005-07-28  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-debug.el: Don't bind unused variable; prepend time to
+       debug message.
+
+2005-07-19  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-unread.el (riece-guess-channel-from-unread): Return
+       reversed copy of riece-unread-channels.
+
+       * riece-server.el (riece-server-parse-string): Use
+       string-to-number instead of string-to-int.
+
+2005-07-07  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-display.el (riece-channel-buffer): Return nil when
+       channel-buffer is killed.
+
+       * riece-debug.el (riece-debug-1): New function.
+       (riece-debug): Always return nil.
+
 2005-06-04  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-server.el (riece-server-keyword-map): Add :coding-system-alist.
index 5d49803..5b7f1b6 100644 (file)
@@ -2,23 +2,25 @@ SUBDIRS = test
 
 EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \
        riece-000.el riece-200.el riece-300.el riece-400.el riece-500.el \
-       riece-addon.el riece-channel.el riece-coding.el riece-commands.el \
-       riece-compat.el riece-complete.el riece-debug.el riece-display.el \
-       riece-emacs.el riece-filter.el riece-globals.el riece-handle.el \
-       riece-highlight.el riece-identity.el riece-message.el riece-misc.el \
-       riece-mode.el riece-naming.el riece-options.el riece-server.el \
-       riece-signal.el riece-user.el riece-version.el riece-xemacs.el \
-       riece-irc.el riece.el riece-ctcp.el riece-url.el riece-unread.el \
-       riece-ndcc.el riece-rdcc.el riece-log.el riece-mini.el \
-       riece-doctor.el riece-alias.el riece-layout.el riece-skk-kakutei.el \
-       riece-guess.el riece-history.el riece-button.el riece-keyword.el \
-       riece-menu.el riece-icon.el riece-async.el riece-lsdb.el \
-       riece-xface.el riece-ctlseq.el riece-ignore.el riece-hangman.el \
-       riece-biff.el riece-kakasi.el riece-foolproof.el riece-yank.el \
-       riece-toolbar.el riece-eval.el riece-google.el riece-keepalive.el \
-       url-riece.el \
+       riece-addon-modules.el riece-addon.el riece-channel.el \
+       riece-coding.el riece-commands.el riece-compat.el riece-complete.el \
+       riece-debug.el riece-display.el riece-emacs.el riece-filter.el \
+       riece-globals.el riece-handle.el riece-highlight.el riece-identity.el \
+       riece-message.el riece-misc.el riece-mode.el riece-naming.el \
+       riece-options.el riece-ruby.el riece-server.el riece-signal.el \
+       riece-user.el riece-version.el riece-xemacs.el riece-irc.el riece.el \
+       riece-ctcp.el riece-url.el riece-unread.el riece-ndcc.el \
+       riece-rdcc.el riece-log.el riece-mini.el riece-doctor.el \
+       riece-alias.el riece-layout.el riece-skk-kakutei.el riece-guess.el \
+       riece-history.el riece-button.el riece-keyword.el riece-menu.el \
+       riece-icon.el riece-async.el riece-lsdb.el riece-xface.el \
+       riece-ctlseq.el riece-ignore.el riece-hangman.el riece-biff.el \
+       riece-kakasi.el riece-foolproof.el riece-yank.el riece-toolbar.el \
+       riece-eval.el riece-google.el riece-keepalive.el riece-eval-ruby.el \
+       riece-shrink-buffer.el url-riece.el \
        riece-command-previous-channel.xpm riece-command-next-channel.xpm \
-       riece-submit-bug-report.xpm
+       riece-submit-bug-report.xpm \
+       server.rb aproxy.rb
 
 CLEANFILES = auto-autoloads.el custom-load.el *.elc
 FLAGS ?= -batch -q -no-site-file
@@ -40,3 +42,11 @@ install-package: package
 
 check-local:
        $(EMACS) $(FLAGS) -l COMPILE -f riece-test lunit-report.xml
+
+compile-individually:
+       @for i in `$(EMACS) $(FLAGS) -l COMPILE -f riece-examine`; do \
+               echo $(EMACS) $(FLAGS) -l COMPILE \
+                       -f riece-compile-module $$i; \
+               $(EMACS) $(FLAGS) -l COMPILE \
+                       -f riece-compile-module $$i; \
+       done
diff --git a/lisp/aproxy.rb b/lisp/aproxy.rb
new file mode 100644 (file)
index 0000000..df88f94
--- /dev/null
@@ -0,0 +1,107 @@
+# aproxy.rb --- async proxy between an IRC server and a client
+# Copyright (C) 1998-2005 Daiki Ueno
+
+# Author: Daiki Ueno <ueno@unixuser.org>
+# Created: 1998-09-28
+# Keywords: IRC, riece
+
+# This file is part of Riece.
+
+# This program 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.
+
+# This program 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.
+
+require 'io/nonblock'
+require 'socket'
+
+class AProxy
+  def initialize(host, port, size, back)
+    @host = host
+    @port = port
+    @size = size
+    @back = File.new(back, 'a') if back
+  end
+
+  def start
+    $stdout.nonblock = true
+    trap('STOP', 'IGNORE')
+    trap('TSTP', 'IGNORE')
+    socket = TCPSocket.new(@host, @port)
+    @out.write("NOTICE CONNECTED #{$$}\r\n")
+    wfds_in = []
+    buf = ''
+    loop do
+      rfds, wfds, = select([socket, $stdin], wfds_in)
+      unless wfds.empty?
+        if buf.length > @size
+          s = buf.slice!(0 ... @size)
+          @back.write(s) if @back
+        end
+        begin
+          until buf.empty?
+            len = $stdout.syswrite(buf)
+            buf.slice!(0 .. len)
+          end
+          wfds_in.clear
+        rescue Errno::EAGAIN
+        end
+      end
+      if rfds.include?(socket)
+        line = socket.gets("\r\n")
+        break unless line
+        if line =~ /\A(?::\S+\s+)?PING\s+(.*)\r\n/i
+          socket.write("PONG #{$1}\r\n")
+        else
+          wfds_in = [$stdout]
+          buf << line
+        end
+      end
+      if rfds.include?($stdin)
+        line = $stdin.gets("\r\n")
+        break unless line
+        socket.write(line)
+      end
+    end
+    socket.close
+  end
+end
+
+if $0 == __FILE__
+  require 'optparse'
+
+  opt_size, opt_back = nil, nil
+  opts = OptionParser.new do |opts|
+    opts.banner = <<"End"
+Usage: #{$0} [OPTIONS] host port
+End
+    opts.on('-s', '--size SIZE', 'Size of buffer.') do |size|
+      opt_size = size.to_i
+    end
+    opts.on('-b', '--back BACK', 'Send outdated messages to BACK.') do |back|
+      opt_back = back
+    end
+    opts.on_tail('--help', '-h', 'Show this message.') do
+      $stdout.print(opts.to_s)
+      exit(0)
+    end
+  end
+  begin
+    opts.parse!(ARGV)
+  rescue OptionParser::ParseError
+    $stderr.print(opts.to_s)
+    exit(1)
+  end
+
+  AProxy.new(ARGV.shift, ARGV.shift, opt_size, opt_back).start
+end
index 2f758dc..109f2f2 100644 (file)
@@ -25,6 +25,9 @@
 ;;; Code:
 
 (require 'riece-misc)
+(require 'riece-naming)
+(require 'riece-signal)
+(require 'riece-display)
 
 (eval-when-compile
   (autoload 'riece-default-handle-numeric-reply "riece-handle"))
diff --git a/lisp/riece-addon-modules.el b/lisp/riece-addon-modules.el
new file mode 100644 (file)
index 0000000..7cb2107
--- /dev/null
@@ -0,0 +1,36 @@
+(defconst riece-addon-modules
+  '((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.")
+    (riece-doctor . "Pretend to be a psychotherapist.")
+    (riece-eval-ruby . "Evaluate input string as a Ruby program.")
+    (riece-eval . "Evaluate an input string as an elisp form.")
+    (riece-foolproof . "Prevent miss-operation in the command buffer.")
+    (riece-google . "Search keywords by Google.")
+    (riece-guess . "Guess the next channel, using multiple methods.")
+    (riece-hangman . "Allow channel members to play the hangman game.")
+    (riece-highlight . "Highlight IRC buffers.")
+    (riece-history . "Manage history of channel shifting.")
+    (riece-icon . "Display icons in IRC buffers.")
+    (riece-ignore . "Ignore messages from some users.")
+    (riece-kakasi . "Convert Japanese to roman string by KAKASI.")
+    (riece-keepalive . "Keep an IRC connection.")
+    (riece-keyword . "Detect keywords in IRC buffers.")
+    (riece-log . "Save IRC logs.")
+    (riece-lsdb . "Help register nicknames in LSDB rolodex program.")
+    (riece-menu . "Setup Riece's command menus.")
+    (riece-mini . "Use Riece only on the minibuffer.")
+    ;;(riece-ndcc . "DCC file sending protocol support (written in elisp.)")
+    (riece-rdcc . "DCC file sending protocol support (written in Ruby.)")
+    (riece-shrink-buffer . "Free old IRC messages to save memory usage.")
+    (riece-skk-kakutei . "Remove SKK's preedit mark before sending messages.")
+    (riece-toolbar . "Display toolbar icons.")
+    (riece-unread . "Mark channels where new messages arrived.")
+    (riece-url . "Collect URL in IRC buffers.")
+    (riece-xface . "Display X-Face in IRC buffers.")
+    (riece-yank . "Enter the element of kill-ring.")))
+
+(provide 'riece-addon-modules)
\ No newline at end of file
index 092e6a5..8887394 100644 (file)
 (require 'riece-options)
 (require 'riece-compat)
 (require 'riece-misc)
+(require 'riece-addon-modules)
 
 (defgroup riece-addon-list nil
-  "Add-on management"
-  :tag "Addon"
-  :prefix "riece-"
+  "Add-on listing."
+  :tag "Addon list"
+  :prefix "riece-addon-list-"
   :group 'riece)
 
 (defgroup riece-addon-list-faces nil
-  "Faces for riece-addon-list-mode"
+  "Faces for riece-addon-list-mode."
   :tag "Faces"
-  :prefix "riece-addon-list"
-  :group 'riece-addon)
+  :prefix "riece-addon-list-"
+  :group 'riece-addon-list)
 
 (defface riece-addon-list-enabled-face
   '((((class color) (background dark))
@@ -54,7 +55,7 @@
   '((((class color) (background dark))
      (:foreground "PaleTurquoise" :italic t))
     (t
-     (:italic t)))
+     ()))
   "Face used for displaying the disabled addon."
   :group 'riece-addon-list-faces)
 (defvar riece-addon-list-disabled-face 'riece-addon-list-disabled-face)
   :group 'riece-addon-list-faces)
 (defvar riece-addon-list-unsupported-face 'riece-addon-list-unsupported-face)
 
-(defface riece-addon-list-unknown-face
+(defface riece-addon-list-uninstalled-face
+  '((t
+     (:italic t)))
+  "Face used for displaying the uninstalled addon."
+  :group 'riece-addon-list-faces)
+(defvar riece-addon-list-uninstalled-face 'riece-addon-list-uninstalled-face)
+
+(defface riece-addon-list-unloaded-face
   '((t
-     (:foreground "red")))
-  "Face used for displaying the unknown addon."
+     (:italic t :inverse-video t)))
+  "Face used for displaying the unloaded addon."
   :group 'riece-addon-list-faces)
-(defvar riece-addon-list-unknown-face 'riece-addon-list-unknown-face)
+(defvar riece-addon-list-unloaded-face 'riece-addon-list-unloaded-face)
 
 (defface riece-addon-list-description-face
   '((((class color)
   '((?+ . riece-addon-list-enabled-face)
     (?- . riece-addon-list-disabled-face)
     (?! . riece-addon-list-unsupported-face)
-    (?? . riece-addon-list-unknown-face))
+    (?? . riece-addon-list-uninstalled-face)
+    (?  . riece-addon-list-unloaded-face))
   "An alist mapping marks on riece-addon-list-buffer to faces."
   :type 'list
   :group 'riece-addon-list)
 
 (defcustom riece-addon-list-font-lock-keywords
-  '(("^\\([-+!?] [^:]+\\): \\(.*\\)"
+  '(("^\\([-+!? ] \\S-+\\)\\s-+\\(.*\\)"
      (1 (cdr (assq (aref (match-string 1) 0)
                   riece-addon-list-mark-face-alist)))
      (2 riece-addon-list-description-face)))
   (let ((keymap (make-sparse-keymap)))
     (define-key keymap "+" 'riece-command-enable-addon)
     (define-key keymap "-" 'riece-command-disable-addon)
+    (define-key keymap "i" 'riece-command-insinuate-addon)
+    (define-key keymap "u" 'riece-command-uninstall-addon)
+    (define-key keymap "U" 'riece-command-unload-addon)
     (define-key keymap "n" 'next-line)
     (define-key keymap "p" 'previous-line)
     (define-key keymap " " 'scroll-up)
        dependencies)
     (while addons
       (require (car addons))           ;error will be reported here
-      (let* ((requires
-             (funcall (or (intern-soft
-                           (concat (symbol-name (car addons)) "-requires"))
-                          #'ignore)))
+      (let* ((requires-function
+             (intern-soft
+              (concat (symbol-name (car addons)) "-requires")))
+            (requires
+             (if (and requires-function
+                      (fboundp requires-function))
+                 (funcall requires-function)))
             (pointer requires)
             entry)
        ;; Increment succs' pred count.
        ;; Merge pred's succs.
        (while pointer
          (if (setq entry (assq (car pointer) dependencies))
-             (setcdr (cdr entry)
-                     (cons (car addons) (nthcdr 2 entry)))
+             (setcdr (cdr entry) (cons (car addons) (nthcdr 2 entry)))
            (setq dependencies (cons (list (car pointer) 0 (car addons))
                                     dependencies)))
          (setq pointer (cdr pointer))))
       (setq addons (cdr addons)))
     dependencies))
 
-(defun riece-resolve-addon-dependencies (addons)
-  (let ((pointer addons)
-       dependencies queue)
-    ;; Uniquify, first.
-    (while pointer
-      (if (memq (car pointer) (cdr pointer))
-         (setcar pointer nil))
-      (setq pointer (cdr pointer)))
-    (setq dependencies (riece-load-and-build-addon-dependencies
-                       (delq nil addons))
-         pointer dependencies)
-    ;; Sort them.
+(defun riece-sort-addon-dependencies (dependencies)
+  (let ((pointer dependencies)
+       addons queue)
     (while pointer
       (if (zerop (nth 1 (car pointer)))
          (setq dependencies (delq (car pointer) dependencies)
                queue (cons (car pointer) queue)))
       (setq pointer (cdr pointer)))
-    (setq addons nil)
     (while queue
-      (setq addons (cons (car (car queue)) addons)
+      (setq addons (cons (cons (car (car queue)) (nthcdr 2 (car queue)))
+                        addons)
            pointer (nthcdr 2 (car queue)))
       (while pointer
        (let* ((entry (assq (car pointer) dependencies))
               (count (1- (nth 1 entry))))
          (if (zerop count)
-             (progn
-               (setq dependencies (delq entry dependencies)
-                     queue (nconc queue (list entry))))
+             (setq dependencies (delq entry dependencies)
+                   queue (nconc queue (list entry)))
            (setcar (cdr entry) count)))
        (setq pointer (cdr pointer)))
       (setq queue (cdr queue)))
     (if dependencies
-       (error "Circular add-on dependency found"))
+       (error "Circular add-on dependency found: %S" dependencies))
     (nreverse addons)))
 
 (defun riece-resolve-addons (addons)
-  (riece-resolve-addon-dependencies
-   (if (file-directory-p riece-addon-directory)
-       (append addons
-              (mapcar
-               (lambda (name)
-                 (unless (file-directory-p
-                          (expand-file-name name riece-addon-directory))
-                   (intern (file-name-sans-extension name))))
-               (directory-files riece-addon-directory nil "\\`[^.]" t)))
-     addons)))
+  ;; Add files in riece-addon-directory to addons.
+  (if (file-directory-p riece-addon-directory)
+      (setq addons (nconc
+                   addons
+                   (mapcar
+                    (lambda (name)
+                      (unless (file-directory-p
+                               (expand-file-name name riece-addon-directory))
+                        (intern (file-name-sans-extension name))))
+                    (directory-files riece-addon-directory nil "\\`[^.]")))))
+  ;; Sort & uniquify.
+  (setq addons (sort addons (lambda (symbol1 symbol2)
+                             (string-lessp (symbol-name symbol1)
+                                           (symbol-name symbol2)))))
+  (let ((pointer addons))
+    (while pointer
+      (if (memq (car pointer) (cdr pointer))
+         (setcar pointer nil))
+      (setq pointer (cdr pointer)))
+    (delq nil addons))
+  ;; Build & resolve dependencies.
+  (riece-sort-addon-dependencies
+   (riece-load-and-build-addon-dependencies addons)))
+
+(defun riece-insinuate-addon-1 (addon verbose)
+  (if (get addon 'riece-addon-insinuated)
+      (if verbose
+         (message "Add-on %S is already insinuated" addon))
+    (require addon)
+    (funcall (intern (concat (symbol-name addon) "-insinuate")))
+    (put addon 'riece-addon-insinuated t)
+    (if verbose
+       (message "Add-on %S is insinuated" addon))
+    (unless (get addon 'riece-addon-default-disabled)
+      (riece-enable-addon addon t))))
 
 (defun riece-insinuate-addon (addon &optional verbose)
-  (require addon)              ;implicit dependency
-  (funcall (intern (concat (symbol-name addon) "-insinuate")))
-  (if verbose
-      (message "Add-on %S is insinuated" addon)))
+  (unless (assq addon riece-addon-dependencies)
+    (setq riece-addons (cons addon riece-addons)
+         riece-save-variables-are-dirty t
+         riece-addon-dependencies
+         (riece-resolve-addons
+          (cons addon (mapcar #'car riece-addon-dependencies)))))
+  (let ((pointer riece-addon-dependencies)
+       addons)
+    (while pointer
+      (unless (get (car (car pointer)) 'riece-addon-insinuated)
+       (setq addons (cons (car (car pointer)) addons)))
+      (if (eq (car (car pointer)) addon)
+         (setq pointer nil)
+       (setq pointer (cdr pointer))))
+    (setq addons (nreverse addons))
+    (if (and (> (length addons) 1)
+            (eq verbose 'ask)
+            (not (y-or-n-p (format "%s will be insinuated.  Continue? "
+                                   (mapconcat #'symbol-name addons ", ")))))
+       (error "Insinuate operation was cancelled"))
+    (while addons
+      (riece-insinuate-addon-1 (car addons) verbose)
+      (setq addons (cdr addons)))))
+
+(defun riece-uninstall-addon (addon &optional verbose)
+  (if (not (get addon 'riece-addon-insinuated))
+      (if verbose
+         (message "Add-on %S is not insinuated" addon))
+    (let ((entry (assq addon riece-addon-dependencies))
+         (uninstall (intern-soft (concat (symbol-name addon) "-uninstall"))))
+      (if entry
+         (if (cdr entry)
+             (if (= (length (cdr entry)) 1)
+                 (error "%S depends on %S" (car (cdr entry)) addon)
+               (error "%s depend on %S"
+                      (mapconcat #'symbol-name (cdr entry) ", ")
+                      addon))
+           (riece-disable-addon addon verbose)
+           (if (and uninstall
+                    (fboundp uninstall))
+               (funcall uninstall))
+           (setq riece-addon-dependencies
+                 (delq entry riece-addon-dependencies))
+           (put addon 'riece-addon-insinuated nil)
+           (setq riece-addons (delq addon riece-addons)
+                 riece-save-variables-are-dirty t
+                 riece-addon-dependencies
+                 (riece-resolve-addons
+                  (delq addon (mapcar #'car riece-addon-dependencies))))))
+      (if verbose
+         (message "Add-on %S is uninstalled" addon)))))
 
 (defun riece-enable-addon (addon &optional verbose)
-  (let ((enabled (intern-soft (concat (symbol-name addon) "-enabled"))))
-    (if (null enabled)
+  (unless (get addon 'riece-addon-insinuated)
+    (error "Add-on %S is not insinuated" addon))
+  (let ((enable (intern-soft (concat (symbol-name addon) "-enable"))))
+    (if (or (null enable)
+           (not (fboundp enable)))
        (if verbose
            (message "Add-on %S doesn't support enable/disable" addon))
-      (if (symbol-value enabled)
+      (if (get addon 'riece-addon-enabled)
          (if verbose
-             (message "Can't enable add-on %S" addon))
-       (funcall (intern (concat (symbol-name addon) "-enable")))
+             (message "Add-on %S is already enabled" addon))
+       (funcall enable)
+       (put addon 'riece-addon-enabled t)
        (if verbose
            (message "Add-on %S enabled" addon))))))
 
 (defun riece-disable-addon (addon &optional verbose)
-  (let ((enabled (intern-soft (concat (symbol-name addon) "-enabled"))))
-    (if (null enabled)
+  (unless (get addon 'riece-addon-insinuated)
+    (error "Add-on %S is not insinuated" addon))
+  (let ((disable (intern-soft (concat (symbol-name addon) "-disable"))))
+    (if (or (null disable)
+           (not (fboundp disable)))
        (if verbose
            (message "Add-on %S doesn't support enable/disable" addon))
-      (if (symbol-value enabled)
+      (if (get addon 'riece-addon-enabled)
          (progn
-           (funcall (intern (concat (symbol-name addon) "-disable")))
+           (funcall disable)
+           (put addon 'riece-addon-enabled nil)
            (if verbose
                (message "Add-on %S disabled" addon)))
        (if verbose
-           (message "Can't disable add-on %S" addon))))))
+           (message "Add-on %S is already enabled" addon))))))
 
 (put 'riece-addon-list-mode 'font-lock-defaults
      '(riece-addon-list-font-lock-keywords t))
@@ -239,62 +323,94 @@ All normal editing commands are turned off."
   (use-local-map riece-addon-list-mode-map)
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(riece-addon-list-font-lock-keywords t))
-  ;; In XEmacs, auto-initialization of font-lock is not affective
-  ;; when buffer-file-name is not set.
+  ;; In XEmacs, auto-initialization of font-lock is not effective
+  ;; if buffer-file-name is not set.
   (font-lock-set-defaults)
   (run-hooks 'riece-addon-list-mode-hook))
 
 (defun riece-command-list-addons ()
   (interactive)
-  (set-buffer (riece-get-buffer-create "*AddOns*" 'riece-addon-list-mode))
+  (set-buffer (riece-get-buffer-create "*AddOn*" 'riece-addon-list-mode))
   (riece-addon-list-mode)
   (let ((inhibit-read-only t)
        buffer-read-only
-       (pointer (sort (copy-sequence riece-addons)
-                      (lambda (symbol1 symbol2)
-                                 (string-lessp (symbol-name symbol1)
-                                               (symbol-name symbol2)))))
-       enabled description point)
+       (pointer riece-addon-dependencies)
+       module-description-alist
+       description enable point)
+    (while pointer
+      (setq description (intern-soft (concat (symbol-name (car (car pointer)))
+                                            "-description"))
+           module-description-alist
+           (cons (cons (car (car pointer))
+                       (if (and description
+                                (boundp description))
+                           (symbol-value description)
+                         "(no description)"))
+                 module-description-alist)
+           pointer (cdr pointer)))
+    (setq pointer riece-addon-modules)
+    (while pointer
+      (unless (assq (car (car pointer))
+                   module-description-alist)
+       (setq module-description-alist
+             (cons (car pointer) module-description-alist)))
+      (setq pointer (cdr pointer)))
     (erase-buffer)
     (riece-kill-all-overlays)
+    (setq pointer (sort module-description-alist
+                       (lambda (entry1 entry2)
+                         (string-lessp (symbol-name (car entry1))
+                                       (symbol-name (car entry2))))))
     (while pointer
-      (setq enabled (intern-soft (concat (symbol-name (car pointer))
-                                        "-enabled"))
-           description (intern-soft (concat (symbol-name (car pointer))
-                                            "-description")))
+      (setq enable (intern-soft (concat (symbol-name (car (car pointer)))
+                                       "-enable")))
       (setq point (point))
-      (insert (format "%c %S: %s\n"
-                     (if (not (featurep (car pointer)))
-                         ??
-                       (if (null enabled)
-                           ?!
-                         (if (symbol-value enabled)
-                             ?+
-                           ?-)))
-                     (car pointer)
-                     (if description
-                         (symbol-value description)
-                       "(no description)")))
-      (put-text-property point (point) 'riece-addon (car pointer))
+      (insert (format "%c %-15S %s\n"
+                     (if (not (featurep (car (car pointer))))
+                         ? 
+                       (if (not (get (car (car pointer))
+                                     'riece-addon-insinuated))
+                           ??
+                         (if (or (null enable)
+                                 (not (fboundp enable)))
+                             ?!
+                           (if (get (car (car pointer)) 'riece-addon-enabled)
+                               ?+
+                             ?-))))
+                     (car (car pointer))
+                     (cdr (car pointer))))
+      (put-text-property point (point) 'riece-addon (car (car pointer)))
       (setq pointer (cdr pointer)))
     (insert "
 Symbols in the leftmost column:
 
-  +     The add-on is enabled.
-  -     The add-on is disabled.
-  !    The add-on doesn't support enable/disable operation.
-  ?    The add-on status is unknown.
+   +     The add-on is enabled.
+   -     The add-on is disabled.
+   !     The add-on doesn't support enable/disable operation.
+   ?     The add-on is not insinuated.
+         The add-on is not loaded.
 ")
     (insert (substitute-command-keys "
 Useful keys:
 
-  `\\[riece-command-enable-addon]' to enable the current add-on.
-  `\\[riece-command-disable-addon]' to disable the current add-on.
+   `\\[riece-command-enable-addon]' to enable the current add-on.
+   `\\[riece-command-disable-addon]' to disable the current add-on.
+   `\\[riece-command-insinuate-addon]' to insinuate the add-on.
+   `\\[riece-command-uninstall-addon]' to uninstall the current add-on.
+   `\\[riece-command-unload-addon]' to unload the current add-on.
 "))
     (goto-char (point-min))
     (pop-to-buffer (current-buffer))
     (delete-other-windows)))
 
+(defun riece-addon-list-set-point (addon)
+  (let ((point (point-min)))
+    (while (and (not (eq (get-text-property point 'riece-addon) addon))
+               (setq point (next-single-property-change point
+                                                        'riece-addon))))
+    (if point
+       (goto-char point))))
+
 (defun riece-command-enable-addon (addon)
   (interactive
    (list
@@ -302,9 +418,9 @@ Useful keys:
            (get-text-property (point) 'riece-addon))
        (intern-soft
         (completing-read "Add-on: "
-                         (mapcar (lambda (addon)
-                                   (list (symbol-name addon)))
-                                 riece-addons)
+                         (mapcar (lambda (dependency)
+                                   (list (symbol-name (car dependency))))
+                                 riece-addon-dependencies)
                          (lambda (pointer)
                            (let ((enabled
                                   (intern-soft (concat (car pointer)
@@ -313,18 +429,9 @@ Useful keys:
                                   (null (symbol-value enabled)))))
                          t)))))
   (riece-enable-addon addon t)
-  (let ((enabled (intern-soft (concat (symbol-name addon) "-enabled"))))
-    (if (and (eq major-mode 'riece-addon-list-mode)
-            (get-text-property (point) 'riece-addon)
-            enabled (symbol-value enabled))
-       (save-excursion
-         (beginning-of-line)
-         (let ((point (point))
-               (inhibit-read-only t)
-               buffer-read-only)
-           (delete-char 1)
-           (insert "+")
-           (put-text-property point (point) 'riece-addon addon))))))
+  (when (eq major-mode 'riece-addon-list-mode)
+    (riece-command-list-addons)
+    (riece-addon-list-set-point addon)))
 
 (defun riece-command-disable-addon (addon)
   (interactive
@@ -333,9 +440,9 @@ Useful keys:
            (get-text-property (point) 'riece-addon))
        (intern-soft
         (completing-read "Add-on: "
-                         (mapcar (lambda (addon)
-                                   (list (symbol-name addon)))
-                                 riece-addons)
+                         (mapcar (lambda (dependency)
+                                   (list (symbol-name (car dependency))))
+                                 riece-addon-dependencies)
                          (lambda (pointer)
                            (let ((enabled
                                   (intern-soft (concat (car pointer)
@@ -344,18 +451,67 @@ Useful keys:
                                   (symbol-value enabled))))
                          t)))))
   (riece-disable-addon addon t)
-  (let ((enabled (intern-soft (concat (symbol-name addon) "-enabled"))))
-    (if (and (eq major-mode 'riece-addon-list-mode)
-            (get-text-property (point) 'riece-addon)
-            enabled (null (symbol-value enabled)))
-       (save-excursion
-         (beginning-of-line)
-         (let ((point (point))
-               (inhibit-read-only t)
-               buffer-read-only)
-           (delete-char 1)
-           (insert "-")
-           (put-text-property point (point) 'riece-addon addon))))))
+  (when (eq major-mode 'riece-addon-list-mode)
+    (riece-command-list-addons)
+    (riece-addon-list-set-point addon)))
+
+(defun riece-command-insinuate-addon (addon)
+  (interactive
+   (list
+    (or (if (eq major-mode 'riece-addon-list-mode)
+           (get-text-property (point) 'riece-addon))
+       (intern-soft
+        (completing-read "Add-on: "
+                         (mapcar (lambda (dependency)
+                                   (list (symbol-name (car dependency))))
+                                 riece-addon-modules)
+                         (lambda (pointer)
+                           (not (get (car pointer) 'riece-addon-insinuated)))
+                         t)))))
+  (riece-insinuate-addon addon 'ask)
+  (when (eq major-mode 'riece-addon-list-mode)
+    (riece-command-list-addons)
+    (riece-addon-list-set-point addon)))
+
+(defun riece-command-uninstall-addon (addon)
+  (interactive
+   (list
+    (or (if (eq major-mode 'riece-addon-list-mode)
+           (get-text-property (point) 'riece-addon))
+       (intern-soft
+        (completing-read "Add-on: "
+                         (mapcar (lambda (dependency)
+                                   (list (symbol-name (car dependency))))
+                                 riece-addon-dependencies)
+                         (lambda (pointer)
+                           (get (car pointer) 'riece-addon-insinuated))
+                         t)))))
+  (riece-uninstall-addon addon t)
+  (when (eq major-mode 'riece-addon-list-mode)
+    (riece-command-list-addons)
+    (riece-addon-list-set-point addon)))
+
+(defun riece-command-unload-addon (addon)
+  (interactive
+   (list
+    (or (if (eq major-mode 'riece-addon-list-mode)
+           (get-text-property (point) 'riece-addon))
+       (intern-soft
+        (completing-read "Add-on: "
+                         (mapcar (lambda (dependency)
+                                   (list (symbol-name (car dependency))))
+                                 riece-addon-dependencies)
+                         (lambda (pointer)
+                           (get (car pointer) 'riece-addon-insinuated))
+                         t)))))
+  (riece-uninstall-addon addon t)
+  (if (get addon 'riece-addon-not-unloadable)
+      (message "Add-on %S is not allowed to unload" addon)
+    (unload-feature addon)
+    (message "Add-on %S is unloaded" addon))
+  (when (eq major-mode 'riece-addon-list-mode)
+    (riece-command-list-addons)
+    (riece-addon-list-set-point addon)))
 
 (provide 'riece-addon)
 
index f8243ff..dc11b52 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-alias.el --- define aliases of names
+;;; riece-alias.el --- define aliases for IRC names
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
-;; This add-on allows you to define aliases for IRC names.
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-alias)
+;; This add-on allows you to define aliases for IRC names.
 
-;; For example, if you want to define an alias `#l' for `#Liece', you
+;; For example, if you want to define an alias `#r' for `#riece', you
 ;; can customize riece-alias-alist as follows:
-;; (setq riece-alias-alist '(("#Liece" . "#l")))
+;; (setq riece-alias-alist '(("#riece" . "#r")))
 
 ;;; Code:
 
@@ -36,7 +37,7 @@
 (require 'riece-signal)
 
 (defgroup riece-alias nil
-  "Define aliases of names"
+  "Aliases of channel/user names."
   :prefix "riece-"
   :group 'riece)
 
@@ -50,7 +51,7 @@
   :type 'boolean
   :group 'riece-alias)
 
-(defcustom riece-alias-alternate-separator nil
+(defcustom riece-alias-alternate-separator "@"
   "A string to separate prefix and server."
   :type '(choice (const nil) string)
   :group 'riece-alias)
   :type 'list
   :group 'riece-alias)
 
-(defvar riece-alias-enabled nil)
-
 (defconst riece-alias-description
-  "Define aliases of channel/user names")
+  "Define aliases for IRC names.")
 
 (defun riece-alias-abbrev-percent-hack (string)
   (if (string-match (concat "^#\\([^ ]+\\):"
        #'riece-alias-abbrev-identity-string
        riece-expand-identity-string-function
        #'riece-alias-expand-identity-string)
-  (riece-emit-signal 'channel-list-changed)
-  (setq riece-alias-enabled t))
+  (riece-emit-signal 'channel-list-changed))
 
 (defun riece-alias-disable ()
   (setq riece-abbrev-identity-string-function nil
        riece-expand-identity-string-function nil)
-  (riece-emit-signal 'channel-list-changed)
-  (setq riece-alias-enabled nil))
+  (riece-emit-signal 'channel-list-changed))
 
 (provide 'riece-alias)
 
index 930a2c3..b234b58 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-async.el --- connect to IRC server via asynchronous proxy
+;;; riece-async.el --- connect to IRC server via async proxy
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 
 ;;; Commentary:
 
+;; NOTE: This is an add-on module for Riece.
+
 ;; This program allows to connect to an IRC server via local proxy
 ;; which responds to PING requests from server.
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-async)
-
 ;; If you want to enable this feature per server, write the server
 ;; spec like this:
 ;; (add-to-list 'riece-server-alist
 ;;; Code:
 
 (require 'riece-options)
+(require 'riece-ruby)                  ;riece-ruby-command
 
 (defgroup riece-async nil
-  "Connect to IRC server via asynchronous proxy"
+  "Connect to IRC server via async proxy."
   :prefix "riece-"
   :group 'riece)
 
-(defcustom riece-async-ruby-command "ruby"
-  "Command name for Ruby interpreter."
-  :type 'string
+(defcustom riece-async-buffer-size 65535
+  "Maximum size of the write buffer."
+  :type 'integer
   :group 'riece-async)
 
-(defcustom riece-async-server-program
-  '("\
-require 'io/nonblock'
-socket = TCPSocket.new(" host ", " service ")
-$stdout.write(\"NOTICE CONNECTED #{$$}\\r\\n\")
-$stdout.flush
-$stdout.nonblock = true
-trap('STOP', 'IGNORE')
-trap('TSTP', 'IGNORE')
-wfds_in = []
-buf = ''
-loop do
-  rfds, wfds, = select([socket, $stdin], wfds_in)
-  unless wfds.empty?
-    until buf.length <= " max-buffer-size "
-      i = buf.index(\"\\r\\n\")
-      break unless i
-      buf.slice!(0 .. i + 1)
-    end
-    begin
-      until buf.empty?
-        len = $stdout.syswrite(buf)
-        buf.slice!(0 .. len)
-      end
-      wfds_in = []
-    rescue Errno::EAGAIN
-    end
-  end
-  if rfds.include?(socket)
-    line = socket.gets(\"\\r\\n\")
-    break unless line
-    if line =~ /^(?::[^ ]+ +)?PING +(.+)\\r\\n/i
-      socket.write(\"PONG #{$1}\\r\\n\")
-      socket.flush
-    else
-      wfds_in = [$stdout]
-      buf << line
-    end
-  end
-  if rfds.include?($stdin)
-    line = $stdin.gets(\"\\r\\n\")
-    break unless line
-    socket.write(line)
-    socket.flush
-  end
-end
-socket.close
-")
-  "Ruby program of asynchronous proxy."
-  :type 'list
+(defcustom riece-async-backup-file (expand-file-name "riece-async.bak"
+                                                    riece-directory)
+  "A file which contains outdated messages."
+  :type 'string
   :group 'riece-async)
 
-(defcustom riece-async-max-buffer-size 65535
-  "Maximum size of the write buffer."
-  :type 'integer
-  :group 'riece-async)
+(defvar riece-async-server-program "aproxy.rb"
+  "The server program file.  If the filename is not absolute, it is
+assumed that the file is in the same directory of this file.")
 
-(defconst riece-async-description
-  "Keep IRC connection with external process")
+(defvar riece-async-server-program-arguments
+  (list "-s" riece-async-buffer-size
+       "-b" riece-async-backup-file)
+  "Command line arguments passed to `riece-async-server-program'.")
 
-(defun riece-async-substitute-variables (program variable value)
-  (setq program (copy-sequence program))
-  (let ((pointer program))
-    (while pointer
-      (setq pointer (memq variable program))
-      (if pointer
-         (setcar pointer value)))
-    program))
+(defconst riece-async-description
+  "Connect to IRC server via async proxy.")
 
 ;;;###autoload
 (defun riece-async-open-network-stream (name buffer host service)
-  (let* ((process-connection-type nil)
-        (process (start-process name buffer "ruby" "-rsocket")))
-    (process-kill-without-query process)
-    (process-send-string process
-                        (apply #'concat
-                               (riece-async-substitute-variables
-                                (riece-async-substitute-variables
-                                 (riece-async-substitute-variables
-                                  riece-async-server-program
-                                  'host
-                                  (concat "'" host "'"))
-                                 'service
-                                 (if (numberp service)
-                                     (number-to-string service)
-                                   (concat "'" service "'")))
-                                'max-buffer-size
-                                (number-to-string
-                                 riece-async-max-buffer-size))))
-    (process-send-string process "\0\n") ;input to process is needed
+  (let* (process-connection-type
+        (process
+         (apply #'start-process name buffer riece-ruby-command
+                (expand-file-name riece-async-server-program
+                                  riece-data-directory)
+                riece-async-server-program-arguments)))
     (if buffer
        (save-excursion
          (set-buffer (process-buffer process))
@@ -148,6 +84,7 @@ socket.close
                        (not (looking-at (format "NOTICE CONNECTED %d"
                                                 (process-id process))))))
            (accept-process-output process))))
+    (process-kill-without-query process)
     process))
 
 (defun riece-async-insinuate ()
@@ -156,4 +93,4 @@ socket.close
 
 (provide 'riece-async)
 
-;;; riece-rdcc.el ends here
+;;; riece-async.el ends here
index dfacb9f..62c306c 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-biff.el --- biff add-on
+;;; riece-biff.el --- be notified if messages arrives
 ;; Copyright (C) 2004 OHASHI Akira
 
 ;; Author: OHASHI Akira <bg66@koka-in.org>
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-biff)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 (require 'riece-message)
 
 (defgroup riece-biff nil
-  "Biff for new arrival messages"
+  "Be notified if messages arrives."
+  :prefix "riece-"
   :group 'riece)
 
 (defcustom riece-biff-check-channels nil
 
 (defvar riece-biff-mode-string 'riece-biff-default-mode-string)
 
-(defvar riece-biff-enabled nil)
-
 (defconst riece-biff-description
-  "Biff for new arrival messages")
+  "Be notified if messages arrives.")
 
 (defun riece-biff-after-display-message-function (message)
-  (when (and riece-biff-enabled
+  (when (and (get 'riece-biff 'riece-addon-enabled)
             (not (or (eq (window-buffer (selected-window))
                          (get-buffer riece-command-buffer))
                      (riece-message-own-p message)
@@ -68,7 +66,7 @@
       (setq riece-biff-mode-string 'riece-biff-biff-mode-string))))
 
 (defun riece-biff-clear (&optional dummy)
-  (when riece-biff-enabled
+  (when (get 'riece-biff 'riece-addon-enabled)
     (setq riece-biff-mode-string 'riece-biff-default-mode-string)))
 
 (defun riece-biff-insinuate ()
   (add-hook 'riece-after-switch-to-channel-functions 'riece-biff-clear)
   (add-hook 'riece-exit-hook 'riece-biff-disable))
 
+(defun riece-biff-uninstall ()
+  (remove-hook 'riece-after-display-message-functions
+              'riece-biff-after-display-message-function)
+  (remove-hook 'riece-redisplay-buffers-hook 'riece-biff-clear)
+  (remove-hook 'riece-after-switch-to-channel-functions 'riece-biff-clear)
+  (remove-hook 'riece-exit-hook 'riece-biff-disable))
+
 (defun riece-biff-enable ()
   (setq global-mode-string
        (cond
@@ -87,8 +92,7 @@
          (append '("" riece-biff-mode-string)
                  (remove "" global-mode-string)))
         (t
-         global-mode-string)))
-  (setq riece-biff-enabled t))
+         global-mode-string))))
 
 (defun riece-biff-disable ()
   (setq global-mode-string
          (remq 'riece-biff-mode-string global-mode-string))
         (t
          global-mode-string)))
-  (riece-biff-clear)
-  (setq riece-biff-enabled nil))
+  (riece-biff-clear))
 
 (provide 'riece-biff)
 
index f125dbf..7f78388 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-button.el --- adding buttons in channel buffers
+;;; riece-button.el --- display useful buttons in IRC buffers
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -24,8 +24,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-button)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
   '("User"
     ["Finger (WHOIS)" riece-user-button-finger]
     ["Start Private Conversation" riece-user-button-join-partner]
-    ["Give Channel Operator Privileges" riece-user-button-set-operators]
-    ["Allow To Speak" riece-user-button-set-speakers])
+    ["Set +o" riece-user-button-set-operators]
+    ["Set +v" riece-user-button-set-speakers])
   "Menu for user buttons.")
 
-(defvar riece-button-enabled nil)
-
 (defconst riece-button-description
-  "Display useful buttons in IRC buffers")
+  "Display useful buttons in IRC buffers.")
 
 (defvar help-echo-owns-message)
 (define-widget 'riece-identity-button 'push-button
@@ -207,7 +204,7 @@ This function is used as a callback for a channel button."
 
 (defvar riece-identity-button-map)
 (defun riece-button-add-identity-button (start end)
-  (if riece-button-enabled
+  (if (get 'riece-button 'riece-addon-enabled)
       (riece-scan-property-region
        'riece-identity
        start end
@@ -227,30 +224,70 @@ This function is used as a callback for a channel button."
 (defvar riece-channel-list-mode-map)
 (defvar riece-user-list-mode-map)
 (defvar riece-dialogue-mode-map)
+
+(defun riece-button-channel-list-mode-hook ()
+  (set-keymap-parent riece-channel-list-mode-map widget-keymap)
+  (set (make-local-variable 'riece-identity-button-map)
+       (riece-make-identity-button-map))
+  (add-hook 'riece-update-buffer-functions
+           'riece-button-update-buffer t t))
+
+(defun riece-button-user-list-mode-hook ()
+  (set-keymap-parent riece-user-list-mode-map widget-keymap)
+  (set (make-local-variable 'riece-identity-button-map)
+       (riece-make-identity-button-map))
+  (add-hook 'riece-update-buffer-functions
+           'riece-button-update-buffer t t))
+
+(defun riece-button-dialogue-mode-hook ()
+  (set-keymap-parent riece-dialogue-mode-map widget-keymap)
+  (set (make-local-variable 'riece-identity-button-map)
+       (riece-make-identity-button-map)))
+
 (defun riece-button-insinuate ()
+  (save-excursion
+    (when riece-channel-list-buffer
+      (set-buffer riece-channel-list-buffer)
+      (riece-button-channel-list-mode-hook))
+    (when riece-user-list-buffer
+      (set-buffer riece-user-list-buffer)
+      (riece-button-user-list-mode-hook))
+    (let ((buffers riece-buffer-list))
+      (while buffers
+       (set-buffer (car buffers))
+       (if (eq (derived-mode-class major-mode)
+               'riece-dialogue-mode)
+           (riece-button-dialogue-mode-hook))
+       (setq buffers (cdr buffers)))))
   (add-hook 'riece-channel-list-mode-hook
-           (lambda ()
-             (set-keymap-parent riece-channel-list-mode-map widget-keymap)
-             (set (make-local-variable 'riece-identity-button-map)
-                  (riece-make-identity-button-map))
-             (add-hook 'riece-update-buffer-functions
-                       'riece-button-update-buffer t t)))
+           'riece-button-channel-list-mode-hook)
   (add-hook 'riece-user-list-mode-hook
-           (lambda ()
-             (set-keymap-parent riece-user-list-mode-map widget-keymap)
-             (set (make-local-variable 'riece-identity-button-map)
-                  (riece-make-identity-button-map))
-             (add-hook 'riece-update-buffer-functions
-                       'riece-button-update-buffer t t)))
+           'riece-button-user-list-mode-hook)
   (add-hook 'riece-dialogue-mode-hook
-           (lambda ()
-             (set-keymap-parent riece-dialogue-mode-map widget-keymap)
-             (set (make-local-variable 'riece-identity-button-map)
-                  (riece-make-identity-button-map))))
+           'riece-button-dialogue-mode-hook)
   (add-hook 'riece-after-insert-functions 'riece-button-add-identity-button))
 
+(defun riece-button-uninstall ()
+  (let ((buffers riece-buffer-list))
+    (save-excursion
+      (while buffers
+       (set-buffer (car buffers))
+       (remove-hook 'riece-update-buffer-functions
+                    'riece-button-update-buffer t)
+       (if (local-variable-p 'riece-identity-button-map
+                             (car buffers))
+           (kill-local-variable 'riece-identity-button-map))
+       (setq buffers (cdr buffers)))))
+  (remove-hook 'riece-channel-list-mode-hook
+              'riece-button-channel-list-mode-hook)
+  (remove-hook 'riece-user-list-mode-hook
+              'riece-button-user-list-mode-hook)
+  (remove-hook 'riece-dialogue-mode-hook
+              'riece-button-dialogue-mode-hook)
+  (remove-hook 'riece-after-insert-functions
+              'riece-button-add-identity-button))
+
 (defun riece-button-enable ()
-  (setq riece-button-enabled t)
   (let ((pointer riece-buffer-list))
     (while pointer
       (with-current-buffer (car pointer)
@@ -263,7 +300,6 @@ This function is used as a callback for a channel button."
     (riece-emit-signal 'channel-list-changed)))
 
 (defun riece-button-disable ()
-  (setq riece-button-enabled nil)
   (save-excursion
     (let ((pointer riece-buffer-list))
       (while pointer
index 459797b..a505f20 100644 (file)
@@ -27,7 +27,7 @@
 (require 'riece-globals)
 
 (defgroup riece-coding nil
-  "Coding system"
+  "Coding system."
   :tag "Coding"
   :prefix "riece-"
   :group 'riece)
index b3398ce..bc6fbcb 100644 (file)
@@ -144,6 +144,13 @@ the layout to the selected layout-name."
        riece-save-variables-are-dirty t)
   (riece-command-configure-windows))
 
+(defun riece-command-toggle-others-buffer-mode ()
+  (interactive)
+  (setq riece-others-buffer-mode
+       (not riece-others-buffer-mode)
+       riece-save-variables-are-dirty t)
+  (riece-command-configure-windows))
+
 (defun riece-command-toggle-user-list-buffer-mode ()
   (interactive)
   (setq riece-user-list-buffer-mode
index 45eebf8..0afefe8 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-ctcp.el --- CTCP add-on
+;;; riece-ctcp.el --- CTCP (Client To Client Protocol) support
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
+
 ;;; Code:
 
 (require 'riece-version)
 
 (defvar riece-dialogue-mode-map)
 
-(defvar riece-ctcp-enabled nil)
-
 (defconst riece-ctcp-description
-  "CTCP (Client To Client Protocol) support")
+  "CTCP (Client To Client Protocol) support.")
 
 (defun riece-handle-ctcp-request (prefix string)
-  (when (and riece-ctcp-enabled prefix string
+  (when (and (get 'riece-ctcp 'riece-addon-enabled) prefix string
             (riece-prefix-nickname prefix))
     (let* ((parameters (riece-split-parameters string))
           (targets (split-string (car parameters) ","))
                  (after-hook
                   (intern (concat "riece-ctcp-after-" request
                                   "-request-hook"))))
-             (unless (riece-ignore-errors (symbol-name hook)
-                       (run-hook-with-args-until-success
-                        hook prefix (car targets) message))
+             (unless (riece-funcall-ignore-errors
+                      (symbol-name hook)
+                      #'run-hook-with-args-until-success
+                      hook prefix (car targets) message)
                (if function
                    (riece-funcall-ignore-errors (symbol-name function)
                                                  function prefix (car targets)
                                                  message))
-               (riece-ignore-errors (symbol-name after-hook)
-                 (run-hook-with-args-until-success
-                  after-hook prefix (car targets) message))))
+               (riece-funcall-ignore-errors (symbol-name after-hook)
+                                            #'run-hook-with-args-until-success
+                                            after-hook prefix (car targets)
+                                            message)))
            t)))))
 
 (defun riece-handle-ctcp-version-request (prefix target string)
       "\n"))))
 
 (defun riece-handle-ctcp-response (prefix string)
-  (when (and riece-ctcp-enabled prefix string
+  (when (and (get 'riece-ctcp 'riece-addon-enabled) prefix string
             (riece-prefix-nickname prefix))
     (let* ((parameters (riece-split-parameters string))
           (targets (split-string (car parameters) ","))
                  (after-hook
                   (intern (concat "riece-ctcp-after-" response
                                   "-response-hook"))))
-             (unless (riece-ignore-errors (symbol-name hook)
-                       (run-hook-with-args-until-success
-                        hook prefix (car targets) message))
+             (unless (riece-funcall-ignore-errors
+                      (symbol-name hook)
+                      #'run-hook-with-args-until-success
+                      hook prefix (car targets) message)
                (if function
                    (riece-funcall-ignore-errors
                     (symbol-name function)
                     function prefix (car targets) message))
-               (riece-ignore-errors (symbol-name after-hook)
-                 (run-hook-with-args-until-success
-                  after-hook prefix (car targets) message))))
+               (riece-funcall-ignore-errors (symbol-name after-hook)
+                                            #'run-hook-with-args-until-success
+                                            after-hook prefix (car targets)
+                                            message)))
            t)))))
 
 (defun riece-handle-ctcp-version-response (prefix target string)
   (if (memq 'riece-highlight riece-addons)
       '(riece-highlight)))
 
+(defvar riece-ctcp-dialogue-font-lock-keywords
+  (list (concat "^" riece-time-prefix-regexp "\\("
+               (regexp-quote riece-ctcp-action-prefix)
+               ".*\\)$")
+       1 riece-ctcp-action-face t t))
+
 (defun riece-ctcp-insinuate ()
   (add-hook 'riece-privmsg-hook 'riece-handle-ctcp-request)
   (add-hook 'riece-notice-hook 'riece-handle-ctcp-response)
   (if (memq 'riece-highlight riece-addons)
       (setq riece-dialogue-font-lock-keywords
-           (cons (list (concat "^" riece-time-prefix-regexp "\\("
-                               (regexp-quote riece-ctcp-action-prefix)
-                               ".*\\)$")
-                       1 riece-ctcp-action-face t t)
+           (cons riece-ctcp-dialogue-font-lock-keywords
                  riece-dialogue-font-lock-keywords))))
 
+(defun riece-ctcp-uninstall ()
+  (remove-hook 'riece-privmsg-hook 'riece-handle-ctcp-request)
+  (remove-hook 'riece-notice-hook 'riece-handle-ctcp-response)
+  (setq riece-dialogue-font-lock-keywords
+       (delq riece-ctcp-dialogue-font-lock-keywords
+             riece-dialogue-font-lock-keywords)))
+
 (defun riece-ctcp-enable ()
   (define-key riece-dialogue-mode-map "\C-cv" 'riece-command-ctcp-version)
   (define-key riece-dialogue-mode-map "\C-cp" 'riece-command-ctcp-ping)
   (define-key riece-dialogue-mode-map "\C-ca" 'riece-command-ctcp-action)
   (define-key riece-dialogue-mode-map "\C-cc" 'riece-command-ctcp-clientinfo)
-  (define-key riece-dialogue-mode-map "\C-ct" 'riece-command-ctcp-time)
-  (setq riece-ctcp-enabled t))
+  (define-key riece-dialogue-mode-map "\C-ct" 'riece-command-ctcp-time))
 
 (defun riece-ctcp-disable ()
   (define-key riece-dialogue-mode-map "\C-cv" nil)
   (define-key riece-dialogue-mode-map "\C-cp" nil)
   (define-key riece-dialogue-mode-map "\C-ca" nil)
   (define-key riece-dialogue-mode-map "\C-cc" nil)
-  (define-key riece-dialogue-mode-map "\C-ct" nil)
-  (setq riece-ctcp-enabled nil))
+  (define-key riece-dialogue-mode-map "\C-ct" nil))
 
 (provide 'riece-ctcp)
 
index 987e4ca..842c6a1 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-ctlseq.el --- highlight control sequences in channel buffers
+;;; riece-ctlseq.el --- mark up control sequences in IRC buffers
 ;; Copyright (C) 1998-2004 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -24,8 +24,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-ctlseq)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
@@ -33,7 +32,8 @@
 (require 'riece-misc)
 
 (defgroup riece-ctlseq nil
-  "Highlight control sequences in IRC buffer."
+  "Mark up control sequences in IRC buffer."
+  :prefix "riece-"
   :group 'riece)
 
 (defcustom riece-ctlseq-colors
 (defvar riece-ctlseq-face-cache nil)
 (defvar riece-ctlseq-face-counter 0)
 
-(defvar riece-ctlseq-enabled nil)
-
-(defvar riece-ctlseq-description
-  "Highlight control sequences in IRC buffers")
+(defconst riece-ctlseq-description
+  "Mark up control sequences in IRC buffers.")
 
 (defun riece-ctlseq-compatible-attributes-p (this other)
   (let ((pointer this))
     attrs)))
 
 (defun riece-ctlseq-message-filter (message)
-  (if riece-ctlseq-enabled
+  (if (get 'riece-ctlseq 'riece-addon-enabled)
       (let ((start 0)
            (end (length (riece-message-text message)))
            attrs)
 (defun riece-ctlseq-insinuate ()
   (add-hook 'riece-message-filter-functions 'riece-ctlseq-message-filter))
 
+(defun riece-ctlseq-uninstall ()
+  (remove-hook 'riece-message-filter-functions 'riece-ctlseq-message-filter))
+
 (defun riece-ctlseq-enable ()
-  (setq riece-ctlseq-enabled t))
+  )
 
 (defun riece-ctlseq-disable ()
-  (setq riece-ctlseq-enabled nil))
+  )
 
 (provide 'riece-ctlseq)
 
index def5997..cddd944 100644 (file)
 (require 'riece-globals)
 (require 'riece-options)
 
-(defun riece-debug (message &optional detail)
-  "Print a one-line debug MESSAGE at the bottom of the frame.
-If the optional 2nd argument DETAIL is specified, it is stored into
-`riece-debug-buffer'."
+(defun riece-debug-1 (message detail)
   (message "riece-debug: %s" message)
   (save-excursion
     (set-buffer riece-debug-buffer)
     (goto-char (point-max))
-    (let ((point (point)))
+    (let ((time (format-time-string "%Y-%m-%d:%H:%M:%S")))
       (if detail
-         (insert message "\n" detail "\n")
-       (insert message "\n")))))
+         (insert "*** " time ": " message "\n" detail "\n")
+       (insert "*** " time ": " message "\n")))))
+
+(defun riece-debug (message &optional detail)
+  "Print a one-line debug MESSAGE at the bottom of the frame.
+If the optional 2nd argument DETAIL is specified, it is stored into
+`riece-debug-buffer'."
+  (ignore (riece-debug-1 message detail)))
 
 (defun riece-debug-reset-standard-output ()
   "Reset `riece-temp-buffer' to be used as `standard-output'."
index 037f437..a3d59e2 100644 (file)
@@ -429,7 +429,14 @@ Local to the buffer in `riece-buffer-list'.")
     (current-buffer)))
 
 (defun riece-channel-buffer (identity)
-  (cdr (riece-identity-assoc identity riece-channel-buffer-alist)))
+  (let ((entry (riece-identity-assoc identity riece-channel-buffer-alist)))
+    (if entry
+       (if (buffer-live-p (cdr entry))
+           (cdr entry)
+         (if riece-debug
+             (riece-debug
+              (format "riece-channel-buffer: nonexistent buffer: %s"
+                      (riece-format-identity identity))))))))
 
 (defun riece-switch-to-channel (identity)
   (let ((last riece-current-channel)
index 61a33f0..941841d 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-doctor.el --- "become a psychotherapist" add-on
+;;; riece-doctor.el --- pretend to be a psychotherapist
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 
 ;;; Commentary:
 
-;; This add-on allows you to become a psychotherapist.
-
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-doctor)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 (require 'riece-server)
 
 (defgroup riece-doctor nil
-  "Interface to doctor.el"
+  "Interface to doctor.el."
   :prefix "riece-"
   :group 'riece)
 
-(defcustom riece-doctor-hello-regexp "^, doctor"
+(defcustom riece-doctor-hello-regexp "^,doctor$"
   "Pattern of string patients start consultation."
   :type 'string
   :group 'riece-doctor)
 
-(defcustom riece-doctor-bye-regexp "^, bye doctor"
+(defcustom riece-doctor-bye-regexp "^,doctor bye$"
   "Pattern of string patients end consultation."
   :type 'string
   :group 'riece-doctor)
 
 (defvar riece-doctor-patients nil)
 
-(defvar riece-doctor-enabled nil)
-
 (defconst riece-doctor-description
-  "Allow users in channel to talk with the classic pseudo-AI")
+  "Pretend to be a psychotherapist.")
 
 (put 'riece-doctor 'riece-addon-default-disabled t)
 
@@ -76,7 +71,7 @@
   (riece-send-string (format "NOTICE %s :%s\r\n" target string)))
 
 (defun riece-doctor-after-privmsg-hook (prefix string)
-  (if riece-doctor-enabled
+  (if (get 'riece-doctor 'riece-addon-enabled)
       (let* ((user (riece-prefix-nickname prefix))
             (parameters (riece-split-parameters string))
             (targets (split-string (car parameters) ","))
@@ -129,11 +124,14 @@ Please, describe your problems."
 (defun riece-doctor-insinuate ()
   (add-hook 'riece-after-privmsg-hook 'riece-doctor-after-privmsg-hook))
 
+(defun riece-doctor-uninstall ()
+  (remove-hook 'riece-after-privmsg-hook 'riece-doctor-after-privmsg-hook))
+
 (defun riece-doctor-enable ()
-  (setq riece-doctor-enabled t))
+  )
 
 (defun riece-doctor-disable ()
-  (setq riece-doctor-enabled nil))
+  )
 
 (provide 'riece-doctor)
 
index 7477633..0805794 100644 (file)
@@ -135,6 +135,16 @@ If N is nil, all messages will be returned."
            (reverse-region (point-min) (point-max))
            (buffer-string))))))
 
+(defun riece-remprop (symbol property)
+  (let ((plist (symbol-plist symbol)))
+    (if (eq (car plist) property)
+       (setplist symbol (cdr (cdr plist)))
+      (while (and (nthcdr 2 plist)
+                 (not (eq (car (nthcdr 2 plist)) property)))
+       (setq plist (nthcdr 2 plist)))
+      (if (nthcdr 2 plist)
+         (setcdr (cdr plist) (nthcdr 4 plist))))))
+
 (provide 'riece-emacs)
 
 ;;; riece-emacs.el ends here
diff --git a/lisp/riece-eval-ruby.el b/lisp/riece-eval-ruby.el
new file mode 100644 (file)
index 0000000..a6c2315
--- /dev/null
@@ -0,0 +1,97 @@
+;;; riece-eval-ruby.el --- evaluate input string as a Ruby program
+;; Copyright (C) 1998-2005 Daiki Ueno
+
+;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Created: 1998-09-28
+;; Keywords: IRC, riece, Ruby
+
+;; This file is part of Riece.
+
+;; This program 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.
+
+;; This program 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.
+
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
+
+;;; Code:
+
+(require 'riece-ruby)
+(require 'riece-message)
+
+(defgroup riece-eval-ruby nil
+  "Evaluate input string as a Ruby program."
+  :prefix "riece-"
+  :group 'riece)
+
+(defcustom riece-eval-ruby-prefix-regexp "^,ruby\\s-+"
+  "Pattern of of the prefix for sending Ruby programs."
+  :type 'string
+  :group 'riece-eval-ruby)
+
+(defconst riece-eval-ruby-description
+  "Evaluate input string as a Ruby program.")
+
+(defun riece-eval-ruby-exit-handler (name)
+  (riece-ruby-inspect name)
+  (let* ((data (copy-sequence (or riece-ruby-data "nil")))
+        (length (length data))
+        (index 0))
+    (while (< index length)
+      (if (eq (aref data index) ?\n)
+         (aset data index ? ))
+      (setq index (1+ index)))
+    (riece-send-string
+     (format "NOTICE %s :%s\r\n"
+            (riece-identity-prefix
+             (riece-ruby-property name 'riece-eval-ruby-target))
+            data))
+    (riece-display-message
+     (riece-make-message (riece-current-nickname)
+                        (riece-ruby-property name 'riece-eval-ruby-target)
+                        data
+                        'notice))))
+
+(defun riece-eval-ruby-display-message-function (message)
+  (if (and (get 'riece-eval-ruby 'riece-addon-enabled)
+          (riece-message-own-p message)
+          (string-match riece-eval-ruby-prefix-regexp
+                        (riece-message-text message)))
+      (let ((name (riece-ruby-execute
+                  (substring (riece-message-text message)
+                             (match-end 0)))))
+       (riece-ruby-set-property name
+                                'riece-eval-ruby-target
+                                (riece-message-target message))
+       (riece-ruby-set-exit-handler name
+                                    #'riece-eval-ruby-exit-handler))))
+
+(defun riece-eval-ruby-insinuate ()
+  (add-hook 'riece-after-display-message-functions
+           'riece-eval-ruby-display-message-function))
+
+(defun riece-eval-ruby-uninstall ()
+  (remove-hook 'riece-after-display-message-functions
+              'riece-eval-ruby-display-message-function))
+
+(defun riece-eval-ruby-enable ()
+  )
+
+(defun riece-eval-ruby-disable ()
+  )
+
+(provide 'riece-eval-ruby)
+
+;;; riece-eval-ruby.el ends here
index c54079f..71b308e 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-eval.el --- eval add-on
+;;; riece-eval.el --- evaluate input string as an elisp form
 ;; Copyright (C) 2005 OHASHI Akira
 
 ;; Author: OHASHI Akira <bg66@koka-in.org>
 
 ;;; Commentary:
 
-;; This add-on evaluates an input string as lisp object and sends a result
-;; as notice. Note the risky of this add-on.
-
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-eval)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
@@ -35,7 +31,7 @@
 (require 'riece-message)
 
 (defgroup riece-eval nil
-  "Evaluate an input string as lisp object."
+  "Evaluate an input string as an elisp form."
   :prefix "riece-"
   :group 'riece)
 
   :type 'boolean
   :group 'riece-eval)
 
-(defvar riece-eval-enabled nil)
-
 (defconst riece-eval-description
-  "Evaluate an input string as lisp object.")
+  "Evaluate an input string as an elisp form.")
 
 (defun riece-eval-display-message-function (message)
-  (when (and riece-eval-enabled
+  (when (and (get 'riece-eval 'riece-addon-enabled)
             (riece-message-own-p message)
             (string-match riece-eval-regexp (riece-message-text message)))
     (let* ((form (match-string 1 (riece-message-text message)))
   (add-hook 'riece-after-display-message-functions
            'riece-eval-display-message-function))
 
+(defun riece-eval-uninstall ()
+  (remove-hook 'riece-after-display-message-functions
+              'riece-eval-display-message-function))
+
 (defun riece-eval-enable ()
-  (setq riece-eval-enabled t))
+  )
 
 (defun riece-eval-disable ()
-  (setq riece-eval-enabled nil))
+  )
 
 (provide 'riece-eval)
 
index a07d0c6..44b5eda 100644 (file)
   (let ((function (intern-soft (concat "riece-handle-" message "-message")))
        (hook (intern (concat "riece-" message "-hook")))
        (after-hook (intern (concat "riece-after-" message "-hook"))))
-    (unless (riece-ignore-errors (symbol-name hook)
-             (run-hook-with-args-until-success hook prefix string))
+    (unless (riece-funcall-ignore-errors (symbol-name hook)
+                                        #'run-hook-with-args-until-success
+                                        hook prefix string)
       (if function
          (riece-funcall-ignore-errors (symbol-name function)
                                       function prefix string))
-      (riece-ignore-errors (symbol-name after-hook)
-       (run-hook-with-args-until-success after-hook prefix string)))))
+      (riece-funcall-ignore-errors (symbol-name after-hook)
+                                  #'run-hook-with-args-until-success
+                                  after-hook prefix string))))
 
 (defsubst riece-chomp-string (string)
   (if (string-match "\r\\'" string)
index 75e2e97..6c1a352 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-foolproof.el --- channel miss killer
+;;; riece-foolproof.el --- prevent miss-operation in the command buffer
 ;; Copyright (C) 2004 TAKAHASHI Kaoru
 
 ;; Author: TAKAHASHI "beatmaria" Kaoru <kaoru@kaisei.org>
 
 ;;; Commentary:
 
-;; This add-on channel miss hold in check
-
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-foolproof)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
   (require 'riece-identity)
   (require 'riece-display))
 
-(defvar riece-foolproof-enabled nil)
-
 (defconst riece-foolproof-description
-  "Channel miss killer")
+  "Prevent miss-operation in the command buffer.")
 
 (defun riece-foolproof-get-channel-window (identity)
   (get-buffer-window
@@ -45,7 +40,7 @@
         identity riece-channel-buffer-alist))))
 
 (defun riece-foolproof-command-send-message-function ()
-  (when riece-foolproof-enabled
+  (when (get 'riece-foolproof 'riece-addon-enabled)
     (unless (or (not riece-channel-buffer-mode)
                (riece-foolproof-get-channel-window
                 riece-current-channel))
   (add-hook 'riece-command-send-message-hook
            'riece-foolproof-command-send-message-function))
 
+(defun riece-foolproof-uninstall ()
+  (remove-hook 'riece-command-send-message-hook
+              'riece-foolproof-command-send-message-function))
+
 (defun riece-foolproof-enable ()
-  (setq riece-foolproof-enabled t))
+  )
 
 (defun riece-foolproof-disable ()
-  (setq riece-foolproof-enabled nil))
+  )
 
 (provide 'riece-foolproof)
 
index 8a9b634..c36c752 100644 (file)
@@ -71,6 +71,8 @@
 (defvar riece-channel-obarray-size 103
   "The size of obarray used by riece on channelname space.")
 
+(defvar riece-addon-dependencies nil)
+
 ;;; Variables local to the server buffers:
 (defvar riece-server-name nil
   "The name of the server.
@@ -149,6 +151,7 @@ Local to the channel buffers.")
 Local to the channel buffers.")
 
 ;;; Modeline indicators:
+(defvar riece-mode-line-buffer-identification nil)
 (defvar riece-channel-indicator "None"
   "String displayed on the modeline to indicate the current channel.")
 (defvar riece-long-channel-indicator "None"
index f3e0df9..368d431 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-google.el --- Interface to Google API
+;;; riece-google.el --- search keywords by Google
 ;; Copyright (C) 2005 OHASHI Akira
 
 ;; Author: OHASHI Akira <bg66@koka-in.org>
 
 ;;; Commentary:
 
-;; This add-on searches keywords by Google.
+;; NOTE: This is an add-on module for Riece.
 
 ;; Ruby code was stolen (and modified) from nadoka.
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-google)
-
 ;;; Code:
 
 (require 'riece-message)
 
 (defgroup riece-google nil
-  "Interface to Google API."
+  "Search keywords by Google."
   :prefix "riece-"
   :group 'riece)
 
@@ -157,15 +154,13 @@ end
 (defconst riece-google-regexp
   "^go\\(o+\\)gle\\(:\\([a-z]+\\)\\)?>\\s-*\\(.*\\)")
 
-(defvar riece-google-enabled nil)
-
 (defconst riece-google-description
   "Search keywords by Google.")
 
 (defvar riece-google-target nil)
 
 (defun riece-google-display-message-function (message)
-  (when (and riece-google-enabled
+  (when (and (get 'riece-google 'riece-addon-enabled)
             (stringp riece-google-license-key)
             (string-match riece-google-regexp (riece-message-text message)))
     (let ((keywords (match-string 4 (riece-message-text message)))
@@ -237,11 +232,15 @@ end
   (add-hook 'riece-after-display-message-functions
            'riece-google-display-message-function))
 
+(defun riece-google-uninstall ()
+  (remove-hook 'riece-after-display-message-functions
+              'riece-google-display-message-function))
+
 (defun riece-google-enable ()
-  (setq riece-google-enabled t))
+  )
 
 (defun riece-google-disable ()
-  (setq riece-google-enabled nil))
+  )
 
 (provide 'riece-google)
 
index a4df612..c5c3270 100644 (file)
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
+
 ;;; Code:
 
 (require 'riece-identity)
 (require 'riece-commands)
 
 (defgroup riece-guess nil
-  "Guess the next channel"
+  "Guess the next channel."
   :tag "Guess"
   :prefix "riece-"
   :group 'riece)
   :type '(repeat function)
   :group 'riece-guess)
 
-(defvar riece-guess-enabled nil)
-
 (defconst riece-guess-description
-  "Guess the next channel, using multiple methods")
+  "Guess the next channel, using multiple methods.")
 
 (defvar riece-current-channels)
 
@@ -99,8 +101,7 @@ merge the results."
   (define-key riece-dialogue-mode-map
     "g" 'riece-command-guess-switch-to-channel)
   (define-key riece-channel-list-mode-map
-    "g" 'riece-command-guess-switch-to-channel)
-  (setq riece-guess-enabled t))
+    "g" 'riece-command-guess-switch-to-channel))
 
 (defun riece-guess-disable ()
   (define-key riece-command-mode-map
@@ -108,8 +109,7 @@ merge the results."
   (define-key riece-dialogue-mode-map
     "g" nil)
   (define-key riece-channel-list-mode-map
-    "g" nil)
-  (setq riece-guess-enabled nil))
+    "g" nil))
 
 (provide 'riece-guess)
 
index c4fd54c..a559c36 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-hangman.el --- hangman
+;;; riece-hangman.el --- allow channel members to play the hangman game
 ;; Copyright (C) 1998-2004 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -23,8 +23,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-hangman)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 (require 'riece-server)
 
 (defgroup riece-hangman nil
-  "Interface to hangman.el"
+  "Allow channel members to play the hangman game."
   :prefix "riece-"
   :group 'riece)
 
-(defcustom riece-hangman-hello-regexp "^, hangman"
+(defcustom riece-hangman-hello-regexp "^,hangman$"
   "Pattern of string to start the game."
   :type 'string
   :group 'riece-hangman)
 
-(defcustom riece-hangman-bye-regexp "^, bye hangman"
+(defcustom riece-hangman-bye-regexp "^,hangman bye$"
   "Pattern of string to end the game."
   :type 'string
   :group 'riece-hangman)
 (defvar riece-hangman-player-context-alist nil)
 (defvar riece-hangman-words-buffer nil)
 
-(defvar riece-hangman-enabled nil)
-
 (defconst riece-hangman-description
-  "Allow users in channel to play classic textual game \"hangman\"")
+  "Allow channel members to play the hangman game.")
 
 (put 'riece-hangman 'riece-addon-default-disabled t)
 
@@ -141,7 +138,7 @@ The wordlist is read from `riece-hangman-words-file'."
               "")))))
 
 (defun riece-hangman-after-privmsg-hook (prefix string)
-  (if riece-hangman-enabled
+  (if (get 'riece-hangman 'riece-addon-enabled)
       (let* ((user (riece-prefix-nickname prefix))
             (parameters (riece-split-parameters string))
             (targets (split-string (car parameters) ","))
@@ -228,12 +225,14 @@ The wordlist is read from `riece-hangman-words-file'."
 (defun riece-hangman-insinuate ()
   (add-hook 'riece-after-privmsg-hook 'riece-hangman-after-privmsg-hook))
 
+(defun riece-hangman-uninstall ()
+  (remove-hook 'riece-after-privmsg-hook 'riece-hangman-after-privmsg-hook))
+
 (defun riece-hangman-enable ()
-  (random t)
-  (setq riece-hangman-enabled t))
+  (random t))
 
 (defun riece-hangman-disable ()
-  (setq riece-hangman-enabled nil))
+  )
 
 (provide 'riece-hangman)
 
index 6b3dbb5..7758627 100644 (file)
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
+
 ;;; Code:
 
 (require 'riece-globals)
 (require 'derived)
 
 (defgroup riece-highlight nil
-  "Highlight IRC buffers"
+  "Decorate IRC buffers with faces and fonts."
   :tag "Highlight"
   :prefix "riece-"
   :group 'riece)
 
 (defgroup riece-highlight-faces nil
-  "Faces for highlight IRC buffers"
+  "Faces for highlight IRC buffers."
   :tag "Faces"
   :prefix "riece-highlight-"
   :group 'riece-highlight)
   (set-face-foreground 'riece-modeline-current-face
                       (face-foreground 'riece-channel-list-current-face)))
 
-(defvar riece-highlight-enabled nil)
-
 (defconst riece-highlight-description
-  "Highlight IRC buffers")
+  "Highlight IRC buffers.")
 
 (defun riece-highlight-server-match (limit)
   (and (re-search-forward "(from [^)]+)$" limit t)
   (font-lock-set-defaults)
   (make-local-hook 'after-change-functions)
   (add-hook 'after-change-functions
-           'riece-highlight-hide-prefix nil 'local)
-  (if riece-highlight-enabled
+           'riece-highlight-hide-prefix nil t)
+  (if (get 'riece-highlight 'riece-addon-enabled)
       (font-lock-mode 1)))
 
 (defun riece-highlight-setup-channel-list ()
   ;; In XEmacs, auto-initialization of font-lock is not affective
   ;; when buffer-file-name is not set.
   (font-lock-set-defaults)
-  (if riece-highlight-enabled
+  (if (get 'riece-highlight 'riece-addon-enabled)
       (font-lock-mode 1)))
 
 (defun riece-highlight-hide-prefix (start end length)
        (put-text-property (match-beginning 1) (match-end 1) 'invisible t))))
 
 (defun riece-highlight-put-overlay-faces (start end)
-  (if riece-highlight-enabled
+  (if (get 'riece-highlight 'riece-addon-enabled)
       (riece-scan-property-region
        'riece-overlay-face
        start end
 
 (defun riece-highlight-format-identity-for-channel-list-indicator (index
                                                                   identity)
-  (if (and riece-highlight-enabled
+  (if (and (get 'riece-highlight 'riece-addon-enabled)
           (riece-identity-equal identity riece-current-channel))
       (let ((string (riece-format-identity identity))
            (start 0))
 (defun riece-highlight-insinuate ()
   (put 'riece-channel-mode 'font-lock-defaults
        '(riece-dialogue-font-lock-keywords t))
-  (add-hook 'riece-channel-mode-hook
-           'riece-highlight-setup-dialogue)
   (put 'riece-others-mode 'font-lock-defaults
        '(riece-dialogue-font-lock-keywords t))
-  (add-hook 'riece-others-mode-hook
-           'riece-highlight-setup-dialogue)
   (put 'riece-dialogue-mode 'font-lock-defaults
        '(riece-dialogue-font-lock-keywords t))
   (add-hook 'riece-dialogue-mode-hook
   (add-hook 'riece-after-insert-functions
            'riece-highlight-put-overlay-faces))
 
+(defun riece-highlight-uninstall ()
+  (let ((buffers riece-buffer-list))
+    (save-excursion
+      (while buffers
+       (set-buffer (car buffers))
+       (if (eq (derived-mode-class major-mode)
+               'riece-dialogue-mode)
+           (remove-hook 'after-change-functions
+                        'riece-highlight-hide-prefix t))
+       (setq buffers (cdr buffers)))))
+  (riece-remprop 'riece-channel-mode 'font-lock-defaults)
+  (riece-remprop 'riece-others-mode 'font-lock-defaults)
+  (riece-remprop 'riece-dialogue-mode 'font-lock-defaults)
+  (remove-hook 'riece-dialogue-mode-hook
+              'riece-highlight-setup-dialogue)
+  (riece-remprop 'riece-channel-list-mode 'font-lock-defaults)
+  (remove-hook 'riece-channel-list-mode-hook
+              'riece-highlight-setup-channel-list)
+  (remove-hook 'riece-format-identity-for-channel-list-indicator-functions
+              'riece-highlight-format-identity-for-channel-list-indicator)
+  (remove-hook 'riece-after-insert-functions
+              'riece-highlight-put-overlay-faces))
+
 (defun riece-highlight-enable ()
   (let ((buffers riece-buffer-list))
     (while buffers
                '(riece-dialogue-mode riece-channel-list-mode))
          (with-current-buffer (car buffers)
            (font-lock-mode 1)))
-      (setq buffers (cdr buffers))))
-  (setq riece-highlight-enabled t))
+      (setq buffers (cdr buffers)))))
 
 (defun riece-highlight-disable ()
   (let ((buffers riece-buffer-list))
                '(riece-dialogue-mode riece-channel-list-mode))
          (with-current-buffer (car buffers)
            (font-lock-mode 0)))
-      (setq buffers (cdr buffers))))
-  (setq riece-highlight-enabled nil))
+      (setq buffers (cdr buffers)))))
 
 (provide 'riece-highlight)
 
index 4ea6448..d9e309f 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-history.el --- channel history management add-on
+;;; riece-history.el --- manage history of channel shifting
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -23,6 +23,8 @@
 
 ;;; Commentary:
 
+;; NOTE: This is an add-on module for Riece.
+
 ;; You can check recently visited channels via `C-c g' in the commands
 ;; buffer, by adding the following lines to ~/.riece/init.el:
 
 
 (require 'riece-options)
 (require 'riece-globals)
-(require 'riece-highlight)
 (require 'riece-identity)
 (require 'riece-signal)
 (require 'ring)
+(require 'riece-highlight)
 
 (defgroup riece-history nil
-  "Channel history"
+  "Manage history of channel shifting."
   :tag "History"
   :prefix "riece-"
   :group 'riece)
 
 (defvar riece-channel-history nil)
 
-(defvar riece-history-enabled nil)
-
 (defconst riece-history-description
-  "Keep track channel history")
+  "Manage history of channel shifting.")
 
 (defun riece-guess-channel-from-history ()
   (let ((length (ring-length riece-channel-history))
@@ -89,7 +89,7 @@
     (nreverse result)))
 
 (defun riece-history-format-identity-for-channel-list-buffer (index identity)
-  (if (and riece-history-enabled
+  (if (and (get 'riece-history 'riece-addon-enabled)
           (not (ring-empty-p riece-channel-history))
           (riece-identity-equal identity (ring-ref riece-channel-history 0)))
       (concat (format "%2d:+" index)
@@ -97,7 +97,7 @@
 
 (defun riece-history-format-identity-for-channel-list-indicator (index
                                                                 identity)
-  (if (and riece-history-enabled
+  (if (and (get 'riece-history 'riece-addon-enabled)
           (not (ring-empty-p riece-channel-history))
           (riece-identity-equal identity (ring-ref riece-channel-history 0)))
       (let ((string (riece-format-identity identity))
 ;;;   (if (memq 'riece-guess riece-addons)
 ;;;       '(riece-guess)))
 
+(defun riece-history-after-switch-to-channel-functions (last)
+  (if (and (get 'riece-history 'riece-addon-enabled) last
+          (not (riece-identity-equal last riece-current-channel)))
+      (ring-insert riece-channel-history last)))
+
+(defun riece-history-requires ()
+  (if (memq 'riece-highlight riece-addons)
+      '(riece-highlight)))
+
 (defun riece-history-insinuate ()
   (add-hook 'riece-after-switch-to-channel-functions
-           (lambda (last)
-             (if (and riece-history-enabled last
-                      (not (riece-identity-equal last riece-current-channel)))
-                 (ring-insert riece-channel-history last))))
+           'riece-history-after-switch-to-channel-functions)
   (add-hook 'riece-format-identity-for-channel-list-buffer-functions
            'riece-history-format-identity-for-channel-list-buffer)
   (add-hook 'riece-format-identity-for-channel-list-indicator-functions
 ;;;            'riece-guess-channel-from-history))
   )
 
+(defun riece-history-uninstall ()
+  (remove-hook 'riece-after-switch-to-channel-functions
+              'riece-history-after-switch-to-channel-functions)
+  (remove-hook 'riece-format-identity-for-channel-list-buffer-functions
+              'riece-history-format-identity-for-channel-list-buffer)
+  (remove-hook 'riece-format-identity-for-channel-list-indicator-functions
+              'riece-history-format-identity-for-channel-list-indicator)
+  (setq riece-channel-list-mark-face-alist
+       (delq (assq ?+ riece-channel-list-mark-face-alist)
+             riece-channel-list-mark-face-alist)))
+
 (defun riece-history-enable ()
   (setq riece-channel-history
        (make-ring riece-channel-history-length))
-  (setq riece-history-enabled t)
   (riece-emit-signal 'channel-list-changed))
 
 (defun riece-history-disable ()
-  (setq riece-channel-history nil
-       riece-history-enabled nil)
+  (setq riece-channel-history nil)
   (riece-emit-signal 'channel-list-changed))
 
 (provide 'riece-history)
index 9e99799..2f9bab2 100644 (file)
@@ -1,8 +1,8 @@
-;;; riece-icon.el --- iconify buffer strings
-;; Copyright (C) 1'center8-2003 Daiki Ueno
+;;; riece-icon.el --- display icons in IRC buffers
+;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
-;; Created: 1'center8-09-28
+;; Created: 1998-09-28
 ;; Keywords: IRC, riece
 
 ;; This file is part of Riece.
@@ -24,8 +24,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-icon)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
@@ -182,10 +181,8 @@ static char * a_xpm[] = {
 \"  @@@@@@@@@@@ \",
 \"              \"};")
 
-(defvar riece-icon-enabled nil)
-
 (defconst riece-icon-description
-  "Add icon images on IRC buffers")
+  "Display icons in IRC buffers.")
 
 (defun riece-icon-available-p ()
   (if (featurep 'xemacs)
@@ -237,7 +234,7 @@ static char * a_xpm[] = {
                                   'rear-nonsticky (list 'display)))))))
 
 (defun riece-icon-update-user-list-buffer ()
-  (if riece-icon-enabled
+  (if (get 'riece-icon 'riece-addon-enabled)
       (let ((images (riece-icon-make-images riece-user-list-icons)))
        (save-excursion
          (goto-char (point-min))
@@ -247,7 +244,7 @@ static char * a_xpm[] = {
             (1- (point)) (point)))))))
 
 (defun riece-icon-update-channel-list-buffer ()
-  (if riece-icon-enabled
+  (if (get 'riece-icon 'riece-addon-enabled)
       (let ((images (riece-icon-make-images riece-channel-list-icons)))
        (save-excursion
          (goto-char (point-min))
@@ -309,28 +306,72 @@ Modify whole identification by side effect."
       (error
        (defalias 'riece-icon-modeline-buffer-identification 'identity)))))
 
+(defun riece-icon-user-list-mode-hook ()
+  (if (riece-icon-available-p)
+      (add-hook 'riece-update-buffer-functions
+               'riece-icon-update-user-list-buffer t t)))
+
+(defun riece-icon-channel-list-mode-hook ()
+  (if (riece-icon-available-p)
+      (add-hook 'riece-update-buffer-functions
+               'riece-icon-update-channel-list-buffer t t)))
+
 (defun riece-icon-insinuate ()
-  (defalias 'riece-mode-line-buffer-identification
-    #'riece-icon-modeline-buffer-identification)
+  (save-excursion
+    (when riece-user-list-buffer
+      (set-buffer riece-user-list-buffer)
+      (riece-icon-user-list-mode-hook))
+    (when riece-channel-list-buffer
+      (set-buffer riece-channel-list-buffer)
+      (riece-icon-channel-list-mode-hook)))
   (add-hook 'riece-user-list-mode-hook
-           (lambda ()
-             (if (riece-icon-available-p)
-                 (add-hook 'riece-update-buffer-functions
-                           'riece-icon-update-user-list-buffer t t))))
+           'riece-icon-user-list-mode-hook)
   (add-hook 'riece-channel-list-mode-hook
-           (lambda ()
-             (if (riece-icon-available-p)
-                 (add-hook 'riece-update-buffer-functions
-                           'riece-icon-update-channel-list-buffer t t)))))
+           'riece-icon-channel-list-mode-hook))
+
+(defun riece-icon-uninstall ()
+  (save-excursion
+    (when riece-user-list-buffer
+      (set-buffer riece-user-list-buffer)
+      (remove-hook 'riece-update-buffer-functions
+                  'riece-icon-update-user-list-buffer t))
+    (when riece-channel-list-buffer
+      (set-buffer riece-channel-list-buffer)
+      (remove-hook 'riece-update-buffer-functions
+                  'riece-icon-update-channel-list-buffer t)))
+  (remove-hook 'riece-user-list-mode-hook
+              'riece-icon-user-list-mode-hook)
+  (remove-hook 'riece-channel-list-mode-hook
+              'riece-icon-channel-list-mode-hook))
+
+(defvar riece-icon-original-mode-line-buffer-identification nil)
+
+(defun riece-icon-update-mode-line-buffer-identification ()
+  (let ((buffers riece-buffer-list))
+    (save-excursion
+      (while buffers
+       (set-buffer (car buffers))
+       (if (local-variable-p 'riece-mode-line-buffer-identification
+                             (car buffers))
+           (setq mode-line-buffer-identification
+                 (riece-mode-line-buffer-identification
+                  riece-mode-line-buffer-identification)))
+       (setq buffers (cdr buffers))))))
 
 (defun riece-icon-enable ()
-  (setq riece-icon-enabled t)
+  (setq riece-icon-original-mode-line-buffer-identification
+       (symbol-function 'riece-mode-line-buffer-identification))
+  (defalias 'riece-mode-line-buffer-identification
+    'riece-icon-modeline-buffer-identification)
+  (riece-icon-update-mode-line-buffer-identification)
   (if riece-current-channel
       (riece-emit-signal 'user-list-changed riece-current-channel))
   (riece-emit-signal 'channel-list-changed))
 
 (defun riece-icon-disable ()
-  (setq riece-icon-enabled nil)
+  (fset 'riece-mode-line-buffer-identification
+       riece-icon-original-mode-line-buffer-identification)
+  (riece-icon-update-mode-line-buffer-identification)
   (if riece-current-channel
       (riece-emit-signal 'user-list-changed riece-current-channel))
   (riece-emit-signal 'channel-list-changed))
index 09c45bf..adada4c 100644 (file)
@@ -43,11 +43,11 @@ RFC2812, 2.2 \"Character codes\" says:
    equivalence of two nicknames or channel names.")
 
 (defun riece-identity-prefix (identity)
-  "Return the component sans its server from IDENTITY."
+  "Return the component sans its server name from IDENTITY."
   (aref identity 0))
 
 (defun riece-identity-server (identity)
-  "Return the server component in IDENTITY."
+  "Return the server name component in IDENTITY."
   (aref identity 1))
 
 (defun riece-make-identity (prefix server)
@@ -55,7 +55,7 @@ RFC2812, 2.2 \"Character codes\" says:
   (vector prefix server))
 
 (defun riece-identity-equal (ident1 ident2)
-  "Return t, if IDENT1 and IDENT2 is equal."
+  "Return t, if IDENT1 and IDENT2 are equal."
   (and (riece-identity-equal-no-server
        (riece-identity-prefix ident1)
        (riece-identity-prefix ident2))
@@ -76,7 +76,7 @@ RFC2812, 2.2 \"Character codes\" says:
     prefix))
 
 (defun riece-identity-equal-no-server (prefix1 prefix2)
-  "Return t, if IDENT1 and IDENT2 is equal without server part."
+  "Return t, if IDENT1 and IDENT2 are equal without server part."
   (equal (riece-identity-canonicalize-prefix prefix1)
         (riece-identity-canonicalize-prefix prefix2)))
 
index 99ad310..7beea30 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-ignore.el --- ignore user
+;;; riece-ignore.el --- ignore messages from some users
 ;; Copyright (C) 1998-2004 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -24,8 +24,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-ignore)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
@@ -34,7 +33,8 @@
 (require 'riece-message)
 
 (defgroup riece-ignore nil
-  "Ignore messages in IRC buffers."
+  "Ignore messages from some users."
+  :prefix "riece-"
   :group 'riece)
 
 (defcustom riece-ignore-discard-message 'log
@@ -60,10 +60,8 @@ Otherwise, they are not removed from IRC buffers, but are hidden with
 
 (defvar riece-ignore-buffer nil)
 
-(defvar riece-ignore-enabled nil)
-
 (defconst riece-ignore-description
-  "Ignore users")
+  "Ignore messages from some users.")
 (defvar riece-ignored-user-list nil)
 
 (defun riece-ignore-user-rename-signal-function (signal handback)
@@ -103,7 +101,7 @@ Otherwise, they are not removed from IRC buffers, but are hidden with
 (eval-when-compile
   (autoload 'riece-dialogue-mode "riece"))
 (defun riece-ignore-message-filter (message)
-  (if (and riece-ignore-enabled
+  (if (and (get 'riece-ignore 'riece-addon-enabled)
           (riece-identity-member (riece-message-speaker message)
                                  riece-ignored-user-list))
       (if riece-ignore-discard-message
@@ -133,15 +131,17 @@ Otherwise, they are not removed from IRC buffers, but are hidden with
        (mapcar #'riece-parse-identity riece-startup-ignored-user-list))
   (add-hook 'riece-message-filter-functions 'riece-ignore-message-filter))
 
+(defun riece-ignore-uninstall ()
+  (setq riece-ignored-user-list nil)
+  (remove-hook 'riece-message-filter-functions 'riece-ignore-message-filter))
+
 (defun riece-ignore-enable ()
   (define-key riece-command-mode-map
-    "\C-ck" 'riece-ignore-user)
-  (setq riece-ignore-enabled t))
+    "\C-ck" 'riece-ignore-user))
 
 (defun riece-ignore-disable ()
   (define-key riece-command-mode-map
-    "\C-ck" nil)
-  (setq riece-ignore-enabled nil))
+    "\C-ck" nil))
 
 (provide 'riece-ignore)
 
index d9c1ccd..050a6e2 100644 (file)
                           (if (rassq process riece-server-process-alist)
                               (delete-process process)))
                         process))
-  (riece-process-send-string process
-                            (if message
-                                (format "QUIT :%s\r\n" message)
-                              "QUIT\r\n")))
+  (let ((server-name (with-current-buffer (process-buffer process)
+                      riece-server-name)))
+    (if (equal server-name "")
+       (message "Sending QUIT...")
+      (message "Sending QUIT to \"%s\"..." server-name))
+    (riece-process-send-string process
+                              (if message
+                                  (format "QUIT :%s\r\n" message)
+                                "QUIT\r\n"))
+    (if (equal server-name "")
+       (message "Sending QUIT...done")
+      (message "Sending QUIT to \"%s\"...done"))))
 
-(provide 'riece-irc)
\ No newline at end of file
+(provide 'riece-irc)
+
+;;; riece-irc.el ends here
index 62f3e1f..fd018c7 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-kakasi.el --- convert Japanese to roman string by kakasi
+;;; riece-kakasi.el --- convert Japanese to roman string by KAKASI
 ;; Copyright (C) 1998-2004 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-kakasi)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
-(defvar riece-kakasi-enabled nil)
-
-(defvar riece-kakasi-description
-  "Convert Japanese to roman string by kakasi")
+(defconst riece-kakasi-description
+  "Convert Japanese to roman string by KAKASI.")
 
 (defvar riece-kakasi-process nil)
 
@@ -50,7 +47,7 @@
       (delete-region (point-min) (point)))))
 
 (defun riece-kakasi-message-filter (message)
-  (if riece-kakasi-enabled
+  (if (get 'riece-kakasi 'riece-addon-enabled)
       (riece-message-set-text message
                              (riece-kakasi-convert-string
                               (riece-message-text message))))
 (defun riece-kakasi-insinuate ()
   (add-hook 'riece-message-filter-functions 'riece-kakasi-message-filter))
 
+(defun riece-kakasi-uninstall ()
+  (remove-hook 'riece-message-filter-functions 'riece-kakasi-message-filter))
+
 (defun riece-kakasi-enable ()
   (setq riece-kakasi-process
        (start-process "kakasi" (generate-new-buffer " *riece-kakasi*")
                       "kakasi" "-Ha" "-Ka" "-Ja" "-Ea" "-ka"))
   (with-current-buffer (process-buffer riece-kakasi-process)
     (buffer-disable-undo)
-    (erase-buffer))
-  (setq riece-kakasi-enabled t))
+    (erase-buffer)))
 
 (defun riece-kakasi-disable ()
-  (kill-buffer (process-buffer riece-kakasi-process))
-  (setq riece-kakasi-enabled nil))
+  (kill-buffer (process-buffer riece-kakasi-process)))
 
 (provide 'riece-kakasi)
 
index 6526d5c..4e6586c 100644 (file)
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-keepalive)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 (require 'riece-options)
+(require 'riece-server)
 
 (defgroup riece-keepalive nil
   "Keep an IRC connection."
     (setq riece-keepalive-timer nil)))
 
 (defun riece-keepalive-insinuate ()
-  (add-hook 'riece-after-login-hook #'riece-keepalive-after-login-hook)
-  (add-hook 'riece-after-close-hook #'riece-keepalive-after-close-hook))
+  (add-hook 'riece-after-login-hook 'riece-keepalive-after-login-hook)
+  (add-hook 'riece-after-close-hook 'riece-keepalive-after-close-hook))
+
+(defun riece-keepalive-uninstall ()
+  (remove-hook 'riece-after-login-hook 'riece-keepalive-after-login-hook)
+  (remove-hook 'riece-after-close-hook 'riece-keepalive-after-close-hook))
 
 (provide 'riece-keepalive)
 
index 33a479b..53415f6 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-keyword.el --- highlight keywords in channel buffers
+;;; riece-keyword.el --- detect keywords in IRC buffers
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-keyword)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 (require 'riece-message)
 
 (defgroup riece-keyword nil
-  "Highlight keyword in IRC buffer."
+  "Detect keywords in IRC buffers."
+  :prefix "riece-"
   :group 'riece)
 
 (defcustom riece-keywords nil
@@ -66,15 +66,13 @@ and the matched message object."
   :group 'riece-highlight-faces)
 (defvar riece-keyword-face 'riece-keyword-face)
 
-(defvar riece-keyword-enabled nil)
-
 (defconst riece-keyword-description
-  "Highlight keywords in IRC buffers")
+  "Detect keywords in IRC buffers.")
 
 ;;; The old XEmacs package doesn't have autoload setting for regexp-opt.
 (autoload 'regexp-opt "regexp-opt")
 (defun riece-keyword-message-filter (message)
-  (if (and riece-keyword-enabled
+  (if (and (get 'riece-keyword 'riece-addon-enabled)
           riece-keywords
           ;; Ignore messages which belongs to myself.
           (not (riece-message-own-p message)))
@@ -115,11 +113,14 @@ and the matched message object."
 (defun riece-keyword-insinuate ()
   (add-hook 'riece-message-filter-functions 'riece-keyword-message-filter))
 
+(defun riece-keyword-uninstall ()
+  (remove-hook 'riece-message-filter-functions 'riece-keyword-message-filter))
+
 (defun riece-keyword-enable ()
-  (setq riece-keyword-enabled t))
+  )
 
 (defun riece-keyword-disable ()
-  (setq riece-keyword-enabled nil))
+  )
 
 (provide 'riece-keyword)
 
index 05bdabd..584c2c0 100644 (file)
@@ -28,7 +28,7 @@
 (require 'riece-misc)
 
 (defgroup riece-layout nil
-  "Manage window layouts"
+  "Window layouts."
   :prefix "riece-"
   :group 'riece)
 
@@ -154,11 +154,13 @@ This function is used by \"default\" layout."
                (set-window-buffer (selected-window)
                                   riece-command-buffer)
                (select-window rest-window)
-               (set-window-buffer (split-window rest-window)
-                                  riece-others-buffer)
+               (if riece-others-buffer-mode
+                   (set-window-buffer (split-window rest-window)
+                                      riece-others-buffer))
                (set-window-buffer (selected-window)
                                   riece-channel-buffer))
-           (if (eq vpos 'middle)
+           (if (and (eq vpos 'middle)
+                    riece-others-buffer-mode)
                (let ((rest-window (split-window)))
                  (set-window-buffer (selected-window)
                                     riece-channel-buffer)
@@ -167,10 +169,14 @@ This function is used by \"default\" layout."
                  (set-window-buffer rest-window
                                     riece-command-buffer))
              (let ((rest-window (split-window nil (- (window-height) 4))))
-               (set-window-buffer (selected-window)
-                                  riece-others-buffer)
-               (set-window-buffer (split-window)
-                                  riece-channel-buffer)
+               (if riece-others-buffer-mode
+                   (progn
+                     (set-window-buffer (selected-window)
+                                        riece-others-buffer)
+                     (set-window-buffer (split-window)
+                                        riece-channel-buffer))
+                 (set-window-buffer (selected-window)
+                                    riece-channel-buffer))
                (set-window-buffer rest-window
                                   riece-command-buffer)))))
       (if (eq vpos 'bottom)
index a905e73..6c3ae7c 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-log.el --- saving irc logs add-on
+;;; riece-log.el --- Save IRC logs
 ;; Copyright (C) 2003 OHASHI Akira
 ;; Copyright (C) 2004 Daiki Ueno
 
 
 ;;; Commentary:
 
-;; This add-on saves irc logs for every channel.
-
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-log)
+;;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
@@ -36,7 +33,8 @@
 (require 'riece-button)
 
 (defgroup riece-log nil
-  "Save irc log"
+  "Save IRC logs."
+  :prefix "riece-"
   :group 'riece)
 
 (defcustom riece-log-directory
@@ -71,11 +69,6 @@ If integer, flash back only this line numbers. t means all lines."
   :type 'symbol
   :group 'riece-log)
 
-(defcustom riece-log-open-directory-function 'find-file
-  "*Function for opening a directory."
-  :type 'function
-  :group 'riece-log)
-
 (defface riece-log-date-face
   '((((class color)
       (background dark))
@@ -93,17 +86,23 @@ If integer, flash back only this line numbers. t means all lines."
   "Lock file for riece-log.
 It is created if there is at least one instance of Emacs running riece-log.")
 
-(defvar riece-log-enabled nil)
+(defconst riece-log-file-name-regexp
+  (concat (riece-make-interval-regexp "[0-9]" 8) "\\.txt\\(\\.\\(.*\\)\\)?$"))
 
 (defconst riece-log-description
-  "Saving IRC logs")
+  "Save IRC logs.")
 
 (defun riece-log-display-message-function (message)
-  (if riece-log-enabled
-      (let ((file (riece-log-get-file (riece-message-target message)))
-           (coding-system-for-write riece-log-coding-system)
-           file-name-coding-system
-           default-file-name-coding-system)
+  (if (get 'riece-log 'riece-addon-enabled)
+      (let* ((coding-system-for-write
+             (if (featurep 'mule)
+                 (or riece-log-coding-system
+                     (car (get-language-info current-language-environment
+                                             'coding-system)))))
+            (file (riece-log-make-file-name (riece-message-target message)
+                                            coding-system-for-write))
+            file-name-coding-system
+            default-file-name-coding-system)
        (unless (file-directory-p (file-name-directory file))
          (make-directory (file-name-directory file) t))
        (write-region (concat (format-time-string "%H:%M") " "
@@ -111,22 +110,32 @@ It is created if there is at least one instance of Emacs running riece-log.")
                      nil file t 0
                      riece-log-lock-file))))
 
-(defun riece-log-get-file (identity)
-  (expand-file-name
-   (concat (format-time-string "%Y%m%d") ".txt")
-   (riece-log-get-directory identity)))
-
-(defun riece-log-get-files (identity)
-  (let ((directory (riece-log-get-directory identity)))
-    (if (file-directory-p directory)
-       (nreverse (sort (directory-files directory t
-                        (concat "^"
-                                (riece-make-interval-regexp "[0-9]" 8)
-                                "\\.txt$")
-                        t)
-                 #'string-lessp)))))
-
-(defun riece-log-get-directory (identity)
+(defun riece-log-make-file-name (identity coding-system)
+  (expand-file-name (if (featurep 'mule)
+                       (format "%s.txt.%s"
+                               (format-time-string "%Y%m%d")
+                               coding-system)
+                     (format "%s.txt"
+                               (format-time-string "%Y%m%d")))
+                   (riece-log-directory identity)))
+
+(defun riece-log-list-files (identity time)
+  (let ((directory (riece-log-directory identity))
+       (time-prefix (format-time-string "%Y%m%d" (or time '(0 0))))
+       files)
+    (when (file-directory-p directory)
+      (setq files (nreverse (sort (directory-files
+                                  directory t
+                                  (concat "^" riece-log-file-name-regexp)
+                                  t)
+                                 #'string-lessp)))
+      (while (and files
+                 (string-lessp (file-name-nondirectory (car files))
+                               time-prefix))
+       (setq files (cdr files)))
+      files)))
+
+(defun riece-log-directory (identity)
   (let ((prefix (riece-identity-canonicalize-prefix
                 (riece-identity-prefix identity)))
        (server (riece-identity-server identity))
@@ -175,42 +184,54 @@ It is created if there is at least one instance of Emacs running riece-log.")
 (defun riece-log-insert (identity lines)
   "Insert logs for IDENTITY at most LINES.
 If LINES is t, insert today's logs entirely."
-  (if (eq lines t)
-      (let* (file-name-coding-system
-            default-file-name-coding-system
-            (file (riece-log-get-file identity)))
-       (if (file-exists-p file)
-           (insert-file-contents file)))
-    (let* (file-name-coding-system
-          default-file-name-coding-system
-          (files (riece-log-get-files identity))
-          (lines (- lines))
-          name date point)
-      (while (and (< lines 0) files)
-       (if (and (file-exists-p (car files))
-                (string-match (concat (riece-make-interval-regexp "[0-9]" 8)
-                                      "\\.txt$")
-                              (setq name (file-name-nondirectory
-                                          (car files)))))
-           (save-restriction
-             (narrow-to-region (point) (point))
-             (insert-file-contents (car files))
-             (goto-char (point-max))
-             (setq lines (forward-line lines))
-             (delete-region (point-min) (point))
-             (unless (equal name (format-time-string "%Y%m%d.txt"))
-               (setq date (concat " (" (substring name 0 4) "/"
-                                  (substring name 4 6) "/"
-                                  (substring name 6 8) ")"))
-               (while (not (eobp))
-                 (end-of-line)
-                 (setq point (point))
-                 (insert date)
-                 (put-text-property point (point)
-                                    'riece-overlay-face 'riece-log-date-face)
-                 (forward-line))
-               (goto-char (point-min)))))
-       (setq files (cdr files))))))
+  (let* (file-name-coding-system
+        default-file-name-coding-system
+        (files (riece-log-list-files identity
+                                     (if (eq lines t) (current-time))))
+        name coding-system date point)
+    (while (and (or (eq lines t) (> lines 0)) files)
+      (save-restriction
+       (narrow-to-region (point) (point))
+       (if (and (string-match
+                 (concat "^" riece-log-file-name-regexp)
+                 (setq name (file-name-nondirectory (car files))))
+                (match-beginning 2))
+           (progn
+             (setq coding-system
+                   (intern (substring name (match-beginning 2))))
+             (if (featurep 'xemacs)
+                 (setq coding-system (find-coding-system coding-system))
+               (unless (coding-system-p coding-system)
+                 (setq coding-system nil)))
+             (if coding-system
+                 (let ((coding-system-for-read coding-system))
+                   (insert-file-contents (car files)))
+               ;;don't insert file contents if they use non
+               ;;supported coding-system.
+               ))
+         ;;if the filename has no coding-system suffix, decode with
+         ;;riece-log-coding-system.
+         (let ((coding-system-for-read riece-log-coding-system))
+           (insert-file-contents (car files))))
+       ;;lines in the file contents are in reversed order.
+       (unless (eq lines t)
+         (goto-char (point-max))
+         (setq lines (- (forward-line (- lines))))
+         (delete-region (point-min) (point)))
+       ;;add (YYYY/MM/dd) suffix on each line left in the current buffer.
+       (unless (equal (substring name 0 8) (format-time-string "%Y%m%d"))
+         (setq date (concat " (" (substring name 0 4) "/"
+                            (substring name 4 6) "/"
+                            (substring name 6 8) ")"))
+         (while (not (eobp))
+           (end-of-line)
+           (setq point (point))
+           (insert date)
+           (put-text-property point (point)
+                              'riece-overlay-face 'riece-log-date-face)
+           (forward-line))
+         (goto-char (point-min))))
+      (setq files (cdr files)))))
 
 (defun riece-log-flashback (identity)
   (when riece-log-flashback
@@ -240,12 +261,11 @@ If LINES is t, insert today's logs entirely."
       (set-window-point (get-buffer-window (current-buffer))
                        (point)))))
 
-(defun riece-log-open-directory (&optional channel)
+(defun riece-log-dired (&optional channel)
   (interactive)
-  (let ((directory (riece-log-get-directory
-                   (or channel riece-current-channel))))
+  (let ((directory (riece-log-directory (or channel riece-current-channel))))
     (if (file-directory-p directory)
-       (funcall riece-log-open-directory-function directory)
+       (dired directory)
       (error "No log directory"))))
 
 (defun riece-log-requires ()
@@ -267,14 +287,19 @@ If LINES is t, insert today's logs entirely."
   (add-hook 'riece-channel-buffer-create-functions
            'riece-log-flashback))
 
+(defun riece-log-uninstall ()
+  (setq riece-log-lock-file nil)
+  (remove-hook 'riece-after-display-message-functions
+              'riece-log-display-message-function)
+  (remove-hook 'riece-channel-buffer-create-functions
+              'riece-log-flashback))
+
 (defvar riece-command-mode-map)
 (defun riece-log-enable ()
-  (define-key riece-command-mode-map "\C-cd" 'riece-log-open-directory)
-  (setq riece-log-enabled t))
+  (define-key riece-command-mode-map "\C-cd" 'riece-log-dired))
 
 (defun riece-log-disable ()
-  (define-key riece-command-mode-map "\C-cd" nil)
-  (setq riece-log-enabled nil))
+  (define-key riece-command-mode-map "\C-cd" nil))
 
 (provide 'riece-log)
 
index bec5701..cd620a8 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-lsdb.el --- interface to LSDB
+;;; riece-lsdb.el --- help register nicknames in LSDB rolodex program
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -24,8 +24,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-lsdb)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 
 (defvar riece-lsdb-cache nil)
 
-(defvar riece-lsdb-enabled nil)
-
 (defconst riece-lsdb-description
-  "Use LSDB (Lovely Sister Database)")
+  "Help register nicknames in LSDB rolodex program.")
 
 (defun riece-lsdb-update-cache (record)
   (let ((irc (cdr (assq 'irc record))))
                          (list (cons 'irc (cons irc old)))))))
 
 (defvar riece-command-mode-map)
+(defvar lsdb-secondary-hash-tables)
+(defvar lsdb-after-update-record-functions)
+(defvar lsdb-after-delete-record-functions)
 (defun riece-lsdb-insinuate ()
   (require 'lsdb)
   (add-to-list 'lsdb-secondary-hash-tables
   (add-to-list 'lsdb-after-delete-record-functions
               'riece-lsdb-delete-cache))
 
+(defun riece-lsdb-uninstall ()
+  (setq lsdb-secondary-hash-tables
+       (delq 'riece-lsdb-cache lsdb-secondary-hash-tables)
+       lsdb-after-update-record-functions
+       (delq 'riece-lsdb-update-cache lsdb-after-update-record-functions)
+       lsdb-after-delete-record-functions
+       (delq 'riece-lsdb-delete-cache lsdb-after-delete-record-functions)))
+
 (defun riece-lsdb-enable ()
   (define-key riece-command-mode-map
     "\C-c\C-ll" 'riece-lsdb-display-records)
   (define-key riece-command-mode-map
-    "\C-c\C-la" 'riece-lsdb-add-user)
-  (setq riece-lsdb-enabled t))
+    "\C-c\C-la" 'riece-lsdb-add-user))
 
 (defun riece-lsdb-disable ()
   (define-key riece-command-mode-map
     "\C-c\C-ll" nil)
   (define-key riece-command-mode-map
-    "\C-c\C-la" nil)
-  (setq riece-lsdb-enabled nil))
+    "\C-c\C-la" nil))
 
 (provide 'riece-lsdb)
 
index d11641e..4023b7d 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-menu.el --- define command menu on menubar
+;;; riece-menu.el --- setup Riece's command menus
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -24,8 +24,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-menu)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
@@ -70,7 +69,7 @@
   "Menu used in command mode.")
 
 (defconst riece-menu-description
-  "Setup command menus on menubar")
+  "Setup Riece's command menus.")
 
 (defun riece-menu-create-layouts-menu (menu)
   (mapcar (lambda (entry)
 
 (defvar riece-command-mode-map)
 (defvar riece-menu)
+
+(defun riece-menu-command-mode-hook ()
+  (easy-menu-define riece-menu
+                   riece-command-mode-map
+                   "Riece Menu"
+                   riece-menu-items)
+  (easy-menu-add riece-menu))
+
 (defun riece-menu-insinuate ()
+  (if riece-command-buffer
+      (with-current-buffer riece-command-buffer
+       (riece-menu-command-mode-hook)))
   (add-hook 'riece-command-mode-hook
-           (lambda ()
-             (easy-menu-define riece-menu
-                               riece-command-mode-map
-                               "Riece Menu"
-                               riece-menu-items)
-             (easy-menu-add riece-menu))))
+           'riece-menu-command-mode-hook))
+
+(defun riece-menu-uninstall ()
+  (if riece-command-buffer
+      (with-current-buffer riece-command-buffer
+       (easy-menu-remove riece-menu)))
+  (remove-hook 'riece-command-mode-hook
+              'riece-menu-command-mode-hook))
 
 (provide 'riece-menu)
 
index c943e50..81d430c 100644 (file)
@@ -30,7 +30,7 @@
 (require 'riece-misc)
 
 (defgroup riece-message nil
-  "Messages"
+  "Display messages."
   :tag "Message"
   :prefix "riece-"
   :group 'riece)
index 2c88006..99d4f33 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-mini.el --- "riece on minibuffer" add-on
+;;; riece-mini.el --- use Riece only on the minibuffer
 ;; Copyright (C) 2003 OHASHI Akira
 
 ;; Author: OHASHI Akira <bg66@koka-in.org>
@@ -23,6 +23,8 @@
 
 ;;; Commentary:
 
+;; NOTE: This is an add-on module for Riece.
+
 ;; This add-on shows arrival messages to minibuffer. And you can send
 ;; message using minibuffer.
 ;;
@@ -44,7 +46,7 @@
 (require 'riece-biff)
 
 (defgroup riece-mini nil
-  "riece on minibuffer"
+  "Use Riece only on the minibuffer."
   :group 'riece)
 
 (defcustom riece-mini-backlog-size 5
 (defvar riece-mini-backlog-history nil)
 (defvar riece-mini-backlog-shown nil)
 
-(defvar riece-mini-enabled nil)
-
 (defconst riece-mini-description
-  "Send arrival messages to minibuffer")
+  "Use Riece only on the minibuffer.")
 
-(defmacro riece-mini-message-no-log (string &rest args)
+(defun riece-mini-message-no-log (string &rest args)
   "Like `message', except that message logging is disabled."
   (if (featurep 'xemacs)
       (if args
-         `(display-message 'no-log (format ,string ,@args))
-       `(display-message 'no-log ,string))
-    `(let (message-log-max)
-       (message ,string ,@args))))
+         (display-message 'no-log (apply #'format string args))
+       (display-message 'no-log string))
+    (let (message-log-max)
+      (apply #'message string args))))
 
 (defun riece-mini-display-message-function (message)
   "Show arrival messages to minibuffer."
@@ -82,7 +82,7 @@
            (cdr riece-mini-backlog-history)))
     (setq riece-mini-backlog-history
          (reverse (cons string (reverse riece-mini-backlog-history))))
-    (when (and riece-mini-enabled
+    (when (and (get 'riece-mini 'riece-addon-enabled)
               (not (or (eq (window-buffer (selected-window))
                            (get-buffer riece-command-buffer))
                        (riece-message-own-p message)
@@ -128,7 +128,7 @@ If twice (C-u C-u), then ask the channel."
            (resize-mini-windows t))
        (setq riece-mini-backlog-shown t)
        (when (and (memq 'riece-biff riece-addons)
-                  riece-biff-enabled)
+                  (get 'riece-biff 'riece-addon-enabled))
          (riece-biff-clear))
        (riece-mini-message-no-log
         "%s" (mapconcat #'identity riece-mini-backlog-history "\n"))))))
@@ -141,18 +141,23 @@ If twice (C-u C-u), then ask the channel."
 
 (defun riece-mini-requires ()
   (if (memq 'riece-biff riece-addons)
- '(riece-biff)))
+      '(riece-biff)))
 
 (defun riece-mini-insinuate ()
   (add-hook 'riece-after-display-message-functions
            'riece-mini-display-message-function)
   (add-hook 'pre-command-hook 'riece-mini-pre-command))
 
+(defun riece-mini-uninstall ()
+  (remove-hook 'riece-after-display-message-functions
+              'riece-mini-display-message-function)
+  (remove-hook 'pre-command-hook 'riece-mini-pre-command))
+
 (defun riece-mini-enable ()
-  (setq riece-mini-enabled t))
+  )
 
 (defun riece-mini-disable ()
-  (setq riece-mini-enabled nil))
+  )
 
 (provide 'riece-mini)
 
index 3dd90d6..cd553ae 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-ndcc.el --- elisp native DCC add-on
+;;; riece-ndcc.el --- DCC file sending protocol support (written in elisp)
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
+
 ;;; Code:
 
 (require 'riece-globals)
@@ -29,7 +33,7 @@
 (require 'calc)
 
 (defgroup riece-ndcc nil
-  "Elisp native DCC implementation"
+  "DCC written in elisp."
   :prefix "riece-"
   :group 'riece)
 
@@ -44,10 +48,8 @@ Only used for sending files."
 (defvar riece-ndcc-request-user nil)
 (defvar riece-ndcc-request-size nil)
 
-(defvar riece-ndcc-enabled nil)
-
 (defconst riece-ndcc-description
-  "DCC file sending extension implemented with `make-network-process'")
+  "DCC file sending protocol support (written in elisp.)")
 
 (defun riece-ndcc-encode-address (address)
   (unless (string-match
@@ -192,7 +194,7 @@ Only used for sending files."
 
 (defun riece-handle-dcc-request (prefix target message)
   (let ((case-fold-search t))
-    (when (and riece-ndcc-enabled
+    (when (and (get 'riece-ndcc 'riece-addon-enabled)
               (string-match
                "SEND \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)"
                message))
@@ -228,8 +230,13 @@ Only used for sending files."
 
 (defvar riece-dialogue-mode-map)
 (defun riece-ndcc-insinuate ()
+  (unless (fboundp 'make-network-process)
+    (error "This Emacs does not have make-network-process"))
   (add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request))
 
+(defun riece-ndcc-uninstall ()
+  (remove-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request))
+
 (defun riece-ndcc-enable ()
   (define-key riece-dialogue-mode-map "\C-ds" 'riece-command-dcc-send)
   (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive))
index 51735ff..8330ff5 100644 (file)
 
 ;; User modifiable variables.
 (defgroup riece nil
-  "Riece specific customize group")
+  "Riece specific customize group.")
 
 (defgroup riece-options nil
-  "Riece user customizable variables"
+  "Riece user customizable variables."
   :prefix "riece-"
   :group 'riece)
 
 (defcustom riece-saved-forms
   '(riece-server-alist
     riece-channel-buffer-mode
+    riece-others-buffer-mode
     riece-user-list-buffer-mode
-    riece-layout)
+    riece-channel-list-buffer-mode
+    riece-layout
+    riece-addons)
   "Variables saved after each session is completed."
   :type 'string
   :group 'riece-options)
@@ -56,7 +59,7 @@
   :group 'riece-options)
 
 (defgroup riece-looks nil
-  "Related to look and feel"
+  "Look and feel."
   :prefix "riece-"
   :group 'riece)
 
@@ -74,7 +77,7 @@ See the document of the function `recenter'."
   :group 'riece-looks)
 
 (defcustom riece-directory (expand-file-name "~/.riece")
-  "Where to look for data files."
+  "Where to look for startup files."
   :type 'directory
   :group 'riece-options)
 
@@ -84,6 +87,14 @@ See the document of the function `recenter'."
   :type 'directory
   :group 'riece-options)
 
+(defcustom riece-data-directory
+  (if (fboundp 'locate-data-directory)
+      (locate-data-directory "riece")
+    (file-name-directory load-file-name))
+  "Where to look for data files."
+  :type 'directory
+  :group 'riece-options)
+
 (defcustom riece-variables-file
   (expand-file-name "init" riece-directory)
   "Where to look for variables."
@@ -125,12 +136,12 @@ way is to put Riece variables on .emacs or file loaded from there."
   :group 'riece-options)
 
 (defgroup riece-server nil
-  "Server settings"
+  "Server settings."
   :prefix "riece-"
   :group 'riece)
 
 (defgroup riece-channel nil
-  "Channel settings"
+  "Channel settings."
   :prefix "riece-"
   :group 'riece)
 
@@ -226,7 +237,7 @@ way is to put Riece variables on .emacs or file loaded from there."
   :type 'boolean
   :group 'riece-server)
 
-(defcustom riece-quit-timeout 10
+(defcustom riece-quit-timeout 1
   "Quit timeout when there is no response from server."
   :type '(radio (integer :tag "Seconds")
                (const nil))
@@ -242,6 +253,11 @@ way is to put Riece variables on .emacs or file loaded from there."
   :type 'boolean
   :group 'riece-looks)
 
+(defcustom riece-others-buffer-mode t
+  "When non-nil, Riece will display an \"*Others*\" buffer."
+  :type 'boolean
+  :group 'riece-looks)
+
 (defcustom riece-user-list-buffer-mode t
   "When non-nil, Riece will display a nick list buffer."
   :type 'boolean
@@ -294,22 +310,6 @@ way is to put Riece variables on .emacs or file loaded from there."
   :type 'function
   :group 'riece-options)
 
-(defcustom riece-shrink-buffer-idle-time-delay 5
-  "Number of idle seconds to wait before shrinking channel buffers."
-  :type 'integer
-  :group 'riece-options)
-
-(defcustom riece-max-buffer-size nil
-  "Maximum size of channel buffers."
-  :type '(radio (integer :tag "Number of characters")
-               (const nil))
-  :group 'riece-options)
-
-(defcustom riece-shrink-buffer-remove-chars (/ riece-max-send-size 2)
-  "Number of chars removed when shrinking channel buffers."
-  :type 'integer
-  :group 'riece-options)
-
 (defcustom riece-format-time-function #'current-time-string
   "Function to convert the specified time to the human readable form."
   :type 'function
index 4a34937..7af34af 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-rdcc.el --- ruby implementation of DCC add-on
+;;; riece-rdcc.el --- DCC file sending protocol support (written in Ruby)
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
+
 ;;; Code:
 
 (require 'riece-globals)
 (require 'riece-channel)
 (require 'riece-identity)
 (require 'riece-ctcp)                  ;for riece-ctcp-additional-clientinfo
+(require 'riece-ruby)
 
 (defgroup riece-rdcc nil
-  "DCC implementation using ruby"
+  "DCC written in Ruby."
   :prefix "riece-"
   :group 'riece)
 
@@ -40,13 +45,9 @@ Only used for sending files."
   :type 'string
   :group 'riece-rdcc)
 
-(defcustom riece-rdcc-ruby-command "ruby"
-  "Command name for Ruby interpreter."
-  :type 'string
-  :group 'riece-rdcc)
-
 (defcustom riece-rdcc-send-program
   '("\
+require 'socket'
 address = " address "
 unless address
   sock = UDPSocket.new
@@ -54,15 +55,14 @@ unless address
   address = sock.getsockname[4 .. 7].unpack('CCCC').join('.')
 end
 server = TCPServer.new(address, 0)
-puts(\"#{server.addr[3].split(/\\./).collect{|c| c.to_i}.pack('CCCC').unpack('N')[0]} #{server.addr[1]}\")
-$stdout.flush
+output(\"#{server.addr[3].split(/\\./).collect{|c| c.to_i}.pack('CCCC').unpack('N')[0]} #{server.addr[1]}\")
 session = server.accept
 if session
   total = 0
   File.open(" file ") {|file|
     while (bytes = file.read(" block-size "))
       total += bytes.length
-      puts(total)
+      output(total)
       session.write(bytes)
       begin
         buf = session.read(4)
@@ -77,9 +77,8 @@ end
   :group 'riece-rdcc)
 
 (defcustom riece-rdcc-decode-address-program
-  '("\
-puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
-    address " >> 8 & 0xFF}.#{" address " & 0xFF}\")")
+  '("\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
+    address " >> 8 & 0xFF}.#{" address " & 0xFF}\"")
   "Ruby program to numeric IP address."
   :type 'list
   :group 'riece-rdcc)
@@ -103,42 +102,36 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
 (defvar riece-rdcc-temp-file nil)
 (defvar riece-rdcc-received-size nil)
 
-(defvar riece-rdcc-enabled nil)
-
 (defconst riece-rdcc-description
-  "DCC file sending extension implemented in Ruby")
+  "DCC file sending protocol support (written in Ruby.)")
 
 (defvar temporary-file-directory)
 (defvar jka-compr-compression-info-list)
 (defvar jam-zcat-filename-list)
-(defun riece-rdcc-substitute-variables (program variable value)
-  (setq program (copy-sequence program))
-  (let ((pointer program))
-    (while pointer
-      (setq pointer (memq variable program))
-      (if pointer
-         (setcar pointer value)))
-    program))
-
-(defun riece-rdcc-server-filter (process input)
-  (save-excursion
-    (set-buffer (process-buffer process))
-    (goto-char (point-max))
-    (insert input)
-    (goto-char (point-min))
-    (while (and (not (eobp))
-               (looking-at "\\([0-9]+\\)\n"))
-      (message "Sending %s...(%s/%d)"
-              riece-rdcc-request-file
-              (match-string 1) riece-rdcc-request-size)
-      (forward-line))
-    (unless (eobp)
-      (delete-region (point-min) (point)))))
-
-(defun riece-rdcc-server-sentinel (process status)
-  (with-current-buffer (process-buffer process)
-    (message "Sending %s...done" riece-rdcc-request-file))
-  (kill-buffer (process-buffer process)))
+
+(defun riece-rdcc-output-handler (name output time)
+  (if (string-match "\\([0-9]+\\) \\([0-9]+\\)" output)
+      (let ((address (match-string 1 output))
+           (port (match-string 2 output)))
+       (riece-send-string
+        (format "PRIVMSG %s :\1DCC SEND %s %s %s %d\1\r\n"
+                (riece-identity-prefix
+                 (riece-ruby-property name 'riece-rdcc-request-user))
+                (file-name-nondirectory
+                 (riece-ruby-property name 'riece-rdcc-request-file))
+                address port
+                (riece-ruby-property name 'riece-rdcc-request-size)))))
+  (riece-ruby-set-output-handler name #'riece-rdcc-output-handler-2))
+
+(defun riece-rdcc-output-handler-2 (name output time)
+  (message "Sending %s...(%s/%d)"
+          (riece-ruby-property name 'riece-rdcc-request-file)
+          (string-to-number output)
+          (riece-ruby-property name 'riece-rdcc-request-size)))
+
+(defun riece-rdcc-exit-handler (name)
+  (message "Sending %s...done"
+          (riece-ruby-property name 'riece-rdcc-request-file)))
 
 (defun riece-command-dcc-send (user file)
   (interactive
@@ -147,51 +140,25 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
            "User: "
            (riece-get-users-on-server (riece-current-server-name)))
           (expand-file-name (read-file-name "File: ")))))
-  (let* ((process-connection-type nil)
-        (process (start-process "DCC" (generate-new-buffer " *DCC*")
-                                "ruby" "-rsocket")))
-    (process-send-string process
-                        (apply #'concat
-                               (riece-rdcc-substitute-variables
-                                (riece-rdcc-substitute-variables
-                                 (riece-rdcc-substitute-variables
-                                  riece-rdcc-send-program
-                                  'address
-                                  (if riece-rdcc-server-address
-                                      (concat "'" riece-rdcc-server-address
-                                              "'")
-                                    "nil"))
-                                 'file
-                                 (concat "'" file "'"))
-                                'block-size
-                                (number-to-string riece-rdcc-block-size))))
-    (process-send-eof process)
-    (save-excursion
-      (set-buffer (process-buffer process))
-      (while (and (eq (process-status process) 'run)
-                 (progn
-                   (goto-char (point-min))
-                   (not (looking-at "\\([0-9]+\\) \\([0-9]+\\)"))))
-       (accept-process-output process))
-      (if (eq (process-status process) 'run)
-         (let ((address (match-string 1))
-               (port (match-string 2))
-               (filename (file-name-nondirectory file)))
-           (while (string-match "[ \t]+" filename)
-             (setq filename (replace-match "_" nil nil filename)))
-           (erase-buffer)
-           (make-local-variable 'riece-rdcc-request-size)
-           (setq riece-rdcc-request-file file
-                 riece-rdcc-request-size (nth 7 (file-attributes file)))
-           (set-buffer-modified-p nil)
-           (set-process-filter process #'riece-rdcc-server-filter)
-           (set-process-sentinel process #'riece-rdcc-server-sentinel)
-           (riece-send-string
-            (format "PRIVMSG %s :\1DCC SEND %s %s %s %d\1\r\n"
-                    (riece-identity-prefix user)
-                    filename
-                    address port
-                    riece-rdcc-request-size)))))))
+  (let ((name (riece-ruby-execute
+              (riece-ruby-substitute-variables
+               riece-rdcc-send-program
+               (list (cons 'address
+                           (if riece-rdcc-server-address
+                               (concat "'" riece-rdcc-server-address
+                                       "'")
+                             "nil"))
+                     (cons 'file
+                           (concat "'" file "'"))
+                     (cons 'block-size
+                           (number-to-string
+                            riece-rdcc-block-size)))))))
+    (riece-ruby-set-property name 'riece-rdcc-request-user user)
+    (riece-ruby-set-property name 'riece-rdcc-request-file file)
+    (riece-ruby-set-property name 'riece-rdcc-request-size
+                            (nth 7 (file-attributes file)))
+    (riece-ruby-set-output-handler name #'riece-rdcc-output-handler)
+    (riece-ruby-set-exit-handler name #'riece-rdcc-exit-handler)))
 
 (defun riece-rdcc-filter (process input)
   (save-excursion
@@ -235,14 +202,15 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
   (kill-buffer (process-buffer process)))
 
 (defun riece-rdcc-decode-address (address)
-  (with-temp-buffer
-    (call-process riece-rdcc-ruby-command nil t nil "-e"
-                 (apply #'concat
-                        (riece-rdcc-substitute-variables
-                         riece-rdcc-decode-address-program
-                         'address
-                         address)))
-    (buffer-substring (point-min) (1- (point-max)))))
+  (let ((name (riece-ruby-execute
+              (riece-ruby-substitute-variables
+               riece-rdcc-decode-address-program
+               (list (cons 'address address)))))
+       response)
+    (while (equal (nth 2 (setq response (riece-ruby-inspect name))) "running")
+      (accept-process-output riece-ruby-process))
+    (riece-ruby-clear name)
+    (nth 1 response)))
 
 (defun riece-command-dcc-receive (request file)
   (interactive
@@ -335,7 +303,7 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
 
 (defun riece-handle-dcc-request (prefix target message)
   (let ((case-fold-search t))
-    (when (and riece-rdcc-enabled
+    (when (and (get 'riece-rdcc 'riece-addon-enabled)
               (string-match
                "SEND \\(\\([^ ]+\\)\\|\"\\(.+\\)\"\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)"
                message))
@@ -385,15 +353,18 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{"
   (add-to-list 'riece-ctcp-additional-clientinfo "DCC")
   (add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request))
 
+(defun riece-rdcc-uninstall ()
+  (setq riece-ctcp-additional-clientinfo
+       (delete "DCC" riece-ctcp-additional-clientinfo))
+  (remove-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request))
+
 (defun riece-rdcc-enable ()
   (define-key riece-dialogue-mode-map "\C-ds" 'riece-command-dcc-send)
-  (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive)
-  (setq riece-rdcc-enabled t))
+  (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive))
 
 (defun riece-rdcc-disable ()
   (define-key riece-dialogue-mode-map "\C-ds" nil)
-  (define-key riece-dialogue-mode-map "\C-dr" nil)
-  (setq riece-rdcc-enabled nil))
+  (define-key riece-dialogue-mode-map "\C-dr" nil))
 
 (provide 'riece-rdcc)
 
index a0006e4..97f4e5b 100644 (file)
@@ -1,9 +1,9 @@
-;;; riece-ruby.el --- interact with ruby interpreter
+;;; riece-ruby.el --- interact with Ruby interpreter
 ;; Copyright (C) 1998-2005 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1998-09-28
-;; Keywords: IRC, riece
+;; Keywords: IRC, riece, Ruby
 
 ;; This file is part of Riece.
 
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;; riece-ruby.el is a library to interact with Ruby interpreter.
+;; It supports concurrent execution of Ruby programs in a single
+;; session.  For example:
+;; 
+;; (riece-ruby-execute "sleep 30"); returns immediately
+;; => "rubyserv0"
+;;
+;; (riece-ruby-execute "1 + 1")
+;; => "rubyserv1"
+;;
+;; (riece-ruby-execute "\"")
+;; => "rubyserv2"
+;;
+;; (riece-ruby-inspect "rubyserv0")
+;; => ((OK nil) nil (("running")))
+;;
+;; (riece-ruby-inspect "rubyserv1")
+;; => ((OK nil) "2" (("finished")))
+;;
+;; (riece-ruby-inspect "rubyserv2")
+;; => ((OK nil) "(eval):1: unterminated string meets end of file" (("exited")))
+
 ;;; Code:
 
-(defvar riece-ruby-command "ruby"
-  "Command name for Ruby interpreter.")
+(require 'riece-debug)
 
-(defun riece-ruby-substitute-variables (program variable value)
-  (setq program (copy-sequence program))
-  (let ((pointer program))
-    (while pointer
-      (setq pointer (memq variable program))
-      (if pointer
-         (setcar pointer value)))
-    program))
+(defgroup riece-ruby nil
+  "Interact with Ruby interpreter."
+  :prefix "riece-"
+  :group 'riece)
+
+(defcustom riece-ruby-command "ruby"
+  "Command name for Ruby interpreter."
+  :type 'string
+  :group 'riece-ruby)
+
+(defcustom riece-ruby-out-file (expand-file-name "riece-ruby.out"
+                                                riece-directory)
+  "A file which records stdout of Ruby programs."
+  :type 'string
+  :group 'riece-ruby)
+
+(defcustom riece-ruby-err-file (expand-file-name "riece-ruby.err"
+                                                riece-directory)
+  "A file which records stderr of Ruby programs."
+  :type 'string
+  :group 'riece-ruby)
+
+(defcustom riece-ruby-log-file (expand-file-name "riece-ruby.log"
+                                                riece-directory)
+  "A file used to logging."
+  :type 'string
+  :group 'riece-ruby)
+
+(defvar riece-ruby-server-program "server.rb"
+  "The server program file.  If the filename is not absolute, it is
+assumed that the file is in the same directory of this file.")
+
+(defvar riece-ruby-server-program-arguments (list "-o" riece-ruby-out-file
+                                                 "-e" riece-ruby-err-file
+                                                 "-l" riece-ruby-log-file)
+  "Command line arguments passed to `riece-ruby-server-program'.")
+
+(defvar riece-ruby-process nil
+  "Process object of Ruby interpreter.")
+
+(defvar riece-ruby-lock nil
+  "Lock for waiting server response.
+Local to the process buffer.")
+(defvar riece-ruby-response nil
+  "The server response.
+Local to the process buffer.")
+(defvar riece-ruby-data nil
+  "Data from server.
+Local to the process buffer.")
+(defvar riece-ruby-escaped-data nil
+  "Escaped data from server.  This variable is cleared every time
+server response arrives.
+Local to the process buffer.")
+(defvar riece-ruby-status-alist nil
+  "Status from server.
+Local to the process buffer.")
+
+(defvar riece-ruby-output-queue-alist nil
+  "An alist mapping from program name to output data.")
+(defvar riece-ruby-output-handler-alist nil
+  "An alist mapping from program name to output handler.
+Output handlers are called every time \"# output\" line arrives.
+Use `riece-ruby-set-output-handler' to set this variable.")
+(defvar riece-ruby-exit-handler-alist nil
+  "An alist mapping from program name to exit handler.
+Exit handlers are called once when \"# exit\" line arrives.
+Use `riece-ruby-set-exit-handler' to set this variable.")
+(defvar riece-ruby-property-alist nil
+  "An alist mapping from program name to the property list.
+Use `riece-ruby-set-property' to set this variable.")
 
 (defun riece-ruby-escape-data (data)
   (let ((index 0))
            index (- (match-end 0) 2)))
     data))
 
-(defun riece-ruby-start ()                     
-  (start-process "riece-ruby"
-                (generate-new-buffer " *Ruby*")
-                riece-ruby-command
-                (expand-file-name "rubyserv.rb"
-                                  (file-name-directory
-                                   (symbol-file 'riece-ruby-start)))))
-
-(defun riece-ruby-execute (process program &optional callback)
-  (set-process-filter process #'riece-ruby-filter)
-  (set-process-sentinel process #'riece-ruby-sentinel)
-  (with-current-buffer (process-buffer process)
-    (make-local-variable 'riece-ruby-callback)
-    (setq riece-ruby-callback callback)
+(defun riece-ruby-reset-process-buffer ()
+  (save-excursion
+    (set-buffer (process-buffer riece-ruby-process))
+    (buffer-disable-undo)
+    (make-local-variable 'riece-ruby-response)
+    (setq riece-ruby-response nil)
     (make-local-variable 'riece-ruby-data)
-    (setq riece-ruby-data nil))
-  (process-send-string process
-                      (concat "EVAL " (riece-ruby-escape-data program)
-                              "\n")))
+    (setq riece-ruby-data nil)
+    (make-local-variable 'riece-ruby-escaped-data)
+    (setq riece-ruby-escaped-data nil)
+    (make-local-variable 'riece-ruby-status-alist)
+    (setq riece-ruby-status-alist nil)))
+
+(defun riece-ruby-send-eval (program)
+  (let* ((string (riece-ruby-escape-data program))
+        (length (- (length string) 998))
+        (index 0)
+        data)
+    (while (< index length)
+      (setq data (cons (substring string index (setq index (+ index 998)))
+                      data)))
+    (setq data (cons (substring string index) data)
+         data (nreverse data))
+    (process-send-string riece-ruby-process "EVAL\r\n")
+    (while data
+      (process-send-string riece-ruby-process
+                          (concat "D " (car data) "\r\n"))
+      (setq data (cdr data)))
+    (process-send-string riece-ruby-process "END\r\n")))
+
+(defun riece-ruby-send-poll (name)
+  (process-send-string riece-ruby-process
+                      (concat "POLL " name "\r\n")))
+
+(defun riece-ruby-send-exit (name)
+  (process-send-string riece-ruby-process
+                      (concat "EXIT " name "\r\n")))
 
 (defun riece-ruby-filter (process input)
   (save-excursion
     (set-buffer (process-buffer process))
     (goto-char (point-max))
     (insert input)
-    (goto-char (process-mark process))
+    (goto-char (point-min))
     (beginning-of-line)
-    (while (looking-at ".*\r?\n")
-      (if (looking-at "OK\\( \\(.*\\)\\)?")
+    (while (looking-at ".*\r\n")
+      (if (looking-at "OK\\( \\(.*\\)\\)?\r")
          (progn
-           (funcall riece-ruby-callback
-                    (list 'OK
-                          (match-string 2)
-                          (riece-ruby-unescape-data
-                           (apply #'concat (nreverse riece-ruby-data)))))
-           (setq riece-ruby-data nil))
-       (if (looking-at "ERR \\([0-9]+\\)\\( \\(.*\\)\\)?")
+           (if riece-ruby-escaped-data
+               (setq riece-ruby-data (mapconcat #'riece-ruby-unescape-data
+                                                riece-ruby-escaped-data "")))
+           (setq riece-ruby-escaped-data nil
+                 riece-ruby-response (list 'OK (match-string 2))
+                 riece-ruby-lock nil))
+       (if (looking-at "ERR \\([0-9]+\\)\\( \\(.*\\)\\)?\r")
            (progn
-             (funcall riece-ruby-callback
-                      (list 'ERR
-                            (number-to-string (match-string 1))
-                            (match-string 3)
-                            (riece-ruby-unescape-data
-                             (apply #'concat (nreverse riece-ruby-data)))))
-             (setq riece-ruby-data nil))
-         (if (looking-at "D \\(.*\\)")
-             (setq riece-ruby-data (cons (match-string 1) riece-ruby-data)))))
-      (forward-line))))
+             (setq riece-ruby-escaped-data nil
+                   riece-ruby-response
+                   (list 'ERR (string-to-number (match-string 1))
+                         (match-string 3))
+                   riece-ruby-lock nil))
+         (if (looking-at "D \\(.*\\)\r")
+             (setq riece-ruby-escaped-data (cons (match-string 1)
+                                                 riece-ruby-escaped-data))
+           (if (looking-at "S \\([^ ]*\\) \\(.*\\)\r")
+               (progn
+                 (setq riece-ruby-status-alist (cons (cons (match-string 1)
+                                                           (match-string 2))
+                                                     riece-ruby-status-alist))
+                 (if (member (car (car riece-ruby-status-alist))
+                             '("finished" "exited"))
+                     (riece-ruby-run-exit-handler
+                      (cdr (car riece-ruby-status-alist)))))
+             (if (looking-at "# output \\([^ ]*\\) \\(.*\\)\r")
+                 (riece-ruby-run-output-handler (match-string 1)
+                                                (match-string 2)
+                                                (current-time))
+               (if (looking-at "# exit \\(.*\\)\r")
+                   (riece-ruby-run-exit-handler (match-string 1))))))))
+      (forward-line))
+    (delete-region (point-min) (point))))
+
+(defun riece-ruby-run-exit-handler (name)
+  (let ((entry (assoc name riece-ruby-exit-handler-alist)))
+    (when entry
+      (setq riece-ruby-exit-handler-alist
+           (delq entry riece-ruby-exit-handler-alist))
+      (riece-funcall-ignore-errors (if (symbolp (cdr entry))
+                                      (symbol-name (cdr entry))
+                                    (format "%s-exit-handler" name))
+                                  (cdr entry) (car entry))
+      (riece-ruby-clear name))))
+
+(defun riece-ruby-run-output-handler (name output time)
+  (let ((handler-entry (assoc name riece-ruby-output-handler-alist))
+       (entry (assoc name riece-ruby-output-queue-alist)))
+    (if handler-entry
+       (riece-funcall-ignore-errors (if (symbolp (cdr handler-entry))
+                                        (symbol-name (cdr handler-entry))
+                                      (format "%s-output-handler" name))
+                                    (cdr handler-entry) name output time)
+      (if entry
+         (setcdr entry (cons output (cdr entry)))
+       (setq riece-ruby-output-queue-alist
+             (cons (list name (cons output time))
+                   riece-ruby-output-queue-alist))))))
 
 (defun riece-ruby-sentinel (process status)
   (kill-buffer (process-buffer process)))
 
+(defun riece-ruby-execute (program)
+  "Schedule an execution of a Ruby PROGRAM.
+Return a string name assigned by the server."
+  (unless (and riece-ruby-process
+              (eq (process-status riece-ruby-process) 'run))
+    (let (selective-display
+         (coding-system-for-write 'binary)
+         (coding-system-for-read 'binary))
+      (setq riece-ruby-process
+           (apply #'start-process "riece-ruby" (generate-new-buffer " *Ruby*")
+                  riece-ruby-command
+                  (expand-file-name riece-ruby-server-program
+                                    riece-data-directory)
+                  riece-ruby-server-program-arguments))
+      (process-kill-without-query riece-ruby-process)
+      (set-process-filter riece-ruby-process #'riece-ruby-filter)
+      (set-process-sentinel riece-ruby-process #'riece-ruby-sentinel)))
+  (save-excursion
+    (set-buffer (process-buffer riece-ruby-process))
+    (riece-ruby-reset-process-buffer)
+    (make-local-variable 'riece-ruby-lock)
+    (setq riece-ruby-lock t)
+    (riece-ruby-send-eval program)
+    (while riece-ruby-lock
+      (accept-process-output riece-ruby-process))
+    (if (eq (car riece-ruby-response) 'ERR)
+       (error "Couldn't execute: %S" (cdr riece-ruby-response)))
+    (cdr (assoc "name" riece-ruby-status-alist))))
+
+(defun riece-ruby-inspect (name)
+  "Inspect a result of program execution distinguished by NAME.
+Return a three element list.
+The car is protocol response line which looks like:
+  \(ERR 103 \"Not implemented\").
+The cadr is data from the server, that is, the result of the program.
+The caddr is status from the server."
+  (save-excursion
+    (set-buffer (process-buffer riece-ruby-process))
+    (riece-ruby-reset-process-buffer)
+    (make-local-variable 'riece-ruby-lock)
+    (setq riece-ruby-lock t)
+    (riece-ruby-send-poll name)
+    (while riece-ruby-lock
+      (accept-process-output riece-ruby-process))
+    (list riece-ruby-response
+         riece-ruby-data
+         riece-ruby-status-alist)))
+
+(defun riece-ruby-clear (name)
+  "Clear a result of program execution distinguished by NAME.
+Note that riece-ruby-clear is automatically called iff an exit-handler
+is specified.  Otherwise, it should be called explicitly."
+  (save-excursion
+    (set-buffer (process-buffer riece-ruby-process))
+    (riece-ruby-reset-process-buffer)
+    (make-local-variable 'riece-ruby-lock)
+    (setq riece-ruby-lock t)
+    (riece-ruby-send-exit name)
+    (while riece-ruby-lock
+      (accept-process-output riece-ruby-process)))
+  (let ((entry (assoc name riece-ruby-property-alist)))
+    (if entry
+       (delq entry riece-ruby-property-alist))))
+
+(defun riece-ruby-set-exit-handler (name handler)
+  "Set an exit-handler HANDLER for the program distinguished by NAME.
+An exit-handler is called when the program is finished or exited abnormally.
+An exit-handler is called with an argument same as NAME.
+Note that riece-ruby-clear is automatically called iff an exit-handler
+is specified.  Otherwise, it should be called explicitly."
+  (let ((entry (assoc name riece-ruby-exit-handler-alist)))
+    (if handler
+       (progn
+         (if entry
+             (setcdr entry handler)
+           (setq riece-ruby-exit-handler-alist
+                 (cons (cons name handler)
+                       riece-ruby-exit-handler-alist)))
+         ;;check if the program already exited
+         (riece-ruby-inspect name))
+      (if entry
+         (setq riece-ruby-exit-handler-alist
+               (delq entry riece-ruby-exit-handler-alist))))))
+
+(defun riece-ruby-set-output-handler (name handler)
+  "Set an output-handler HANDLER for the program distinguished by NAME.
+An output-handler is called when the program sends any output by using
+`output' method in the Ruby program.
+An output-handler is called with three argument.  The first argument
+is the same as NAME.  The second argument is the output string.  The
+third argument is the timestamp of the output event."
+  (let ((entry (assoc name riece-ruby-output-handler-alist))
+       queue-entry pointer)
+    (if handler
+       (progn
+         (when (setq queue-entry (assoc name riece-ruby-output-queue-alist))
+           (setq pointer (nreverse (cdr queue-entry))
+                 riece-ruby-output-queue-alist
+                 (delq queue-entry riece-ruby-output-queue-alist))
+           (while pointer
+             (riece-funcall-ignore-errors (if (symbolp handler)
+                                              (symbol-name handler)
+                                            (format "%s-output-handler" name))
+                                          handler name (car (car pointer))
+                                          (cdr (car pointer)))
+             (setq pointer (cdr pointer))))
+         (if entry
+             (setcdr entry handler)
+           (setq riece-ruby-output-handler-alist
+                 (cons (cons name handler)
+                       riece-ruby-output-handler-alist))))
+      (if entry
+         (setq riece-ruby-output-handler-alist
+               (delq entry riece-ruby-output-handler-alist))))))
+
+(defun riece-ruby-set-property (name property value)
+  "Set given PROPERTY/VALUE pair to the program distinguished by NAME."
+  (let ((entry (assoc name riece-ruby-property-alist))
+       property-entry)
+    (unless entry
+      (setq entry (list name)
+           riece-ruby-property-alist (cons entry riece-ruby-property-alist)))
+    (if (setq property-entry (assoc property (cdr entry)))
+       (setcdr property-entry value)
+      (setcdr entry (cons (cons property value) (cdr entry))))))
+
+(defun riece-ruby-property (name property)
+  "Return the value of PROPERTY set to the program distinguished by NAME."
+  (cdr (assoc property (cdr (assoc name riece-ruby-property-alist)))))
+
+(defun riece-ruby-substitute-variables (program alist)
+  "Substitute symbols in PROGRAM by looking up ALIST.
+Return a string concatenating elements in PROGRAM."
+  (setq program (copy-sequence program))
+  (while alist
+    (let ((pointer program))
+      (while pointer
+       (setq pointer (memq (car (car alist)) program))
+       (if pointer
+           (setcar pointer (cdr (car alist))))))
+    (setq alist (cdr alist)))
+  (apply #'concat program))
+
 (provide 'riece-ruby)
 
 ;;; riece-ruby.el ends here
index 48ad91e..a333baf 100644 (file)
@@ -73,7 +73,7 @@ the `riece-server-keyword-map' variable."
          plist)
       (setq plist (cons `(:host ,host) plist))
       (unless (equal service "")
-       (setq plist (cons `(:service ,(string-to-int service)) plist)))
+       (setq plist (cons `(:service ,(string-to-number service)) plist)))
       (unless (equal password "")
        (setq plist (cons `(:password ,(substring password 1)) plist)))
       (apply #'nconc plist))))
diff --git a/lisp/riece-shrink-buffer.el b/lisp/riece-shrink-buffer.el
new file mode 100644 (file)
index 0000000..8fc0bfc
--- /dev/null
@@ -0,0 +1,123 @@
+;;; riece-shrink-buffer.el --- free old IRC messages to save memory usage
+;; Copyright (C) 1998-2005 Daiki Ueno
+
+;; Author: Daiki Ueno <ueno@unixuser.org>
+;; Created: 1998-09-28
+;; Keywords: IRC, riece
+
+;; This file is part of Riece.
+
+;; This program 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.
+
+;; This program 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.
+
+;;; Commentary:
+
+;; NOTE: This is an add-on module for Riece.
+
+;;; Code:
+
+(require 'riece-globals)
+
+(defgroup riece-shrink-buffer nil
+  "Free old IRC messages to save memory usage."
+  :prefix "riece-"
+  :group 'riece)
+  
+(defcustom riece-shrink-buffer-idle-time-delay 5
+  "Number of idle seconds to wait before shrinking channel buffers."
+  :type 'integer
+  :group 'riece-shrink-buffer)
+
+(defcustom riece-max-buffer-size 65536
+  "Maximum size of channel buffers."
+  :type '(integer :tag "Number of characters")
+  :group 'riece-shrink-buffer)
+
+(defcustom riece-shrink-buffer-remove-chars (/ riece-max-buffer-size 2)
+  "Number of chars removed when shrinking channel buffers."
+  :type 'integer
+  :group 'riece-shrink-buffer)
+
+(defvar riece-shrink-buffer-idle-timer nil
+  "Timer object to periodically shrink channel buffers.")
+
+(defconst riece-shrink-buffer-description
+  "Free old IRC messages to save memory usage.")
+
+(defun riece-shrink-buffer-idle-timer ()
+  (let ((buffers riece-buffer-list))
+    (while buffers
+      (if (and (get 'riece-shrink-buffer 'riece-addon-enabled)
+              (buffer-live-p (car buffers))
+              (eq (derived-mode-class
+                   (with-current-buffer (car buffers)
+                     major-mode))
+                  'riece-dialogue-mode))
+         (riece-shrink-buffer (car buffers)))
+      (setq buffers (cdr buffers)))))
+
+(defun riece-shrink-buffer (buffer)
+  (save-excursion
+    (set-buffer buffer)
+    (goto-char (point-min))
+    (while (> (buffer-size) riece-max-buffer-size)
+      (let* ((inhibit-read-only t)
+            buffer-read-only
+            (end (progn
+                   (goto-char riece-shrink-buffer-remove-chars)
+                   (beginning-of-line 2)
+                   (point)))
+            (overlays (riece-overlays-in (point-min) end)))
+       (while overlays
+         (riece-delete-overlay (car overlays))
+         (setq overlays (cdr overlays)))
+       (delete-region (point-min) end)))))
+
+(defun riece-shrink-buffer-startup-hook ()
+  (setq riece-shrink-buffer-idle-timer
+       (riece-run-with-idle-timer
+        riece-shrink-buffer-idle-time-delay t
+        'riece-shrink-buffer-idle-timer)))
+
+(defun riece-shrink-buffer-exit-hook ()
+  (if riece-shrink-buffer-idle-timer
+      (riece-cancel-timer riece-shrink-buffer-idle-timer)))
+
+(defun riece-shrink-buffer-insinuate ()
+  (add-hook 'riece-startup-hook
+           'riece-shrink-buffer-startup-hook)
+  ;; Reset the timer since riece-shrink-buffer-insinuate will be
+  ;; called before running riece-startup-hook.
+  (unless riece-shrink-buffer-idle-timer
+    (riece-shrink-buffer-startup-hook))
+  (add-hook 'riece-exit-hook
+           'riece-shrink-buffer-exit-hook))
+
+(defun riece-shrink-buffer-uninstall ()
+  (riece-shrink-buffer-exit-hook)
+  (remove-hook 'riece-startup-hook
+              'riece-shrink-buffer-startup-hook)
+  (remove-hook 'riece-exit-hook
+              'riece-shrink-buffer-exit-hook))
+
+(defun riece-shrink-buffer-enable ()
+  )
+
+(defun riece-shrink-buffer-disable ()
+  )
+
+(provide 'riece-shrink-buffer)
+
+;;; riece-shrink-buffer.el ends here
index 35ac4f1..a861c7a 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-skk-kakutei.el --- add-on skk-kakutei
+;;; riece-skk-kakutei.el --- remove SKK's preedit mark before sending messages
 ;; Copyright (C) 2003 TAKAHASHI Kaoru
 
 ;; Author: TAKAHASHI "beatmaria" Kaoru <kaoru@kaisei.org>
 
 ;;; Commentary:
 
-;; This add-on deny SKK's sankaku send.
-
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-skk-kakutei)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 (eval-when-compile (require 'riece))
 
-(defvar riece-skk-kakutei-enabled nil)
-
 (defconst riece-skk-kakutei-description
-  "Deny SKK's sankaku send")
+  "Remove SKK's preedit mark before sending messages.")
 
 (defun riece-skk-kakutei-command-enter-message ()
   "Send the current line to the current channel."
 (defun riece-skk-kakutei-enable ()
   (riece-define-keys riece-command-mode-map
     "\r" riece-skk-kakutei-command-enter-message
-    [(control return)] riece-skk-kakutei-command-enter-message-as-notice)
-  (setq riece-skk-kakutei-enabled t))
+    [(control return)] riece-skk-kakutei-command-enter-message-as-notice))
 
 (defun riece-skk-kakutei-disable ()
   (riece-define-keys riece-command-mode-map
     "\r" riece-command-enter-message
-    [(control return)] riece-command-enter-message-as-notice)
-  (setq riece-skk-kakutei-enabled nil))
+    [(control return)] riece-command-enter-message-as-notice))
 
 (provide 'riece-skk-kakutei)
 
index fc22878..4bcec8a 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-toolbar.el --- show toolbar icons
+;;; riece-toolbar.el --- display toolbar icons
 ;; Copyright (C) 1998-2004 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-toolbar)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 (require 'riece-menu)
 
 (defconst riece-toolbar-description
-  "Show toolbar icons.")
+  "Display toolbar icons.")
 
 (defvar riece-toolbar-items
   '(riece-command-quit
            (let ((pointer items)
                  toolbar
                  file
-                 menu-item
-                 (riece-data-directory (locate-data-directory "riece")))
+                 menu-item)
              (while pointer
                (setq file (locate-file (symbol-name (car pointer))
-                                       (if riece-data-directory
-                                           (cons riece-data-directory
-                                                 load-path)
-                                         load-path)
+                                       (cons riece-data-directory load-path)
                                        '(".xpm" ".pbm" ".xbm"))
                      menu-item (riece-toolbar-find-menu-item (car pointer)))
                (if (and file (file-exists-p file))
                              (symbol-name (car pointer)))))))
                (setq pointer (cdr pointer)))
              toolbar))
+         (defvar riece-toolbar-original-toolbar nil)
          (defun riece-set-toolbar (toolbar)
-           (set-specifier default-toolbar toolbar (current-buffer))))
+           (make-local-variable 'riece-toolbar-original-toolbar)
+           (setq riece-toolbar-original-toolbar
+                 (specifier-specs default-toolbar (current-buffer)))
+           (set-specifier default-toolbar toolbar (current-buffer)))
+         (defun riece-unset-toolbar ()
+           (if riece-toolbar-original-toolbar
+               (set-specifier default-toolbar riece-toolbar-original-toolbar
+                              (current-buffer))
+             (remove-specifier default-toolbar (current-buffer)))
+           (kill-local-variable 'riece-toolbar-original-toolbar)))
       (defalias 'riece-make-toolbar-from-menu 'ignore)
-      (defalias 'riece-set-toolbar 'ignore))
+      (defalias 'riece-set-toolbar 'ignore)
+      (defalias 'riece-unset-toolbar 'ignore))
   (defun riece-make-toolbar-from-menu (items menu-items map)
     (let ((pointer items)
          (tool-bar-map (make-sparse-keymap)))
       tool-bar-map))
   (defun riece-set-toolbar (toolbar)
     (make-local-variable 'tool-bar-map)
-    (setq tool-bar-map toolbar)))
+    (setq tool-bar-map toolbar))
+  (defun riece-unset-toolbar ()
+    (kill-local-variable 'tool-bar-map)))
 
 (defvar riece-command-mode-map)
-(defun riece-toolbar-insinuate-in-command-buffer ()
+(defun riece-toolbar-command-mode-hook ()
   (riece-set-toolbar
    (riece-make-toolbar-from-menu
     riece-toolbar-items
   '(riece-menu))
 
 (defun riece-toolbar-insinuate ()
+  (if riece-command-buffer
+      (with-current-buffer riece-command-buffer
+       (riece-toolbar-command-mode-hook)))
   (add-hook 'riece-command-mode-hook
-           'riece-toolbar-insinuate-in-command-buffer
-           t))
+           'riece-toolbar-command-mode-hook t))
+
+(defun riece-toolbar-uninstall ()
+  (if riece-command-buffer
+      (with-current-buffer riece-command-buffer
+       (riece-unset-toolbar)))
+  (remove-hook 'riece-command-mode-hook
+              'riece-toolbar-command-mode-hook))
 
 (provide 'riece-toolbar)
 
index e11a3f8..f0355a9 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-unread.el --- "unread message mark" add-on
+;;; riece-unread.el --- mark channels where new messages arrived
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -23,7 +23,9 @@
 
 ;;; Commentary:
 
-;; This add-on marks channels where new messages are arrived.
+;; NOTE: This is an add-on module for Riece.
+
+;; This add-on marks channels where new messages arrived.
 
 ;; You can check the unread channels via `C-c g' in the commands
 ;; buffer, by adding the following lines to ~/.riece/init.el:
 (require 'riece-message)
 (require 'riece-commands)
 (require 'riece-signal)
-
-(eval-when-compile (require 'riece-highlight))
+(require 'riece-highlight)
 
 (defgroup riece-unread nil
-  "Mark unread channels"
+  "Mark unread channels."
   :tag "Unread"
   :prefix "riece-"
   :group 'riece)
 
 (defvar riece-unread-channels nil)
 
-(defvar riece-unread-enabled nil)
-
 (defconst riece-unread-description
-  "Mark channels where \"unread\" messages arrived")
+  "Mark channels where new messages arrived.")
 
 (defun riece-unread-after-display-message-function (message)
-  (if riece-unread-enabled
+  (if (get 'riece-unread 'riece-addon-enabled)
       (let ((target (if (riece-message-private-p message)
                        (riece-message-speaker message)
                      (riece-message-target message))))
          (riece-emit-signal 'channel-list-changed)))))
 
 (defun riece-unread-after-switch-to-channel-function (last)
-  (if riece-unread-enabled
+  (if (get 'riece-unread 'riece-addon-enabled)
       (setq riece-unread-channels
            (delq (car (riece-identity-member riece-current-channel
                                              riece-unread-channels))
                  riece-unread-channels))))
 
 (defun riece-unread-format-identity-for-channel-list-buffer (index identity)
-  (if (and riece-unread-enabled
+  (if (and (get 'riece-unread 'riece-addon-enabled)
           (riece-identity-member identity riece-unread-channels))
       (concat (format "%2d:!" index)
              (riece-format-identity identity))))
 
 (defun riece-unread-format-identity-for-channel-list-indicator (index identity)
-  (if (and riece-unread-enabled
+  (if (and (get 'riece-unread 'riece-addon-enabled)
           (riece-identity-member identity riece-unread-channels))
       (let ((string (riece-format-identity identity))
            (start 0))
     (error "No unread channel!")))
 
 (defun riece-guess-channel-from-unread ()
-  riece-unread-channels)
+  (reverse riece-unread-channels))
 
 (defun riece-unread-requires ()
   (let (requires)
 ;;;            'riece-guess-channel-from-unread))
   )
 
+(defun riece-unread-uninstall ()
+  (remove-hook 'riece-after-display-message-functions
+              'riece-unread-after-display-message-function)
+  (remove-hook 'riece-after-switch-to-channel-functions
+              'riece-unread-after-switch-to-channel-function)
+  (remove-hook 'riece-format-identity-for-channel-list-buffer-functions
+              'riece-unread-format-identity-for-channel-list-buffer)
+  (remove-hook 'riece-format-identity-for-channel-list-indicator-functions
+              'riece-unread-format-identity-for-channel-list-indicator)
+  (setq riece-channel-list-mark-face-alist
+       (delq (assq ?! riece-channel-list-mark-face-alist)
+             riece-channel-list-mark-face-alist))
+;;;  (if (memq 'riece-guess riece-addons)
+;;;      (add-hook 'riece-guess-channel-try-functions
+;;;            'riece-guess-channel-from-unread))
+  )
+
 (defvar riece-command-mode-map)
 (defvar riece-dialogue-mode-map)
 (defvar riece-channel-list-mode-map)
   (define-key riece-dialogue-mode-map
     "u" 'riece-unread-switch-to-channel)
   (define-key riece-channel-list-mode-map
-    "u" 'riece-unread-switch-to-channel)
-  (setq riece-unread-enabled t)
+    "u" 'riece-unread-switch-to-channel)  
   (riece-emit-signal 'channel-list-changed))
 
 (defun riece-unread-disable ()
     "u" nil)
   (define-key riece-channel-list-mode-map
     "u" nil)
-  (setq riece-unread-channels nil
-       riece-unread-enabled nil)
+  (setq riece-unread-channels nil)
   (riece-emit-signal 'channel-list-changed))
 
 (provide 'riece-unread)
index c502328..9ec45f5 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-url.el --- URL collector add-on
+;;; riece-url.el --- collect URL in IRC buffers
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -24,8 +24,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-url)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
@@ -37,6 +36,7 @@
 
 (defgroup riece-url nil
   "URL Browsing in IRC buffer."
+  :prefix "riece-"
   :group 'riece)
 
 (defcustom riece-url-regexp  "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,;]*[-a-zA-Z0-9_=#$@~`%&*+|\\/;]"
@@ -59,10 +59,8 @@ This maps a string \"Bug#12345\" to a URL
 (defvar riece-urls nil
   "A list of URL which appears in Riece buffers.")
 
-(defvar riece-url-enabled nil)
-
 (defconst riece-url-description
-  "Collect URL in IRC buffers")
+  "Collect URL in IRC buffers.")
 
 (autoload 'widget-convert-button "wid-edit")
 
@@ -122,23 +120,31 @@ This maps a string \"Bug#12345\" to a URL
          (if (memq 'riece-menu riece-addons)
              '(riece-menu))))
 
+(defun riece-url-command-mode-hook ()
+  (easy-menu-add-item
+   nil (list (car riece-menu-items))
+   '("Open URL..." :filter riece-url-create-menu)))
+
 (defun riece-url-insinuate ()
   (add-hook 'riece-after-insert-functions 'riece-url-scan-region)
   (if (memq 'riece-menu riece-addons)
       (add-hook 'riece-command-mode-hook
-               (lambda ()
-                 (easy-menu-add-item
-                  nil (list (car riece-menu-items))
-                  '("Open URL..." :filter riece-url-create-menu)))
+               'riece-url-command-mode-hook
                t)))
 
+(defun riece-url-uninstall ()
+  (easy-menu-remove-item
+   nil (list (car riece-menu-items))
+   "Open URL...")
+  (remove-hook 'riece-after-insert-functions 'riece-url-scan-region)
+  (remove-hook 'riece-command-mode-hook
+              'riece-url-command-mode-hook))
+
 (defun riece-url-enable ()
-  (define-key riece-dialogue-mode-map "U" 'riece-command-browse-url)
-  (setq riece-url-enabled t))
+  (define-key riece-dialogue-mode-map "U" 'riece-command-browse-url))
 
 (defun riece-url-disable ()
-  (define-key riece-dialogue-mode-map "U" nil)
-  (setq riece-url-enabled nil))
+  (define-key riece-dialogue-mode-map "U" nil))
 
 (provide 'riece-url)
 
index 70735ac..b50d265 100644 (file)
@@ -137,6 +137,8 @@ If N is nil, all messages will be returned."
   (with-output-to-string
     (print-recent-messages n)))
 
+(defalias 'riece-remprop 'remprop)
+
 (provide 'riece-xemacs)
 
 ;;; riece-xemacs.el ends here
index 1ec5066..a4fd4ae 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-xface.el --- display X-Face in user list buffer
+;;; riece-xface.el --- display X-Face in IRC buffers
 ;; Copyright (C) 1998-2003 Daiki Ueno
 
 ;; Author: Daiki Ueno <ueno@unixuser.org>
@@ -24,8 +24,7 @@
 
 ;;; Commentary:
 
-;; To use, add the following line to your ~/.riece/init.el:
-;; (add-to-list 'riece-addons 'riece-xface)
+;; NOTE: This is an add-on module for Riece.
 
 ;;; Code:
 
 (require 'riece-display)
 (require 'riece-lsdb)
 
-(defvar riece-xface-enabled nil)
-
 (defconst riece-xface-description
-  "Display X-Face in user list buffer")
+  "Display X-Face in IRC buffers.")
 
 (defvar lsdb-insert-x-face-function)
 
 (defun riece-xface-update-user-list-buffer ()
-  (if riece-xface-enabled
+  (if (get 'riece-xface 'riece-addon-enabled)
       (riece-scan-property-region
        'riece-identity (point-min)(point-max)
        (lambda (start end)
 (defun riece-xface-requires ()
   '(riece-lsdb))
 
+(defun riece-xface-user-list-mode-hook ()
+  (add-hook 'riece-update-buffer-functions
+           'riece-xface-update-user-list-buffer t t))
+
 (defun riece-xface-insinuate ()
+  (if riece-user-list-buffer
+      (with-current-buffer riece-user-list-buffer
+       (riece-xface-user-list-mode-hook)))
   (add-hook 'riece-user-list-mode-hook
-           (lambda ()
-             (add-hook 'riece-update-buffer-functions
-                       'riece-xface-update-user-list-buffer t t))))
+           'riece-xface-user-list-mode-hook))
+
+(defun riece-xface-uninstall ()
+  (if riece-user-list-buffer
+      (with-current-buffer riece-user-list-buffer
+       (remove-hook 'riece-update-buffer-functions
+                    'riece-xface-update-user-list-buffer t)))
+  (remove-hook 'riece-user-list-mode-hook
+              'riece-xface-user-list-mode-hook))
 
 (defun riece-xface-enable ()
-  (setq riece-xface-enabled t)
   (if riece-current-channel
       (riece-emit-signal 'user-list-changed riece-current-channel)))
 
 (defun riece-xface-disable ()
-  (setq riece-xface-enabled nil)
   (if riece-current-channel
       (riece-emit-signal 'user-list-changed riece-current-channel)))
 
index 12a21cc..b6a2115 100644 (file)
@@ -1,4 +1,4 @@
-;;; riece-yank.el --- enter the element in kill-ring
+;;; riece-yank.el --- enter the element of kill-ring
 ;; Copyright (C) 2004 Masatake YAMATO
 
 ;; Author: Masatake YAMATO <jet@gyve.org>
 ;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
-;;
-;; In riece's command buffer, you can send the top element of kill-ring
-;; by C-c y. 
-;; Don't forget do (riece-command-enable-addon 'riece-yank) to test.
-;;
+
+;; NOTE: This is an add-on module for Riece.
+
 ;;; Code:
 (require 'riece-commands)
 
 (defgroup riece-yank nil
-  "Enter the element of `kill-ring'"
+  "Enter the element of kill-ring."
   :tag "Yank"
   :prefix "riece-"
   :group 'riece)
@@ -45,17 +43,17 @@ before/after the first/last non-blank line."
   :type 'boolean
   :group 'riece-yank)
 
-(defvar riece-yank-enabled nil)
+(defconst riece-yank-description
+  "Enter the element of kill-ring.")
 
 (defun riece-yank-insinuate ()
   )
 
+(defvar riece-command-mode-map)
 (defun riece-yank-enable ()
-  (define-key riece-command-mode-map "\C-cy" 'riece-command-yank)
-  (setq riece-yank-enabled t))
+  (define-key riece-command-mode-map "\C-cy" 'riece-command-yank))
 (defun riece-yank-disable ()
-  (define-key riece-command-mode-map "\C-cy" 'undefined)
-  (setq riece-yank-enabled nil))
+  (define-key riece-command-mode-map "\C-cy" 'undefined))
 
 (defun riece-yank-strip-space (string)
   (with-temp-buffer
index 5b0105f..adcd0c4 100644 (file)
     (riece-temp-buffer " *Temp*")
     (riece-debug-buffer " *Debug*")))
 
-(defvar riece-shrink-buffer-idle-timer nil
-  "Timer object to periodically shrink channel buffers.")
-
-(defvar riece-addons-insinuated nil
-  "Non nil if add-ons are already insinuated.")
-
 (defvar riece-select-keys
   `("#" riece-command-switch-to-channel-by-number
     "1" riece-command-switch-to-channel-by-number-1
@@ -166,6 +160,7 @@ If optional argument SAFE is nil, overwrite previous definitions."
     "f" riece-command-finger
     "\C-tf" riece-command-toggle-freeze
     "\C-to" riece-command-toggle-own-freeze
+    "\C-tO" riece-command-toggle-others-buffer-mode
     "\C-tu" riece-command-toggle-user-list-buffer-mode
     "\C-tc" riece-command-toggle-channel-buffer-mode
     "\C-tC" riece-command-toggle-channel-list-buffer-mode
@@ -281,33 +276,17 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
     (modify-frame-parameters (selected-frame)
                             (list (cons 'riece-window-configuration
                                         (current-window-configuration))))
-    (unless riece-addons-insinuated
-      (setq riece-addons (riece-resolve-addons riece-addons))
-      (let ((pointer riece-addons))
-       (while pointer
-         (riece-insinuate-addon (car pointer) riece-debug)
-         (setq pointer (cdr pointer))))
-      (setq riece-addons-insinuated t))
+    (setq riece-addon-dependencies (riece-resolve-addons
+                                   (copy-sequence riece-addons)))
+    (let ((pointer riece-addon-dependencies))
+      (while pointer
+       (riece-insinuate-addon (car (car pointer)) riece-debug)
+       (setq pointer (cdr pointer))))
     (if (or confirm (null riece-server))
        (setq riece-server (completing-read "Server: " riece-server-alist)))
     (if (stringp riece-server)
        (setq riece-server (riece-server-name-to-server riece-server)))
     (riece-create-buffers)
-    (if riece-max-buffer-size
-       (setq riece-shrink-buffer-idle-timer
-             (riece-run-with-idle-timer
-              riece-shrink-buffer-idle-time-delay t
-              (lambda ()
-                (let ((buffers riece-buffer-list))
-                  (while buffers
-                    (if (buffer-live-p (car buffers))
-                        (if (eq (derived-mode-class
-                                 (with-current-buffer (car buffers)
-                                   major-mode))
-                                'riece-dialogue-mode)
-                            (riece-shrink-buffer (car buffers)))
-                      (delq (car buffers) riece-buffer-list))
-                    (setq buffers (cdr buffers))))))))
     (switch-to-buffer riece-command-buffer)
     (riece-display-connect-signals)
     (riece-redisplay-buffers)
@@ -327,32 +306,15 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
          (unless (riece-server-opened server)
            (riece-command-open-server server))
          (setq channel-list (cdr channel-list))))
-      (let ((pointer riece-addons))
+      (let ((pointer riece-addon-dependencies))
        (while pointer
-         (unless (get (car pointer) 'riece-addon-default-disabled)
-           (riece-enable-addon (car pointer) riece-debug))
+         (unless (get (car (car pointer)) 'riece-addon-default-disabled)
+           (riece-enable-addon (car (car pointer)) riece-debug))
          (setq pointer (cdr pointer))))
       (run-hooks 'riece-startup-hook)
       (message "%s" (substitute-command-keys
                     "Type \\[describe-mode] for help")))))
 
-(defun riece-shrink-buffer (buffer)
-  (save-excursion
-    (set-buffer buffer)
-    (goto-char (point-min))
-    (while (> (buffer-size) riece-max-buffer-size)
-      (let* ((inhibit-read-only t)
-            buffer-read-only
-            (end (progn
-                   (goto-char riece-shrink-buffer-remove-chars)
-                   (beginning-of-line 2)
-                   (point)))
-            (overlays (riece-overlays-in (point-min) end)))
-       (while overlays
-         (riece-delete-overlay (car overlays))
-         (setq overlays (cdr overlays)))
-       (delete-region (point-min) end)))))
-
 (defun riece-exit ()
   (if riece-save-variables-are-dirty
       (riece-save-variables-files))
@@ -361,8 +323,6 @@ If optional argument CONFIRM is non-nil, ask which IRC server to connect."
             (buffer-live-p (car riece-buffer-list)))
        (funcall riece-buffer-dispose-function (car riece-buffer-list)))
     (setq riece-buffer-list (cdr riece-buffer-list)))
-  (if riece-shrink-buffer-idle-timer
-      (riece-cancel-timer riece-shrink-buffer-idle-timer))
   (riece-clear-signal-slots)
   (setq riece-server nil
        riece-current-channels nil
@@ -396,21 +356,24 @@ For a list of the generic commands type \\[riece-command-generic] ? RET.
   (make-local-variable 'truncate-partial-width-windows)
   (setq truncate-partial-width-windows nil)
 
+  (make-local-variable 'riece-mode-line-buffer-identification)
   (setq riece-away-indicator "-"
        riece-operator-indicator "-"
        riece-channel-status-indicator "-"
        major-mode 'riece-command-mode
        mode-name "Command"
+       riece-mode-line-buffer-identification
+       '("Riece: "
+         riece-away-indicator
+         riece-operator-indicator
+         riece-channel-status-indicator
+         " "
+         riece-user-indicator
+         " "
+         riece-channel-indicator)
        mode-line-buffer-identification
        (riece-mode-line-buffer-identification
-        '("Riece: "
-          riece-away-indicator
-          riece-operator-indicator
-          riece-channel-status-indicator
-          " "
-          riece-user-indicator
-          " "
-          riece-channel-indicator))
+        riece-mode-line-buffer-identification)
        truncate-lines nil)
   (riece-simplify-mode-line-format)
   (use-local-map riece-command-mode-map)
@@ -439,21 +402,24 @@ Instead, these commands are available:
   (make-local-variable 'truncate-partial-width-windows)
   (setq truncate-partial-width-windows nil)
 
+  (make-local-variable 'riece-mode-line-buffer-identification)
   (setq riece-freeze riece-default-freeze
        riece-away-indicator "-"
        riece-operator-indicator "-"
        riece-channel-status-indicator "-"
        major-mode 'riece-dialogue-mode
        mode-name "Dialogue"
+       riece-mode-line-buffer-identification
+       '("Riece: "
+         riece-away-indicator
+         riece-operator-indicator
+         riece-freeze-indicator
+         riece-channel-status-indicator
+         " "
+         riece-channel-list-indicator " ")
        mode-line-buffer-identification
        (riece-mode-line-buffer-identification
-        '("Riece: "
-          riece-away-indicator
-          riece-operator-indicator
-          riece-freeze-indicator
-          riece-channel-status-indicator
-          " "
-          riece-channel-list-indicator " "))
+        riece-mode-line-buffer-identification)
        truncate-lines nil
        buffer-read-only t)
   (riece-simplify-mode-line-format)
@@ -475,15 +441,18 @@ All normal editing commands are turned off.
 Instead, these commands are available:
 \\{riece-channel-mode-map}"
   (make-local-variable 'riece-channel-buffer-window-point)
-  (setq mode-line-buffer-identification
+  (make-local-variable 'riece-mode-line-buffer-identification)
+  (setq riece-mode-line-buffer-identification
+       '("Riece: "
+         riece-away-indicator
+         riece-operator-indicator
+         riece-freeze-indicator
+         riece-channel-status-indicator
+         " "
+         riece-long-channel-indicator)
+       mode-line-buffer-identification
        (riece-mode-line-buffer-identification
-        '("Riece: "
-          riece-away-indicator
-          riece-operator-indicator
-          riece-freeze-indicator
-          riece-channel-status-indicator
-          " "
-          riece-long-channel-indicator))))
+        riece-mode-line-buffer-identification)))
 
 (defun riece-channel-list-mode ()
   "Major mode for displaying channel list.
@@ -496,10 +465,13 @@ All normal editing commands are turned off."
   (make-local-variable 'truncate-partial-width-windows)
   (setq truncate-partial-width-windows nil)
 
+  (make-local-variable 'riece-mode-line-buffer-identification)
   (setq major-mode 'riece-channel-list-mode
        mode-name "Channels"
+       riece-mode-line-buffer-identification '("Riece: ")
        mode-line-buffer-identification
-       (riece-mode-line-buffer-identification '("Riece: "))
+       (riece-mode-line-buffer-identification
+        riece-mode-line-buffer-identification)
        truncate-lines t
        buffer-read-only t)
   (make-local-hook 'riece-update-buffer-functions)
@@ -521,11 +493,14 @@ Instead, these commands are available:
   (make-local-variable 'truncate-partial-width-windows)
   (setq truncate-partial-width-windows nil)
 
+  (make-local-variable 'riece-mode-line-buffer-identification)
   (setq major-mode 'riece-user-list-mode
        mode-name "Users"
+       riece-mode-line-buffer-identification
+       '("Riece: " riece-long-channel-indicator " ")
        mode-line-buffer-identification
        (riece-mode-line-buffer-identification
-        '("Riece: " riece-long-channel-indicator " "))
+        riece-mode-line-buffer-identification)
        truncate-lines t
        buffer-read-only t)
   (if (boundp 'transient-mark-mode)
diff --git a/lisp/rubyserv.rb b/lisp/rubyserv.rb
deleted file mode 100644 (file)
index 7c894fc..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-# A simple IPC server executing arbitrary Ruby program.
-
-# The protocol is based on Assuan protocol of GnuPG.
-# http://www.gnupg.org/(en)/related_software/libassuan/index.html
-
-require 'thread'
-require 'stringio'
-
-class RubyServ
-  def initialize
-    @buf = StringIO.new
-    @que = Queue.new
-  end
-
-  def dispatch(line)
-    case line.chomp
-    when /\AD /
-      @buf << unescape($')
-    when /\A(\S+)\s*/
-      c = $1
-      r = $'
-      d = "dispatch_#{c.downcase}"
-      if respond_to?(d, true)
-        Thread.start do
-          self.send(d, c, r)
-        end
-      else
-        puts("ERR 103 Unknown command\r\n")
-      end
-    end
-  end
-
-  def dispatch_cancel(c, r)
-    puts("ERR 100 Not implemented\r\n")
-  end
-
-  def dispatch_bye(c, r)
-    puts("ERR 100 Not implemented\r\n")
-  end
-
-  def dispatch_auth(c, r)
-    puts("ERR 100 Not implemented\r\n")
-  end
-
-  def dispatch_reset(c, r)
-    puts("ERR 100 Not implemented\r\n")
-  end
-
-  def dispatch_end(c, r)
-    enq_data
-  end
-
-  def dispatch_help(c, r)
-    puts("ERR 100 Not implemented\r\n")
-  end
-
-  def dispatch_quit(c, r)
-    puts("ERR 100 Not implemented\r\n")
-  end
-
-  def dispatch_eval(c, r)
-    r = deq_data if r.empty?
-    open('|-') do |f|
-      if f
-        d = f.read
-        Process.wait
-        send_data(d) if d
-        if $?.success?
-          puts("OK\r\n")
-        else
-          puts("ERR #{$?.exitstatus}\r\n")
-        end
-      else
-        eval(r)
-        exit
-      end
-    end
-  end
-
-  def escape(s)
-    s.gsub(/[%\r\n]/) {|m| '%%%02X' % m[0]}
-  end
-
-  def unescape(s)
-    s.gsub(/%([0-9A-Z][0-9A-Z])/, ['\1'].pack('H*'))
-  end
-
-  def send_data(d)
-    d = escape(d)
-    begin
-      len = [d.length, 998].min   # 998 = 1000 - "D "
-      puts("D #{d[0 ... len]}\r\n")
-      d = d[len .. -1]
-    end until d.empty?
-  end
-
-  def enq_data
-    @que.enq(@buf.string)
-  end
-
-  def deq_data
-    @que.deq
-  end
-end
-
-if $0 == __FILE__
-  serv = RubyServ.new
-  while gets
-    serv.dispatch($_)
-  end
-end
diff --git a/lisp/server.rb b/lisp/server.rb
new file mode 100644 (file)
index 0000000..87b094e
--- /dev/null
@@ -0,0 +1,226 @@
+# server.rb --- A simple IPC server executing Ruby programs.
+# Copyright (C) 1998-2005 Daiki Ueno
+
+# Author: Daiki Ueno <ueno@unixuser.org>
+# Created: 1998-09-28
+# Keywords: IRC, riece, Ruby
+
+# This file is part of Riece.
+
+# This program 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.
+
+# This program 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.
+
+require 'thread'
+require 'stringio'
+
+class Server
+  def initialize(outfile, errfile, logfile)
+    @out = $stdout
+    @err = $stderr
+    $stdout = outfile ? File.new(outfile, 'a') : StringIO.new
+    $stderr = errfile ? File.new(errfile, 'a') : StringIO.new
+    @log = File.new(logfile, 'a') if logfile
+
+    @buf = ''
+    @que = Queue.new
+    @thr = Hash.new
+    @cnt = 0
+  end
+
+  def dispatch(line)
+    @log.puts(line) if @log
+    case line.chomp
+    when /\AD /
+      @buf << $'
+    when /\A(\S+)\s*/
+      c = $1
+      r = $'
+      d = "dispatch_#{c.downcase}"
+      if respond_to?(d, true)
+        Thread.start do
+          self.send(d, c, r)
+        end
+      else
+        send_line("ERR 103 Unknown command\r\n")
+      end
+    end
+  end
+
+  def dispatch_cancel(c, r)
+    send_line("ERR 100 Not implemented\r\n")
+  end
+
+  def dispatch_bye(c, r)
+    send_line("ERR 100 Not implemented\r\n")
+  end
+
+  def dispatch_auth(c, r)
+    send_line("ERR 100 Not implemented\r\n")
+  end
+
+  def dispatch_reset(c, r)
+    send_line("ERR 100 Not implemented\r\n")
+  end
+
+  def dispatch_end(c, r)
+    enq_data
+  end
+
+  def dispatch_help(c, r)
+    send_line("ERR 100 Not implemented\r\n")
+  end
+
+  def dispatch_quit(c, r)
+    send_line("ERR 100 Not implemented\r\n")
+  end
+
+  def dispatch_eval(c, r)
+    r = deq_data if r.empty?
+    name = nil
+    Thread.exclusive do
+      while @thr.include?(name = @cnt.to_s)
+       @cnt += 1
+      end
+      @thr[name] = Thread.current
+    end
+    send_line("S name #{name}\r\n")
+    send_line("OK\r\n")
+    Thread.current[:rubyserv_name] = name
+    begin
+      Thread.current[:rubyserv_error] = false
+      Thread.current[:rubyserv_response] = eval(r, exec_env.empty_binding)
+    rescue Exception => e
+      Thread.current[:rubyserv_error] = true
+      Thread.current[:rubyserv_response] =
+        e.to_s.sub(/\A.*?\n#{Regexp.quote(__FILE__)}:\d+: /o, '')
+    end
+    send_line("# exit #{name}\r\n")
+  end
+
+  def dispatch_poll(c, r)
+    thr = @thr[r]
+    if !thr
+      send_line("ERR 105 Parameter error: no such name \"#{r}\"\r\n")
+    elsif thr.alive?
+      send_line("S running #{r}\r\n")
+      send_line("OK\r\n")
+    else
+      if thr[:rubyserv_error]
+        send_line("S exited #{r}\r\n")
+      else
+        send_line("S finished #{r}\r\n")
+      end
+      if d = thr[:rubyserv_response]
+        send_data(d.to_s)
+      end
+      send_line("OK\r\n")
+    end
+  end
+
+  def dispatch_exit(c, r)
+    thr = @thr[r]
+    if !thr
+      send_line("ERR 105 Parameter error: no such name \"#{r}\"\r\n")
+      return
+    end
+    thr.kill if thr.alive?
+    @thr.delete(r)
+    send_line("OK\r\n")
+  end
+
+  def escape(s)
+    s.gsub(/[%\r\n]/) {|m| '%%%02X' % m[0]}
+  end
+
+  def unescape(s)
+    s.gsub(/%([0-9A-Z][0-9A-Z])/) {[$1].pack('H*')}
+  end
+
+  def send_data(d)
+    d = escape(d)
+    begin
+      len = [d.length, 998].min   # 998 = 1000 - "D "
+      send_line("D #{d[0 ... len]}\r\n")
+      d = d[len .. -1]
+    end until d.empty?
+  end
+
+  def enq_data
+    d = unescape(@buf)
+    @buf = ''
+    @que.enq(d)
+  end
+
+  def deq_data
+    @que.deq
+  end
+
+  def send_line(line)
+    @out.puts(line)
+    @log.puts(line) if @log
+  end
+
+  def exec_env
+    env = Object.new
+    def env.empty_binding
+      binding
+    end
+    out, log = @out, @log
+    env.instance_eval {@out, @log = out, log}
+    def env.send_line(line)
+      @out.puts(line)
+      @log.puts(line) if @log
+    end
+    def env.output(s)
+      send_line("# output #{Thread.current[:rubyserv_name]} #{s}\r\n")
+    end
+    env
+  end
+end
+
+if $0 == __FILE__
+  require 'optparse'
+
+  opt_outfile, opt_errfile, opt_logfile = nil, nil, nil
+  opts = OptionParser.new do |opts|
+    opts.banner = <<"End"
+Usage: #{$0} [OPTIONS]
+End
+    opts.on('-o', '--out OUTFILE', 'Send stdout to OUTFILE.') do |outfile|
+      opt_outfile = outfile
+    end
+    opts.on('-e', '--err ERRFILE', 'Send stderr to ERRFILE.') do |errfile|
+      opt_errfile = errfile
+    end
+    opts.on('-l', '--log LOGFILE', 'Send log to LOGFILE.') do |logfile|
+      opt_logfile = logfile
+    end
+    opts.on_tail('--help', '-h', 'Show this message.') do
+      $stdout.print(opts.to_s)
+      exit(0)
+    end
+  end
+  begin
+    opts.parse!(ARGV)
+  rescue OptionParser::ParseError
+    $stderr.print(opts.to_s)
+    exit(1)
+  end
+
+  server = Server.new(opt_outfile, opt_errfile, opt_logfile)
+  while gets
+    server.dispatch($_)
+  end
+end
index b0e39b1..9fae05c 100644 (file)
   (lunit-assert-2
    case
    (equal
-    (riece-resolve-addons '(test-riece-addon-1 test-riece-addon-2))
+    (mapcar #'car (riece-resolve-addons
+                  '(test-riece-addon-1 test-riece-addon-2)))
     '(test-riece-addon-3 test-riece-addon-4
                         test-riece-addon-2 test-riece-addon-1))))
 
 (luna-define-method test-riece-resolve-addons-2 ((case test-riece-addon))
   (lunit-assert-2
    case
-   (equal
-    (condition-case error
-       (riece-resolve-addons '(test-riece-addon-5 test-riece-addon-6))
-      (error (nth 1 error)))
-    "Circular add-on dependency found")))
+   (condition-case error
+       (progn
+        (riece-resolve-addons '(test-riece-addon-5 test-riece-addon-6))
+        nil)
+     (error (nth 1 error)))))
index 98a3c05..8f92dc9 100644 (file)
   (make-directory riece-log-directory)
   (make-directory test-riece-log-directory)
   (write-region "03:14 <test> a b c\n03:15 <test> a b c\n" nil
-               (expand-file-name "20380119.txt" test-riece-log-directory)
+               (expand-file-name "19700102.txt" test-riece-log-directory)
                t 0)
   (write-region "03:14 <test> 1 2 3\n" nil
-               (expand-file-name "20380118.txt" test-riece-log-directory)
+               (expand-file-name "19700101.txt" test-riece-log-directory)
                t 0))
 
 (luna-define-method lunit-test-case-teardown ((case test-riece-log))
@@ -39,9 +39,9 @@
     (lunit-assert-2
      case
      (equal
-      (concat "03:14 <test> 1 2 3 (2038/01/18)\n"
-             "03:14 <test> a b c (2038/01/19)\n"
-             "03:15 <test> a b c (2038/01/19)\n")
+      (concat "03:14 <test> 1 2 3 (1970/01/01)\n"
+             "03:14 <test> a b c (1970/01/02)\n"
+             "03:15 <test> a b c (1970/01/02)\n")
       (with-temp-buffer
        (riece-log-insert (riece-make-identity "#riece" "") 3)
        (buffer-string))))))
diff --git a/lisp/test/test-riece-ruby.el b/lisp/test/test-riece-ruby.el
new file mode 100644 (file)
index 0000000..ca99573
--- /dev/null
@@ -0,0 +1,98 @@
+(require 'riece-ruby)
+
+(luna-define-class test-riece-ruby (lunit-test-case))
+
+(luna-define-method lunit-test-case-teardown ((case test-riece-ruby))
+  (riece-ruby-execute "exit!")
+  (sleep-for 1))
+
+(luna-define-method test-riece-ruby-execute-1 ((case test-riece-ruby))
+  (lunit-assert-2
+   case
+   (equal (riece-ruby-execute "sleep 30") "0"))
+  (lunit-assert-2
+   case
+   (equal (riece-ruby-execute "1 << 32") "1"))
+  (lunit-assert-2
+   case
+   (equal (riece-ruby-execute "\"") "2")))
+
+(luna-define-method test-riece-ruby-inspect-1 ((case test-riece-ruby))
+  (let ((name (riece-ruby-execute "sleep 30")))
+    (lunit-assert-2
+     case
+     (eq (car (car (riece-ruby-inspect name))) 'OK))
+    (lunit-assert-2
+     case
+     (assoc "running" (nth 2 (riece-ruby-inspect name))))))
+
+(luna-define-method test-riece-ruby-inspect-2 ((case test-riece-ruby))
+  (let ((name (riece-ruby-execute "1 << 32")))
+    (lunit-assert-2
+     case
+     (eq (car (car (riece-ruby-inspect name))) 'OK))
+    (lunit-assert-2
+     case
+     (equal (nth 1 (riece-ruby-inspect name)) "4294967296"))
+    (lunit-assert-2
+     case
+     (assoc "finished" (nth 2 (riece-ruby-inspect name))))))
+
+(luna-define-method test-riece-ruby-inspect-3 ((case test-riece-ruby))
+  (let ((name (riece-ruby-execute "\"")))
+    (lunit-assert-2
+     case
+     (eq (car (car (riece-ruby-inspect name))) 'OK))
+    (lunit-assert-2
+     case
+     (equal (nth 1 (riece-ruby-inspect name))
+           "unterminated string meets end of file"))
+    (lunit-assert-2
+     case
+     (assoc "exited" (nth 2 (riece-ruby-inspect name))))))
+
+(luna-define-method test-riece-ruby-clear-1 ((case test-riece-ruby))
+  (let ((name (riece-ruby-execute "sleep 30")))
+    (riece-ruby-clear name)
+    (lunit-assert-2
+     case
+     (eq (car (car (riece-ruby-inspect name))) 'ERR))
+    (lunit-assert-2
+     case
+     (= (nth 1 (car (riece-ruby-inspect name))) 105))))
+
+(defvar test-riece-ruby-exit-handler-1 nil)
+(luna-define-method test-riece-ruby-exit-handler-1 ((case test-riece-ruby))
+  (let ((name (riece-ruby-execute "1 << 32")))
+    (riece-ruby-set-exit-handler
+     name
+     (lambda (name)
+       (setq test-riece-ruby-exit-handler-1 name)))
+    (sleep-for 1)
+    (lunit-assert-2
+     case
+     (equal test-riece-ruby-exit-handler-1 name))))
+
+(defvar test-riece-ruby-output-handler-1 nil)
+(luna-define-method test-riece-ruby-output-handler-1 ((case test-riece-ruby))
+  (let ((name (riece-ruby-execute "output(1 << 32)")))
+    (riece-ruby-set-output-handler
+     name
+     (lambda (name output time)
+       (setq test-riece-ruby-output-handler-1 output)))
+    (sleep-for 1)
+    (lunit-assert-2
+     case
+     (equal test-riece-ruby-output-handler-1 "4294967296"))))
+
+(defvar test-riece-ruby-output-handler-2 nil)
+(luna-define-method test-riece-ruby-output-handler-2 ((case test-riece-ruby))
+  (let ((name (riece-ruby-execute "output(1 << 32)")))
+    (sleep-for 1)
+    (riece-ruby-set-output-handler
+     name
+     (lambda (name output time)
+       (setq test-riece-ruby-output-handler-2 output)))
+    (lunit-assert-2
+     case
+     (equal test-riece-ruby-output-handler-2 "4294967296"))))
\ No newline at end of file