From: ueno Date: Sun, 28 Aug 2005 07:39:05 +0000 (+0000) Subject: Synch up with the trunk. X-Git-Tag: channel-coding-mergepoint~18 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=f81027c996c759dad1687b16e68a16c77501413a;p=elisp%2Friece.git Synch up with the trunk. --- diff --git a/AUTHORS b/AUTHORS index 7f09ddc..ff3e9a9 100644 --- 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 . @@ -10,9 +10,9 @@ written by the same author of Riece. Tor Lillqvist 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: diff --git a/ChangeLog b/ChangeLog index e6d8657..ae848ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-08-06 Daiki Ueno + + * Makefile.am (EXTRA_DIST): Add HACKING.ja. + 2005-03-06 Daiki Ueno * Riece: Version 1.0.8 released. diff --git a/NEWS b/NEWS index 8ad3a68..3289563 100644 --- 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 --- a/NEWS.ja +++ b/NEWS.ja @@ -1,3 +1,42 @@ +* Riece 2.0.0 $B$N2A$9$k5!9=$NF3F~!#(B + $BMxMQJ}K!$O(B riece-ruby.el $BKAF,$N%3%a%s%H$r;2>H(B (ueno) + +** $B?75,%"%I%*%s(B riece-eval-ruby.el $B$rF3F~!#(B",ruby " $B$KB3$$$FG$0U$N(B + Ruby $B$N%W%m%0%i%`$rH/8@$9$k$H!"I>2A7k2L$r%A%c%s%M%k$KAw?.$9$k(B (ueno) + +** $BDj4|E*$K%P%C%U%!$r@Z$j5M$a$k5!G=$r%"%I%*%s$KJ,N%(B + $B$3$l$^$G(B riece-max-buffer-size $B$r@_Dj$7$F$$$??M$O!"(B + riece-shrink-buffer $B%"%I%*%s$rM-8z$K$9$kI,MW$,$"$k$N$GCm0U(B (ueno) + +** $BN%C&$7$?%A%c%s%M%k$K;22C$7$F$$$?%f!<%6$,(B IRC $B$r$d$a$?>l9g$K!"%(%i!<(B + $B$,H/@8$9$kIT6q9g$N=$@5(B (ueno) + +** $B%m%0$NJ]B8;~$K!";HMQ$7$?(B coding-system $B$NL>A0$r%U%!%$%kL>$KKd$a9~$`(B + $B$h$&$K$7$?!#$3$l$K$h$j(B riece-log-coding-system $B$r@_Dj$7$J$/$F$bJ8;z(B + $B2=$1$,H/@8$7$K$/$/$J$C$?(B (ueno) + +** C-c g $B$G%A%c%s%M%k$r0\F0$9$k:]$K!"?7$7$$H/8@$,$"$C$?%A%c%s%M%k$+$i(B + $BC)$k$h$&$K$7$?(B (ueno) + +** $B%A%c%s%M%kL>$H%5!<%PL>$N6h@Z$jJ8;zNs$H$7$F(B " " $B0J30$K(B "@" $B$b5v$9$h(B + $B$&$K$7$?(B (ueno) + +** $BF|K\8l%^%K%e%"%k(B (riece-ja.texi) $B$r=i?4]$K=q$-D>$7$?(B (ueno) + +** *Others* $B%P%C%U%!$r1#$;$k$h$&$K$7$?(B (ueno) + +** $B%G%P%C%0=PNO$r@lMQ$N%P%C%U%!$KJ,N%(B (ueno) + +** elisp $B%U%!%$%k$r#1$D$:$D(B byte-compile $B$9$k(B make $B%k!<%k$r@_$1$?!#(B + configure $B8e!"(Blisp/ $B0J2<$G(B make compile-individually (ueno) + +** $B3+H/$N(B elisp $B%Q%C%1!<%8$K0MB8$7$J$$$?$a!"%$%s%9%H!<%k$,4JC1(B - $B@_Dj$,4JC1$G!"A02s5/F0;~$N@_Dj$r5-O?!&I|85$9$k;EAH$_$rDs6!(B - $BCJ3,E*$JA`:n@bL@=q(B (info $B7A<0(B) $B$,ImB0(B @@ -20,29 +20,32 @@ doc/ - $BJ8=q%U%!%$%k(B * $BI,MW$J$b$N(B -- Emacs 20.7 $B0J>e!"$^$?$O(B XEmacs 21.4 $B0J>e(B -- Ruby 1.6 $B0J>e(B ($BG$0U(B) +- Emacs 20.7 $B0J9_!"$^$?$O(B XEmacs 21.4 $B0J9_(B +- Ruby 1.8 $B0J9_(B ($BG$0U(B) * $B%$%s%9%H!<%k(B $ ./configure $ sudo make install -XEmacs $B$r;H$C$F$$$F!"%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$7$?$$>l9g$K$O!"(B -"--with-xemacs" $B%*%W%7%g%s$r(B configure $B%9%/%j%W%H$KM?$($F$/$@$5$$!#(B -$B$^$?!"(B"install" $B%?!<%2%C%H$NBe$o$j$K(B "install-package" $B$r;H$C$F$/$@$5$$!#(B +~/.emacs $BEy$K0J2<$N0l9T$rDI2C$7$F$/$@$5$$!#(B -* $B%P%0Js9p(B + (autoload 'riece "riece" "Start Riece" t) -$B%P%0Js9p$d!"2~A1MW5a$r=q$$$?$i!"$I$&$>(B Liece $B%a!<%j%s%0%j%9%H$KAw$C$F$/$@$5$$!#(B +XEmacs $B$G;H$&>l9g$K$O(B "--with-xemacs" $B%*%W%7%g%s$r(B configure $B%9%/%j%W(B +$B%H$KM?$($F$/$@$5$$!#$^$?!"(B"make install" $B$NBe$o$j$K(B "make +install-package" $B$H$9$k$3$H$G(BXEmacs $B$N%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$9$k(B +$B$3$H$,$G$-$^$9!#(B -$B$3$N%a!<%j%s%0%j%9%H$O!">-Mh$N3HD%$d@_DjJ}K!$J$I!"B>$N0lHLE*$J5DO@$K$b(B -$BMQ$$$i$l$^$9!#(BLiece ML $B$K;22C$9$k$K$O!"K\J8$K(B +* $B%^%K%e%"%k(B - subscribe $B$"$J$?$NL>A0(B +$B;H$$J}$OF1:-$N%^%K%e%"%k$K5-:\$5$l$F$$$^$9!#(B +$B%^%K%e%"%k$rFI$`$K$O(B "M-x info" $B$G0J2<$N%a%K%e!<$rA*Br$7$^$9!#(B -$B$H=q$$$?%a!<%k$r(B + * Riece-ja: (riece-ja). An IRC client for Emacsen - liece-ctl@unixuser.org +* $B%P%0Js9p(B -$B$^$GAw$C$F$/$@$5$$!#(B +$B%P%0Js9p$O!"(BLiece $B%a!<%j%s%0%j%9%H(B (liece@unixuser.org) $B$K$*Aw$j$/$@$5(B +$B$$!#(BRiece $B$N" 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 "@" 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. + +- -requires + Return a list of names of other add-ons this add-on depends. (optional) + +- -insinuate + Called on initialization of this module. + +It is recommended to set short explanation of the add-on to +-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 +-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. + +- -enable + Called to enable this add-on. + +- -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 -requires on each add-on (if exists) and build a + dependency graph. + +(3) Sort the dependency graph. + +(4) Call -insinuate on each add-on in order of the + dependencies. + +(5) Call -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--hook + Called before processing an IRC message. + +- riece-after--hook + Called after processing an IRC message. + +Where is a type of IRC message and consists only lowercase +characters. + +If riece--hook returns non-nil, is not processed. +In this case riece-after--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 index 0000000..3deebfc --- /dev/null +++ b/doc/HACKING.ja @@ -0,0 +1,419 @@ +-*- mode: text; coding: iso-2022-jp -*- + +$B$3$NJ8=q$G$O!"(BRiece $B$N3+H/%W%m%;%9$dFbIt9=B$$J$I!"3+H/$KI,MW$J>pJs$r$^(B +$B$H$a$F$$$^$9!#(B + +* $B3+H/%W%m%;%9(B + +** $B%P%0Js9p(B + +$B%P%0Js9p$O!"%D!<%k%P!<$NCn$N%"%$%3%s$r%/%j%C%/$9$k$+!"(B +M-x riece-submit-bug-report $B$G:n@.$7$F$/$@$5$$!#$^$?!"%P%0Js9p$N:n@.$N(B +$BA0$K%G%P%C%0=PNO$rM-8z$K$7$F$*$/I,MW$,$"$j$^$9!#(B + +** $B%G%P%C%0=PNO(B + +$BJQ?t(B riece-debug $B$r(B t $B$K@_Dj$9$k$H!"(BRiece $B$NpJs$,=PNO(B +$B$5$l$k$h$&$K$J$j$^$9!#%G%P%C%0>pJs$O(B *Debug* $B%P%C%U%!$KC_@Q$5$l$^$9!#(B + +$B$^$?!"(BIRC $B%5!<%P$H$N$d$j$H$j$,(B " *IRC*A0(B>" $B%P%C%U%!$KC_(B +$B@Q$5$l$^$9!#%P%C%U%!$NL>A0$,6uGr(B " " $B$G;O$^$k$3$H$K$4Cm0U$/$@$5$$!#(B + +** $B3+H/$X$N;22C(B + +$B%Q%C%A$+%"%I%*%s$r=q$$$FAw$C$F$/$@$5$$!#E,@Z$J$b$N$G$"$l$Pe$N$b$N$G$"$j!"MxMQ$O8D?M$N@UG$(B +$B$G$*4j$$$7$^$9!#(BCVS $BHG$K4X$9$k%P%0Js9p$Oe0L$K(B +$B$"$k$b$N$r@h$K5s$2$^$9!#(B + +- riece-globals + $BBg0hJQ?t$NDj5A(B + +- riece-options + $B%f!<%6%*%W%7%g%s$NDj5A(B + +- riece-version + $B%P!<%8%g%s$NDj5A(B + +- riece-coding + $B%3!<%G%#%s%0%7%9%F%`4XO"$N4X?t$NDj5A(B + +- riece-complete + $B%_%K%P%C%U%!$G$NJd40$r=u$1$k4X?t$NDj5A(B + +- riece-addon + $B%"%I%*%s4IM}(B + +- riece-mode + riece-channel/riece-user $B%*%V%8%'%/%H$N%b!<%I4IM}(B + +- riece-identity + riece-channel/riece-user $B%*%V%8%'%/%H(B $B$NBg0hI=5-$rA`:n$9$k4X?t$NDj5A(B + +- riece-channel + riece-channel $B%*%V%8%'%/%H(B $B4XO"$NDj5A(B + +- riece-user + riece-user $B%*%V%8%'%/%H(B $B4XO"$NDj5A(B + +- riece-misc + $B;(B?$J4X?t$NDj5A(B + +- riece-signal + $B%7%0%J%k4IM}(B + +- riece-layout + $B%&%#%s%I%&%l%$%"%&%H4IM}(B + +- riece-display + $BI=<(MQ%P%C%U%!$N4IM}(B + +- riece-server + IRC $B%5!<%P$H$N@\B34IM}(B + +- riece-naming + $B%A%c%s%M%k$X$N%f!<%6$N;22C!&N%C&$r4IM}$9$k(B mediator + +- riece-message + riece-message $B%*%V%8%'%/%H(B $B4XO"$NDj5A(B + +- riece-filter + $B%W%m%;%9%U%#%k%?$N%(%s%H%j%]%$%s%H(B + +- riece-handle + $BDL>o$N%a%C%;!<%8$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B + +- riece-000 + 000$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B + +- riece-200 + 200$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B + +- riece-300 + 300$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B + +- riece-400 + 400$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B + +- riece-500 + 500$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B + +- riece-commands + $B%3%^%s%I$NDj5A(B + +- riece-irc + IRC $B%W%m%H%3%k$KBP1~$7$?(B process-filter $B$J$I$N@_Dj(B + +- riece + $B5/F0;~$N%(%s%H%j%]%$%s%H!#3F%P%C%U%!$N%a%8%c!<%b!<%I$N@_Dj$J$I(B + +** $BL>A06u4V$N4IM}(B + +Riece $B$OF1;~$KJ#?t$N(B IRC $B%5!<%P$K@\B3$G$-$k$N$G!"(BIRC $B%5!<%PKh$KJL!9$N(B +$BL>A06u4V$r4IM}$9$kI,MW$,$"$j$^$9!#$3$N$h$&$JL>A06u4V$K$O!"(BIRC $B%5!<%P$H(B +$B$N@\B3%W%m%;%9$K7k$SIU$1$i$l$?%P%C%U%!$N%m!<%+%kJQ?t$r2p$7$F%"%/%;%9$7(B +$B$^$9!#(B + +*** $B%W%m%;%9%P%C%U%!$NA0$rCN$kI,MW$,(B +$B$"$j$^$9!#(BIRC $B%5!<%P$NL>A0$O0J2<$K5s$2$k$$$/$D$+$NJ}K!$GA0(B + +$B$3$&$7$FA0$r0z?t$K4X?t(B riece-server-process $B$r(B +$B8F=P$7!"%5!<%P$N%W%m%;%9$rl9g!"%A%c%s%M%kL>$d%K%C%/%M!<%`$rBg0h(B +$BE*$K6hJL$9$kI,MW$,@8$8$^$9!#$3$N$h$&$JL>A0$rI=8=$9$k$N$,(B +riece-identity $B%*%V%8%'%/%H$G$9!#(B + +riece-identity $B%*%V%8%'%/%H$O0J2<$N(B 2 $B$D$NMWAG$r$b$D%Y%/%?!<$G$9!#(B + +- prefix + $B%A%c%s%M%kL>$d%K%C%/%M!<%`$J$I!"(BIRC $B%5!<%P$K8GM-$NL>A0(B + +- server + IRC $B%5!<%P$NL>A0(B + +riece-identity $B%*%V%8%'%/%H$KE,MQ2DG=$JA`:n$K$O0J2<$N$h$&$J$b$N$,$"$j$^$9!#(B + +- riece-make-identity prefix &optional server + riece-identity $B%*%V%8%'%/%H$r?75,$K:n@.$7$^$9!#(Bserver $B0z?t$,>JN,$5$l$?(B + $B>l9g$K$O!"4X?t(B riece-find-server-name $B$G$r;H$$$^$9(B + +- riece-identity-prefix identity + riece-identity $B%*%V%8%'%/%H$+$i(B IRC $B%5!<%P$K8GM-$NL>A0$r@Z$j=P$7$^$9!#(B + +- riece-identity-server identity + riece-identity $B%*%V%8%'%/%H$+$i%5!<%P$NL>A0$r@Z$j=P$7$^$9!#(B + +- riece-identity-equal ident1 ident2 + 2 $B$D$N(B riece-identity $B%*%V%8%'%/%H$,F1Ey$G$"$k$+D4$Y$^$9!#(B + +- riece-identity-equal-no-server ident1 ident2 + 2 $B$D$N(B riece-identity $B%*%V%8%'%/%H$N!"(BIRC $B%5!<%P$K8GM-$NL>A0$,F1Ey$G$"(B + $B$k$+D4$Y$^$9!#(B + +- riece-identity-member elt list + riece-identity $B%*%V%8%'%/%H(B elt $B$,(B list $B$K4^$^$l$k$+D4$Y$^$9!#(B + +*** $B%A%c%s%M%k$H%f!<%6$N4IM}(B + +riece-identity $B%*%V%8%'%/%H$+$i@Z$j=P$5$l$?(B IRC $B%5!<%P$K8GM-$NL>A0!"$9(B +$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(B +$B$l(B riece-channel $B%*%V%8%'%/%H$H(B riece-user $B%*%V%8%'%/%H$G(B +$BI=8=$5$l$^$9!#(B + +**** riece-channel $B%*%V%8%'%/%H(B + +riece-channel $B$O%A%c%s%M%k$rI=$9%*%V%8%'%/%H$G!"0J2<$NMWAG$r;}$A$^$9!#(B + +- users + $B;22C$7$F$$$k%f!<%6$N%K%C%/%M!<%`$N%j%9%H(B + +- operators + $B%*%Z%l!<%?8"8B$r$b$D%f!<%6$N%K%C%/%M!<%`$N%j%9%H(B + +- speakers + $BH/8@8"$r$b$D%f!<%6$N%K%C%/%M!<%`$N%j%9%H(B + +- modes + $B%A%c%s%M%k$N%b!<%I(B + +- banned + MODE +b $B$G;XDj$5$l$?%Q%?!<%s$N0lMw(B + +- invited + MODE +I $B$G;XDj$5$l$?%Q%?!<%s$N0lMw(B + +- uninvited + MODE +e $B$G;XDj$5$l$?%Q%?!<%s$N0lMw(B + +**** riece-user $B%*%V%8%'%/%H(B + +riece-user $B$O!"(BIRC $B$K;22C$7$F$$$k%f!<%6$rI=$9%*%V%8%'%/%H$G!"0J2<$NMW(B +$BAG$r;}$A$^$9!#(B + +- channels + $B;22C$7$F$$$k%A%c%s%M%kL>$N%j%9%H(B + +- user-at-host + "@" $B$N7A$GM?$($i$l$k%f!<%6$N@\B3>pJs(B + +- modes + $B%f!<%6$N%b!<%I(B + +- away + $BN%@JCf$+$I$&$+(B + +**** Mediator $B%Q%?!<%s(B + +$B%A%c%s%M%k$X$N%f!<%6$N;22C!&N%C&$r4IM}$9$k$?$a$K!"(B riece-naming $B%b%8%e!<(B +$B%k$r;H$$$^$9!#(Briece-naming $B$O!"%G%6%$%s%Q%?!<%s$G$$$&$H$3$m$N(B Mediator +$B%Q%?!<%s$KAjEv$9$k$b$N$G$9!#(B + +riece-naming $B$r2p$9$k$3$H$G!"A0=R$N(B riece-channel, riece-user $B%*%V%8%'(B +$B%/%H$rD>@\A`:n$9$k$3$H$J$/!"0BA4$KL>A06u4V$K%"%/%;%9$9$k$3$H$,$G$-$^$9!#(B + +riece-naming $B$,Ds6!$9$kA0$,JQ99$5$l$?$3$H$rI=L@$7$^$9(B + +** $B%7%0%J%k(B + +$B%7%0%J%k$H$O!"2hLL$N:FIA2h$r8zN(NI$/9T$&$?$a$K!"%$%Y%s%H$HIA2hBP>]$N%*(B +$B%V%8%'%/%H(B($B%P%C%U%!$d!"%b!<%I%i%$%s$N0u(B)$B$r7k$SIU$1$k5!9=$G$9!#(B + +$B%&%#%s%I%&$N:FIA2h$rH<$&%$%Y%s%H$,H/@8$9$k$H!"%7%0%J%k$,Aw=P$5$l$^$9!#(B +$B%7%0%J%k$N35G0$O!"(BQt $B$d(B GTK+ $B$H$$$C$?0lHLE*$J(B GUI $B%D!<%k%-%C%H$KMQ0U$5(B +$B$l$F$$$k$b$N$HF1MM$G$9!#(B + +$B%7%0%J%k$rAw?.$9$k$K$O!"(Briece-emit-signal $B$r;H$$$^$9!#(B + +- riece-emit-signal signal-name &rest args + $B0z?t(B signal-name $B$G;X<($5$l$k%7%0%J%k$r!"0z?t(B args $B$H$H$b$KAw=P$7$^(B + $B$9(B + +$B%7%0%J%k$K1~Ez$9$k=hM}$O!"(Briece-connect-signal $B$r;H$C$FDj5A$7$^$9!#(B + +- riece-connect-signal signal-name slot-function &optional + filter-function handback + + $B0z?t(B signal-name $B$G;XDj$5$l$?%7%0%J%k$K1~Ez$9$k4X?t(B slot-function $B$r(B + $B@_Dj$7$^$9!#(Bslot-function $B$K;XDj$5$l$?4X?t$O(B 2 $B$D$N0z?t$rl9g$K$O!"(Bslot-function $B$OA0$rJV$7$^$9!#(B + +- riece-signal-args + $B%7%0%J%k$NAw?.;~$KM?$($i$l$?0z?t$rJV$7$^$9!#(B + +$B8=:_!"0J2<$N%7%0%J%k$,;HMQ$5$l$F$$$^$9!#(B + +- channel-list-changed + $B;22C$7$F$$$k%A%c%s%M%k$N0lMw$NJQ2=(B + +- user-list-changed + $B%A%c%s%M%k$N;22CA0$rJQ99(B + ($B0z?t$O!"0JA0$H8=:_$NL>A0$KAjEv$9$k(B riece-identity $B%*%V%8%'%/%H(B) + +- user-away-changed + $B%f!<%6$NN%@J>uBV$NJQ2=(B + ($B0z?t$O!"%f!<%6$KAjEv$9$k(B riece-identity $B%*%V%8%'%/%H(B) + +- user-operator-changed + $B%f!<%6$N%*%Z%l!<%?>uBV$NJQ2=(B + ($B0z?t$O!"%f!<%6$KAjEv$9$k(B riece-identity $B%*%V%8%'%/%H(B) + +- channel-topic-changed + $B%A%c%s%M%k$N%H%T%C%/$NJQ2=(B + ($B0z?t$O!"%A%c%s%M%k$KAjEv$9$k(B riece-identity $B%*%V%8%'%/%H(B) + +- channel-modes-changed + $B%A%c%s%M%k$N%b!<%I$NJQ2=(B + ($B0z?t$O!"%A%c%s%M%k$KAjEv$9$k(B riece-identity $B%*%V%8%'%/%H(B) + +- channel-operators-changed + $B%A%c%s%M%k$G%*%Z%l!<%?8"8B$r;}$D%f!<%6$N0lMw$NJQ2=(B + ($B0z?t$O!"%A%c%s%M%k$KAjEv$9$k(B riece-identity $B%*%V%8%'%/%H(B) + +- channel-speakers-changed + $B%A%c%s%M%k$GH/8@8"$r;}$D%f!<%6$N0lMw$NJQ2=(B + ($B0z?t$O!"%A%c%s%M%k$KAjEv$9$k(B riece-identity $B%*%V%8%'%/%H(B) + +- buffer-freeze-changed + $B%P%C%U%!$NE`7k>uBV$NJQ2=(B + ($B0z?t$O%P%C%U%!(B) + +** $B%"%I%*%s$N=q$-J}(B + +$B%"%I%*%s$N>r7o$rK~$?$9%b%8%e!<%k$O0J2<$N4X?t$rDs6!$7$^$9!#(B + +- <$B%b%8%e!<%kL>(B>-requires + $B0MB8$9$kB>$N%"%I%*%s(B($B%7%s%\%k$N%j%9%H(B)$B$rJV$7$^$9(B($B%*%W%7%g%s(B) + +- <$B%b%8%e!<%kL>(B>-insinuate + $B=i4|2==hM}$r9T$$$^$9(B + +$B$^$?!"%"%I%*%s$N4JC1$J@bL@$r!"JQ?t(B <$B%b%8%e!<%kL>(B>-description $B$K@_Dj$9(B +$B$k$HNI$$$G$7$g$&!#$3$NJ8;zNs$O(B C-c ^ (M-x riece-command-list-addons) +$B$K$h$k%"%I%*%s$N0lMw$GI=<($5$l$^$9!#(B + +$BM-8z2=!&L58z2=$KBP1~$7$?%"%I%*%s$O!"JQ?t(B <$B%b%8%e!<%kL>(B>-enabled $B$K8=:_(B +$B$N>uBV$rJ];}$7$^$9!#$3$NJQ?t$NCM$,(B nil $B$G$"$l$PL58z!"(Bt $B$G$"$l$PM-8z$G(B +$B$9!#2C$($F!"0J2<$N4X?t$rDs6!$7$^$9!#(B + +- <$B%b%8%e!<%kL>(B>-enable +$B%"%I%*%s$rM-8z$K$7$^$9(B + +- <$B%b%8%e!<%kL>(B>-disable +$B%"%I%*%s$rL58z$K$7$^$9(B + +Riece $B$O5/F0;~$K0J2<$N=hM}$r9T$$$^$9!#(B + +(1) $BJQ?t(B riece-addons $B$KNs5s$5$l$?%b%8%e!<%k$rFI$_9~$`(B + +(2) $B$=$l$>$l$N%b%8%e!<%k$KBP$7!"(B<$B%b%8%e!<%kL>(B>-requires $B$,MQ0U(B + $B$5$l$F$$$l$P8F$S=P$7!"0MB8%0%i%U$r:n$k(B + +(3) $B0MB8%0%i%U$KBP$7$F%H%]%m%8%+%k%=!<%H$r9T$&(B + +(4) $BF@$i$l$?0MB8=g=x$K=>$C$F(B <$B%b%8%e!<%kL>(B>-insinuate $B8F$S=P$9(B + +(5) $B$b$7!"%"%I%*%s$,M-8z2=!&L58z2=$KBP1~$7$F$*$j!"L@<(E*$KL58z2=$5$l$F(B + $B$$$J$1$l$P!"(B<$B%b%8%e!<%kL>(B>-enable $B$r8F$S=P$9!#(B + +$B:n@.$7$?%"%I%*%s$O!"(Bload-path $B$NDL$C$?%G%#%l%/%H%j$+!"(B +~/.riece/addons/ $B0J2<$KG[CV$9$k$HAH$_9~$_2DG=$J>uBV$K$J$j$^$9!#(B + +** $B%O%s%I%i%U%C%/(B + +Riece $B$K$O!"%O%s%I%i%U%C%/$H8F$P$l$kFCJL$J0UL#$r;}$D%U%C%/$,$"$j$^$9!#(B +$B%O%s%I%i%U%C%/$O(B IRC $B$N%a%C%;!<%8$r $B$r(B IRC $B$N%a%C%;!<%8$r>.J8;z$K$7$?$b$N$H$9$k$H!"%O%s%I%i%U%C(B +$B%/$O-hook + $B%a%C%;!<%8$,FO$$$?$H$-$K:G=i$K8F$P$l$k%U%C%/(B + +- riece-after--hook + $B%a%C%;!<%8$N=hM}$,=*$o$C$?8e$K8F$P$l$k%U%C%/(B + +$BNc$($P!"(BPRIVMSG $B$K4X$7$F$O!"(Briece-privmsg-hook, +riece-after-privmsg-hook $B$NFs$D$N%U%C%/$,8F$P$l$^$9!#(B + +$B$3$3$G(B riece--hook $B$NJV$jCM$K$O0UL#$,$"$j!"(Bt $B$rJV$9$b$N$,$"$l(B +$B$P!"$=$N8e$N=hM}$r$*$3$J$$$^$;$s!#$^$?!"$=$N>l9g$K$O(B +riece-after--hook $B$b8F$S=P$5$l$^$;$s!#(B + +$B%U%C%/$N0z?t$K$O(B RFC2812 $B$N(B prefix $B$H(B parameters $B$,EO$j$^$9!#(B \ No newline at end of file diff --git a/doc/Makefile.am b/doc/Makefile.am index 61a0e6b..77d585d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -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 diff --git a/doc/riece-ja.texi b/doc/riece-ja.texi index 1b06f13..b6fddc6 100644 --- a/doc/riece-ja.texi +++ b/doc/riece-ja.texi @@ -49,15 +49,16 @@ Free Documentation License". @node Top, Overview, (dir), (dir) @top Riece user's manual -Riece $B$O(B Emacs $B$G(B IRC (Internet Relay Chat) $B$K;22C$9$k$?$a$N%W%m%0%i%`$G$9!#(B +$B$3$N%^%K%e%"%k$G$O!"(BRiece $B%P!<%8%g%s(B @value{VERSION} $B$K$D$$$F2r@b$7$^$9!#(B +$B$3$N%^%K%e%"%k$G07$&HO0O$r1[$($?>pJs$O(B Riece $B$N8x<0%[!<%`%Z!<%8(B +@uref{http://www.nongnu.org/riece/} $B$+$iF@$i$l$k$+$b$7$l$^$;$s!#(B @menu -* Overview:: Riece $B$H$O2?$+(B -* Getting started:: +* Overview:: $B$O$8$a$KFI$s$G$M(B +* Getting started:: IRC $B%5!<%P$K@\B3$7$F2qOC$7$F$_$h$&(B * Basic usage:: $B4pK\E*$J;H$$J}(B * Advanced usage:: $B?J$s$@;H$$J}(B * Tips:: $BJXMx$J@_Dj(B -* Development:: $B3+H/pJs(B * Index:: * Function Index:: * Variable Index:: @@ -66,141 +67,97 @@ Riece $B$O(B Emacs $B$G(B IRC (Internet Relay Chat) $B$K;22C$9$k$?$a$N%W%m% @node Overview, Getting started, Top, Top @chapter Overview -Riece $B$O!"D9$$4V%a%s%F%J%s%9IT2DG=$J>uBV$K$"$C$?(B Liece $B$N%3!<%I$r40A4$K(B -$B=q$-D>$7$?$b$N$G$9!#%f!<%6%$%s%?!<%U%'!<%9$NBgItJ,$O(B Liece $B$N$b$N$rF'=1(B -$B$7$F$$$^$9!#(B +Riece $B$O(B IRC (Internet Relay Chat) $B$N@$3&$G%A%c%C%H$r3Z$7$`$?$a$N%f!<%6(B +$B%$%s%?!<%U%'!<%9$G$9!#(BRiece $B$O!V$j!<$9!W$HFI$_$^$9!#(B -Riece $B$K$O(B Liece $B$K$O$J$$FCD9$,$$$/$D$+$"$j$^$9!#(B -$B0J2<$K$=$l$i$N0lIt$r5s$2$^$9!#(B +Riece $B$N$N(B elisp $B%Q%C%1!<%8$K0MB8$7$J$$$?$a!"%$%s%9%H!<%k$,4JC1(B @item $B@_Dj$,4JC1$G!"A02s5/F0;~$N@_Dj$r5-O?!&I|85$9$k;EAH$_$rDs6!(B @item $BCJ3,E*$JA`:n@bL@=q$,ImB0(B @item $B:G?7$N(B IRC $B$N%/%i%$%"%s%H%W%m%H%3%k(B (RFC2812) $B$K=`5r(B @end itemize -$B$h$j>\$7$$>pJs$O!"0J2<$N%Z!<%8$r8fMw$/$@$5$$!#(B - -@itemize @bullet -@item http://www.nongnu.org/riece/ -@end itemize - @node Getting started, Basic usage, Overview, Top @chapter Getting started -@menu -* Required Environments:: $BF0:n4D6-(B -* Installation:: $B%$%s%9%H!<%kJ}K!(B -* Startup File:: $B@_Dj%U%!%$%k(B -@end menu +Riece $B$r5/F0$9$ke(B -@item XEmacs 21.4 $B0J>e(B -@end itemize +@item +@kbd{M-x riece} +@end enumerate -@node Installation, Startup File, Required Environments, Getting started -@section Installation +$B$b$7(B (1) $B$G(B @samp{Cannot open load file: riece} $B$N%(%i!<$,H/@8$9$k>l9g$K(B +$B$O%$%s%9%H!<%k$K<:GT$7$F$$$^$9!#<+J,$G%=!<%9$+$i%$%s%9%H!<%k$7$?>l9g$K$O(B +README $B$r$b$&0lEYFI$_D>$7$F$/$@$5$$!#(BOS$B!&%G%#%9%H%j%S%e!<%7%g%s$N%Q%C%1!<(B +$B%8$+$i%$%s%9%H!<%k$7$?>l9g$K$O!"%Q%C%1!<%8$K4^$^$l$kJ8=q$r$43NG'$/$@$5$$!#(B -Riece $B$N:G?7HG$O!"(B -@uref{http://wiliki.designflaw.org/riece.cgi} $B$GG[I[$7$F$$$^(B -$B$9!#E83+$7$?$i!"0J2<$N%3%^%s%I$rA0$rJ9$+$l$^$9!#8x6&$KMxMQ2DG=$J(B IRC +$B%5!<%P$N0lMw$O(B Web $B%Z!<%8$J$I$+$iF@$k$3$H$,$G$-$^$9!#(B -@example -./configure -make -make install -@end example +@itemize @bullet +@item http://irc.kyoto-u.ac.jp +@item http://freenode.net +@end itemize -XEmacs $B$N%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$9$k>l9g$K$O0J2<$N$h$&$K$7$^$9!#(B +$B$^$?!"0J2<$N$h$&$J%a%C%;!<%8$,I=<($5$l$k$+$b$7$l$^$;$s!#(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 $B$N%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$7$?>l9g$K$OI,MW$"$j$^$;$s$,!"(B -@kbd{M-x riece} $B$G5/F0$9$k$?$a$K$O!"(Bautoload $B$N@_Dj$r8f<+J,$N(B Emacs $B$N@_(B -$BDj%U%!%$%k$K2C$($kI,MW$,$"$j$^$9!#(B +IRC $B$G$O!";22CN$,;H$o$l(B +$B$^$9!#$b$74uK>$N%K%C%/%M!<%`$,B>$NC/$+$K;HMQ$5$l$F$$$k>l9g!"JL$N%K%C%/%M!<(B +$B%`$rA*$VI,MW$,$"$j$^$9!#(B -@lisp -(autoload 'riece "riece" "Start Riece" t) -@end lisp - -@node Startup File, , Installation, Getting started -@section Startup file - -$B$3$N>O$G$O!"@_Dj%U%!%$%k$K$D$$$F2r@b$7$^$9!#(B - -$B;n$7$K;H$C$F$_$k>l9g$K$O!"FC$K2?$b@_Dj$9$kI,MW$O$"$j$^$;$s!#(B -$B$3$N>O$OFI$_Ht$P$7$F$b9=$$$^$;$s!#(B +IRC $B%5!<%P$K@\B3$G$-$?$i!"A[E*$J2q5D<<$K;22C$7$F2qOC$r9T$J$$$^$9!#%A%c%s%M%k$KF~$k$K$O(B +@kbd{C-c j} $B$H%?%$%W$7$^$9!#;22C$9$k%A%c%s%M%kL>$r?R$M$i$l$?$i!"E,@Z$J%A%c(B +$B%s%M%kL>$rF~NO$7$^$7$g$&!#(BIRCnet $B$K$O(B @samp{#Riece} $B$H$$$&%A%c%s%M%k$,$"(B +$B$k$N$G!"%F%9%H$r$7$?$$>l9g$K$O<+M3$K$*;H$$$/$@$5$$!#(B -Riece $B$O@_Dj%U%!%$%k$rJQ?t(B @code{riece-directory} $B$G;X<($5$l$k%G%#%l%/%H(B -$B%j(B ($B%G%U%)%k%H$O(B @file{~/.riece/}) $B$+$iFI$_9~$_$^$9!#$3$N%G%#%l%/%H%j$K(B -$B$O0J2<$N(B 2 $B$D$N@_Dj%U%!%$%k$,G[CV$5$l$^$9!#(B +$B%A%c%s%M%k$KF~$k$H!"2<$N?^$K<($9$h$&$J(B 5 $B$D$N%&%#%s%I%&(B +@footnote{$B$^$.$i$o$7$$$G$9$,!"(BEmacs $B$N@$3&$G$O%P%C%U%!$rI=<($9$kNN0h$r%&%#(B +$B%s%I%&$H8F$S$^$9!#(B}$B$+$i$J$k2hLL$K@Z$jBX$o$j$^$9!#(B -@table @code -@item riece-saved-variables-file -@vindex riece-saved-variables-file -$BA02s$N%;%C%7%g%s$G99?7$5$l$?@_Dj$,<+F0E*$KJ]B8$5$l$^$9(B($B%G%U%)%k%H$O(B @file{~/.riece/save}) -@item riece-variables-file -@vindex riece-variables-file -$B%f!<%6$K8GM-$N@_Dj$r5-=R$7$^$9(B($B%G%U%)%k%H$O(B @file{~/.riece/init}) -@end table +@example ++-----+-----------------+ +| | | +| | | +| (1) | (2) | +| | | +| | | ++-----+-----------------+ +| | (4) | +| +-----------------+ +| (3) | | +| | (5) | +| | | ++-----+-----------------+ +@end example -$B5/F0;~$K$O!":G=i$K(B @code{riece-saved-variables-file} $B$r!"e=q$-$5$l$^$9!#(B +(4) $B$N%&%#%s%I%&$KI=<($5$l$k%P%C%U%!$KJ8>O$rF~NO$7$F%j%?!<%s%-!<$r2!$9$H(B +$BH/8@$G$-$^$9!#B>$N;22C$rJ9$+$l$k$N$GEz$($^$9!#(B -$B@\B32DG=$J(B IRC $B%5!<%P$O3F(B IRC $B%M%C%H%o!<%/Kh$K0[$J$j$^$9$,!"BgDq$O(B Web -$B%Z!<%8$K0lMw$,$^$H$a$F$"$k$3$H$,B?$$$G$7$g$&!#(B - -@itemize @bullet -@item http://irc.kyoto-u.ac.jp -@item http://freenode.net -@end itemize - -$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!#(B -$B%K%C%/%M!<%`$N=i4|CM$O(B @code{riece-nickname} $B$G@_Dj$7$^$9!#%G%U%)%k%H$G$O!"(B -$B%f!<%6$N%m%0%$%sL>$,$=$N$^$^;H$o$l$^$9!#(B -@vindex riece-nickname - -$BL5;v$K@\B3$G$-$?$i!"$r?R$M$i$l$k$N$G!"E,Ev$J%A%c(B -$B%s%M%kL>$rF~NO$7$^$7$g$&!#(BIRCnet $B$K$O(B @samp{#Riece} $B$H$$$&%A%c%s%M%k$,$"(B -$B$k$N$G!"%F%9%H$K$*;H$$$/$@$5$$!#(B - -$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(B -$B$k$3$H$,$G$-$^$9!#B>$N?M$N2qOC$O2hLL1&>e$N%P%C%U%!$KI=<($5$l$^$9!#(B - @menu * Windows:: $B2hLL9=@.(B * Indicators:: $B<+J,$N>uBV$NI=<((B * Commands:: $B%3%^%s%I$N0lMw(B -* Connecting to multiple servers:: $BJ#?t$N%5!<%P$K$D$J$0$K$O(B @end menu @node Windows, Indicators, Basic usage, Basic usage @section Windows -$B%G%U%)%k%H$N@_Dj$G$O!"%A%c%s%M%k$KF~$k$H!"2<$N?^$K<($9$h$&$J(B 5 $B$D$N%&%#%s(B -$B%I%&$+$i$J$k2hLL$K@Z$jBX$o$j$^$9!#(B - @example +-----+-----------------+ | | | @@ -217,59 +174,68 @@ Riece $B$O@_Dj%U%!%$%k$rJQ?t(B @code{riece-directory} $B$G;X<($5$l$k%G%#%l%/% +-----+-----------------+ @end example -$B$3$l$i$N3F%&%#%s%I%&$KI=<($5$l$k%P%C%U%!$NLr3d$O0J2<$NDL$j$G$9!#(B +$B3F%&%#%s%I%&$KI=<($5$l$k%P%C%U%!$NLr3d$O0J2<$NDL$j$G$9!#(B @enumerate @item -$B%f!<%6%j%9%H%P%C%U%!(B (@samp{*Users XXX*})$B!#%A%c%s%M%k$K$$$k%f!<%6$N0lMw(B -$B$,I=<($5$l$^$9!#(B +$B%f!<%6%j%9%H%P%C%U%!(B (@samp{ *Users*})$B!#%A%c%s%M%k$K;22C$7$F$$$k%f!<(B +$B%6$N%K%C%/%M!<%`$N0lMw$,I=<($5$l$^$9!#(B @item -$B%A%c%s%M%k%P%C%U%!(B (@samp{*Channel XXX*})$B!#%A%c%s%M%kFb$N2qOC$,I=<($5$l(B +$B%A%c%s%M%k%P%C%U%!(B (@samp{ *Channel:XXX*})$B!#%A%c%s%M%kFb$N2qOC$,I=<($5$l(B $B$^$9!#(B @item -$B%A%c%s%M%k%j%9%H%P%C%U%!(B (@samp{*Channels*})$B!#;22C$7$F$$$k%A%c%s%M%k$N0l(B -$BMw$,I=<($5$l$^$9!#(B +$B%A%c%s%M%k%j%9%H%P%C%U%!(B (@samp{ *Channels*})$B!#<+J,$,;22C$7$F$$$k%A%c%s%M(B +$B%k$N0lMw$,I=<($5$l$^$9!#(B @item -$B%3%^%s%I%P%C%U%!(B (@samp{*Commands*})$B!#J8>O$d%3%^%s%I$rAw?.$9$k$?$a$K;H$$(B +$B%3%^%s%I%P%C%U%!(B (@samp{*Command*})$B!#J8>O$d%3%^%s%I$rAw?.$9$k$?$a$K;H$$(B $B$^$9!#(B @item -$B%"%6!<%:%P%C%U%!(B (@samp{*Others*})$B!#8=:_$N%A%c%s%M%k0J30$N2qOC$,N.$l$^$9!#(B +$B%"%6!<%:%P%C%U%!(B (@samp{ *Others*})$B!#8=:_A*BrCf$N%A%c%s%M%k0J30$N2qOC$,N.(B +$B$l$^$9!#(B @end enumerate @node Indicators, Commands, Windows, Basic usage @section Indicators -$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!"(B -$B<+J,$N8=:_$N>uBV$r<($90u$,I=<($5$l$^$9!#(B +$B%b!<%I%i%$%s$N:8C<$K$O!"8=:_$N<+J,$N>uBV$r<($90u$,I=<($5$l$^$9!#(B +@footnote{$B$b$72hA|$rI=<($G$-$k(B Emacs $B$r$*;H$$$J$i!":8C<$K(B "R" $B$N%"%$%3%s(B +$B$,I=<($5$l$^$9!#(B} @example -Riece: --- ueno #Riece [n] +Riece: ---- ueno #Riece [n] @end example -$B$3$3$G!"(B@samp{---} $B$NItJ,$K$O:8$+$i=g$K0J2<$N0UL#$,$"$j$^$9!#(B +$B$3$3$G!"(B@samp{----} $B$NItJ,$K$O:8$+$i=g$K0J2<$N0UL#$,$"$j$^$9!#(B @enumerate @item $BN%@J>uBV(B ($BN%@J$7$F$$$l$P(B @samp{A}) @item -$B%*%Z%l!<%?>uBV(B (IRC $B%*%Z%l!<%?$G$"$l$P(B @samp{O}) +IRC $B%*%Z%l!<%?>uBV(B (IRC $B%M%C%H%o!<%/$N4IM}uBV(B -($B40A4$K6X;_$7$F$$$l$P(B @samp{F}$B!"<+J,$NuBV(B ($B%A%c%s%M%k$N4IM}O$rF~NO$7$?%P%C%U%!$O!"%3%^%s%I%P%C%U%!$H8F$P$l!"%3%^%s%I%P%C%U%!$+$i(B -$B$OMM!9$J%3%^%s%I$rH/9T$9$k$3$H$,$G$-$^$9!#0J2<$K0lIt$r5s$2$^$9!#(B +@ref{Basic usage}$B$GJ8>O$rF~NO$7$?%P%C%U%!$O%3%^%s%I%P%C%U%!$H8F$P$l$^$9!#(B +$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(B +$B$,$G$-$^$9!#0J2<$K0lIt$r5s$2$^$9!#(B + +$B:G=i$O$J$+$J$+3P$($K$/$$$G$9$,!"(B@kbd{C-h b} + (@kbd{M-x describe-bindings}) $B$G;HMQ2DG=$J%-!/$7$:$D3P$($F$$$/$HNI$$$G$7$g$&!#(B @subsection IRC commands @table @kbd @@ -320,47 +286,44 @@ IRC $B$r$d$a$^$9(B(@code{riece-command-quit}) $B%A%c%s%M%k$N%b!<%I$r@_Dj$7$^$9(B(@code{riece-command-change-mode}) @item C-c o @findex riece-command-set-operators -$B%f!<%6$K%*%Z%l!<%?8"8B$rM?$($^$9!#A0CV0z?t(B (@kbd{C-u}) $B$rM?$($k$H!"%f!<%6$+$i%*%Z%l!<%?8"8B$rC%$$$^$9(B(@code{riece-command-set-operators}) +$B%f!<%6$K%A%c%s%M%k$N4IM}\:Y$J>pJs$rI=<($7$^$9!#(B +Riece $B$N%P!<%8%g%s$rI=<($7$^$9!#(B(@kbd{C-u C-c V}) $B$G!"$h$j>\:Y$J>pJs$rI=<($7$^$9!#(B @item C-c / @findex riece-command-raw -$B@8$N(B IRC $B%3%^%s%I$rAw$j$^$9(B(@code{riece-command-raw}) +IRC $B%3%^%s%I$rD>@\Aw$j$^$9(B(@code{riece-command-raw}) @end table @subsection Window manipulating commands @table @kbd @item C-c r @findex riece-command-configure-windows -$B%&%#%s%I%&$r:FIA2h$7$^$9(B(@code{riece-command-configure-windows}) -@item C-c C-j +$B%U%l!<%`A4BN$r:FIA2h$7$^$9(B(@code{riece-command-configure-windows}) +@item C-c C-j $B$^$?$O(B C-c > @findex riece-command-next-channel -$B -@findex riece-command-next-channel -$BeC<$^$G0\F0$7$^$9(B(@code{riece-command-beginning-of-buffer}) +$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$r>eC<$^$G%9%/%m!<%k$7$^$9(B(@code{riece-command-beginning-of-buffer}) @item C-c $ @findex riece-command-end-of-buffer -$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$N%S%e!<$r2eJ}8~$K%9%/%m!<%k$7$^$9(B(@code{riece-command-scroll-up}) @@ -382,103 +345,85 @@ Riece $B$N%P!<%8%g%s$rI=<($7$^$9!#A0CV0z?t(B (@kbd{C-u}) $B$rM?$($k$H!"$h$j>\ $B%f!<%6%j%9%H%P%C%U%!$NI=<(!&HsI=<($r@Z$jBX$($^$9(B(@code{riece-command-toggle-user-list-buffer-mode}) @item C-c C-t f @findex riece-command-toggle-freeze -$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$rE`7k(B($B%9%/%m!<%k$r6X;_(B)$B$7$^(B +$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$N<+F0%9%/%m!<%k$r6X;_$7$^(B $B$9(B(@code{riece-command-toggle-freeze}) @item C-c C-t o @findex riece-command-toggle-own-freeze -$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$r!"<+J,$,H/8@$9$k$^$GE`7k$7(B -$B$^$9(B(@code{riece-command-toggle-own-freeze}) +$B%A%c%s%M%k%P%C%U%!!"$^$?$O%@%$%"%m%0%P%C%U%!$r!"<+J,$,H/8@$9$k$^$G!"<+F0(B +$B%9%/%m!<%k$r6X;_$7$^$9(B(@code{riece-command-toggle-own-freeze}) @item C-c C-t a @findex riece-command-toggle-away $B<+J,$NN%@J>uBV$r@Z$jBX$($^$9(B(@code{riece-command-toggle-away}) @end table -@node Connecting to multiple servers, , Commands, Basic usage -@section Connecting to multiple servers - -Riece $B$NBg$-$JFCD9$K!"J#?t$N%5!<%P$KF1;~$K@\B3$9$k5!G=$,$"$j$^$9!#(B - -$B?7$?$J%5!<%P$K@\B3$7!"$=$N%5!<%P>e$N%A%c%s%M%k$K;22C$9$k$rJ9$+$l$k$N$GEz$($^$9!#(B - -@item -@kbd{C-c j} (@code{riece-command-join}) $B$G%A%c%s%M%k$K;22C$7$^$9!#$3$3$G!"(B -$B%A%c%s%M%kL>$N8e$K6uGr$G6h@Z$C$F%5!<%PL>$rB3$1$^$9!#6uGr$rF~NO$9$k$K$O!"(B -@kbd{C-q} $B$r;H$$$^$9!#$?$H$($P!"%5!<%P(B @samp{irc6} $B>e$N(B @samp{#Riece} $B$K;22C$9$k$K$O(B @kbd{C-c j #Riece C-q SPC irc6} $B$H%?%$%W$9$k$3$H$K$J$j$^$9!#(B -@end enumerate - -$B%A%c%s%M%k$KF~$i$:$K%3%^%s%I$rAw$k$K$O!"(B@kbd{C-c M} -(@code{riece-command-universal-server-name-argument}) $B$,JXMx$G$9!#(B - -$B%5!<%P$H$N@\B3$K4X$9$k%3%^%s%I$O0J2<$NDL$j$G$9!#(B - -@table @kbd -@item C-c O -@findex riece-command-open-server -$BJL$N%5!<%P$K@\B3$7$^$9(B(@code{riece-command-open-server}) -@item C-c C -@findex riece-command-close-server -$B%5!<%P$H$N@\B3$r@ZCG$7$^$9(B(@code{riece-command-close-server}) -@item C-c M -@findex riece-command-universal-server-name-argument -$BFCDj$N%5!<%P$KBP$7$F!"B3$/%3%^%s%I$rH/9T$7$^$9(B(@code{riece-command-universal-server-name-argument}) -@end table - @node Advanced usage, Tips, Basic usage, Top @chapter Advanced usage $B$3$N>O$G$O!"$b$C$H?J$s$@;H$$J}$r2r@b$7$^$9!#(B @menu +* Startup File:: $B@_Dj%U%!%$%k(B * Server settings:: $B%5!<%P$N>\:Y@_Dj(B +* Connecting to multiple servers:: $BF1;~$KJ#?t$N%5!<%P$K@\B3$9$k$K$O(B * Add-ons:: $B%"%I%*%s$H$O(B @end menu -@node Server settings, Add-ons, Advanced usage, Advanced usage +@node Startup File, Server settings, Advanced usage, Advanced usage +@section Startup file + +$B$3$N>O$G$O!"@_Dj%U%!%$%k$K$D$$$F2r@b$7$^$9!#(BRiece $B$N@_Dj$O(B Emacs $B$N@_Dj(B +$B%U%!%$%k$K=q$$$F$bNI$$$G$9$,!"(BRiece $B$K8GM-$N@_Dj$O$J$k$Y$/(B +@file{~/.riece/init} $B$K=q$/$3$H$r4+$a$^$9!#(B + +$B$^$?!"(BRiece $B$r;H$$;O$a$k$H(B @file{~/.riece/save} $B$H$$$&%U%!%$%k$,:n@.$5$l(B +$B$^$9!#$3$N%U%!%$%k$K$OA02s5/F0;~$N@_Dj$N0lIt(B($B%&%#%s%I%&9=@.Ey(B)$B$,<+F0E*$K(B +$BJ]B8$5$l$^$9!#(B + +$B5/F0;~$K$O!":G=i$K(B @file{~/.riece/save} $B$r!"e=q$-$5$l$^$9!#(B + +@node Server settings, Connecting to multiple servers, Startup File, Advanced usage @section Server settings -$B5/F0;~$K%G%U%)%k%H$G@\B3$9$k(B IRC $B%5!<%P$O(B @code{riece-server} $B$G;XDj$7$^$9!#(B +$B5/F0;~$K@\B3$9$k(B IRC $B%5!<%P$NL>A0$OJQ?t(B @code{riece-server} $B$G;XDj$7$^$9!#(B @vindex riece-server -$B$3$3$G(B @code{riece-server} $B$OJ8;zNs$G$"$j!"$=$N%U%)!<%^%C%H$O(B>:<$B%]!<%HHV9f(B>[:<$B%Q%9%o!<%I(B>]" +<$B%5!<%P$N%[%9%HL>(B>:<$B%]!<%HHV9f(B>[:<$B%Q%9%o!<%I(B>] @end example -@code{riece-server-alist} $B$rE,@Z$K@_Dj$9$k$H!"%-!<%o!<%I$r;H$C$F!"$h$j>\(B -$B:Y$J;XDj$,2DG=$K$J$j$^$9!#0J2<$OI.$G(B @samp{irc6.nara.wide.ad.jp} $B$K@\B3(B +@samp{foo} $B$H$$$&L>A0$N(B IRC $B%5!<%P$N%[%9%HL>$O(B @samp{irc.example.com} $B$G!";HMQ$9$kJ8;z%3!<%I$O(B Shift_JIS @item -@samp{plum} $B$H$$$&N,5-L>$G(B @code{relay-open-network-stream} $B$rDL$8$F(B (SSH $B7PM3$G(B) $B@\B3(B +@samp{bar} $B$H$$$&L>A0$N(B IRC $B%5!<%P$N%[%9%HL>$O(B @samp{irc.example.com} $B$G!"$3$N%5!<%P$G$O%K%C%/%M!<%`(B @samp{baz} $B$r;H$&(B @end itemize -$B;XDj2DG=$J%-!<%o!<%I$O0J2<$NDL$j$G$9!#(B +$B;XDj$G$-$k%-!<%o!<%I$N0lMw$O0J2<$NDL$j$G$9!#(B @table @code @item :host $B%5!<%P$N%[%9%HL>$^$?$O(B IP $B%"%I%l%9(B @item :service -$B%5!<%P$N%5!<%S%9L>$^$?$O%]!<%HHV9f(B ($B%G%U%)%k%H$O(B 6667) +$B%5!<%P$N%5!<%S%9L>$^$?$O%]!<%HHV9f(B @item :nickname $B@\B3;~$N%K%C%/%M!<%`(B @item :username @@ -488,10 +433,39 @@ Riece $B$NBg$-$JFCD9$K!"J#?t$N%5!<%P$KF1;~$K@\B3$9$k5!G=$,$"$j$^$9!#(B @item :function $B@\B3MQ4X?t(B @item :coding -$B%3!<%G%#%s%0%7%9%F%`(B ($B%G%U%)%k%H$O(B @code{riece-default-coding-system} $B$NCM(B) +$BJ8;z%3!<%I(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 + +$BF1;~$KJ#?t$N%5!<%P$K@\B3$9$kuBV$G!"JL$N%5!<%P$K@\B3$9$k$K$O(B @kbd{C-c O} (@code{riece-command-open-server}) $B$r;H$$$^$9!#(B + +$BJL$N%5!<%P>e$N%A%c%s%M%k$K;22C$9$k$K$O!"(B@kbd{C-c j} (@code{riece-command-join})$B$G%A%c%s%M%kL>$K%5!<%PL>$rB3$1$^$9!#(B + +$B$?$H$($P!"%5!<%P(B @samp{irc.freenode.net} $B>e$N(B @samp{#Riece} $B$O2A(B @end table $B$3$l$i$N$&$A!"(B@samp{riece-highlight} $B$H(B @samp{riece-ctcp}$B!"(B @samp{riece-url}$B!"(B @samp{riece-unread}$B!"(B @samp{riece-guess}$B!"(B @samp{riece-history}$B!"(B @samp{riece-button}$B!"(B@samp{riece-menu}$B!"(B @samp{riece-ignore}$B!"(B@samp{riece-log}$B!"(B@samp{riece-alias}$B!"(B -@samp{riece-ctlseq}$B!"(B@samp{riece-keyword} $B$O%G%U%)%k%H$GAH$_9~$^$l$F$$$^$9!#(B +@samp{riece-ctlseq}$B!"(B@samp{riece-keyword} $B$OI8=`$GAH$_9~$^$l$F$$$^$9!#(B $B%"%I%*%s$rAH$_9~$`$K$O(B @code{riece-addons} $B$r@_Dj$7$^$9!#$?$H$($P(B -@samp{riece-alias} $B$rAH$_9~$`>l9g$K$O!"(B@file{~/.riece/init.el} $B$K0J2<$N$h(B +@samp{riece-alias} $B$rAH$_9~$`>l9g$K$O!"(B@file{~/.riece/init} $B$K0J2<$N$h(B $B$&$K5-=R$7$^$9!#(B @vindex riece-addons @example -(add-to-list 'riece-addons 'riece-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 -$B$3$N>O$G$O!"$h$/J9$+$l$kR2p$7$^$9!#(B - -@section $B%A%c%s%M%kL>!V(B#$B$[$2(B:*.jp$B!W$r!V(B%$B$[$2!W$HN,5-$7$?$$(B - -$B0J2<$N9T$r(B @file{~/.riece/init.el} $B$KDI2C$7$^$9!'(B - -@example -(add-to-list 'riece-addons 'riece-alias) -@end example +$B$3$N>O$G$O!"$h$/J9$+$l$kR2p$7$^$9!#(B -@section $BD>A0$K$$$?%A%c%s%M%k$KLa$j$?$$(B +@section $BD>A0$KA*Br$7$F$$$?%A%c%s%M%k$K0\F0$7$?$$(B @vindex riece-guess-channel-try-functions -$B0J2<$N9T$r(B @file{~/.riece/init.el} $B$KDI2C$9$k$3$H$G!"(B -@kbd{C-c g} $B$GMzNr$rC)$j$D$D0\F0$G$-$^$9!#(B +$B0J2<$N9T$r(B @file{~/.riece/init} $B$KDI2C$9$k$3$H$G!"(B@kbd{C-c g} $B$GMzNr$rC)(B +$B$j$D$D0\F0$G$-$^$9!#(B@samp{riece-guess} $B%"%I%*%s$O!"%A%c%s%M%kA*Br$NMzNr(B +$B$dL$FI%a%C%;!<%8$NM-L5$J$I$+$i~$rM^@)$7$?$$(B +@section $BAu>~$rM^@)$7$?$$(B -@code{riece-addons} $B$+$i!"?'IU$1(B (@samp{riece-highlight})$B!"%\%?%s(B -(@samp{riece-button})$B!"%"%$%3%s(B (@samp{riece-icon}) $B$r=|$-$^$9!#(B +@code{riece-addons} $B$+$iAu>~$N$?$a$N%"%I%*%s$r=|30$7$^$9!#(B +$BDL>oM-8z$K$J$C$F$$$kAu>~$N$?$a$N%"%I%*%s$Ol9g$O(B,$B0J2<$N@_Dj$r(B @file{~/.riece/init.el} $B$K2C$($k$3$H$G(B, -"$B$[$2(B" $B$d(B "$B$U$,(B" $B$KH?1~$7$F2;$rLD$i$9$3$H$,$G$-$^$9!#(B - -@example -(defun cuckoo () - "play cuckoo.au" - (call-process "play" nil 0 t - ".../cuckoo.au")) - (setq riece-keywords '("$B$[$2(B" "$B$U$,(B")) - (add-hook 'riece-keyword-notify-functions - (lambda (keyword message) (cuckoo))) -@end example +@section $BFCDj$NJ8;zNs$rl9g$O!"0J2<$N@_Dj$r(B -@file{~/.riece/init.el} $B$K2C$($^$9!#(B +$B0J2<$N@_Dj$r(B @file{~/.riece/init} $B$K2C$($^$9!#(B@samp{riece-keywords} $B%"%I(B +$B%*%s$r;H$&$HFCDj$NJ8;zNs$rl9g$O(B,$B0J2<$N@_Dj$r(B @file{~/.riece/init.el} $B$K2C$($k$3$H$ (lambda (keyword message) (ding))) @end example -@section SKK $B$r;H$C$F$$$F!"JQ49%b!<%I$N0u(B ($B"&(B) $B$rAw?.$7$?$/$J$$(B +@section SKK $B$r;H$C$F$$$F!"JQ49Cf$N0u(B ($B"&(B) $B$rAw?.$7$F$7$^$&$3$H$,$"$k(B -$B0J2<$N9T$r(B @file{~/.riece/init.el} $B$KDI2C$7$^$9!'(B +$B0J2<$N9T$r(B @file{~/.riece/init} $B$KDI2C$7$^$9!#(B @example (add-to-list 'riece-addons 'riece-skk-kakutei) @end example -@section $B%A%c%s%M%k$NHV9f$r8GDj$7$?$$(B +@section $B%A%c%s%M%k0lMw$NJB$S=g$r8GDj$7$?$$(B @vindex riece-default-channel-binding -$B0J2<$N9T$r(B @file{~/.riece/init.el} $B$KDI2C$7$^$9!'(B +$B0J2<$N9T$r(B @file{~/.riece/init} $B$KDI2C$7$^$9!#(B @example (setq riece-default-channel-binding '("#Riece" "#emacsen" nil "#debianjp")) @end example -1: #Riece, 2: #emacsen, 4: #debianjp $B$N$h$&$K3dEv$F$i$l$^$9!#(Bnil $B$O%G%U%)(B -$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$?(B -$B>l9g!"$=$N%A%c%s%M%k$,(B 3 $BHVL\$N%A%c%s%M%k$H$7$F07$o$l$^$9!#(B +$B$3$N@_DjNc$G$O!"%A%c%s%M%k0lMw$NJB$S=g$Ol9g!"$=$N%A%c%s%M%k$,(B 3 $BHVL\$N0LCV$K3dEv$F$i$l$^$9!#(B -@section $B5/F0;~$K%Q%9%o!<%I$D$-$N%A%c%s%M%k$K;22C$7$?$$(B +@section $B5/F0;~$K<+F0E*$K%A%c%s%M%k$K;22C$7$?$$(B @vindex riece-startup-channel-list -@vindex riece-startup-server-list -$B0J2<$N9T$r(B @file{~/.riece/init.el} $B$KDI2C$7$^$9!'(B +$BJQ?t(B @samp{riece-startup-channel-list} $B$r@_Dj$7$^$9!#(B @example (setq riece-startup-channel-list - '(("#secret" "password") "#Riece")) + '("#Riece" "#public")) @end example -$BJ#?t$N%5!<%P>e$N%A%c%s%M%k$K;22C$9$k$K$O!"(B -@code{riece-startup-server-list} $B$bJ;$;$F@_Dj$9$kI,MW$,$"$j$^$9!#(B +$B$3$N@_DjNc$O!"(B@samp{#Riece} $B$H(B @samp{#public} $B$K;22C$9$k$3$H$r0UL#$7$F$$(B +$B$^$9!#%A%c%s%M%k$K;22C$9$k:]$K%Q%9%o!<%I$,I,MW$J>l9g$K$Ol9g$K$O!"(B +$BJQ?t(B @samp{riece-startup-server-list} $B$bF1;~$K@_Dj$9$kI,MW$,$"$j$^$9!#(B + +@section $B5/F0;~$K<+F0E*$KJ#?t$N(B IRC $B%5!<%P$K@\B3$7$?$$(B +@vindex riece-startup-server-list + +$BJQ?t(B @samp{riece-startup-server-list} $B$r@_Dj$7$^$9!#(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 -$B$3$N>l9g!"%G%U%)%k%H$G$O(B "ircnet" $B$@$1$K@\B3$7$^$9$,!"(B -@code{riece-startup-server-list} $B$r0J2<$N$h$&$K@_Dj$9$k$3$H$G!"(B +$B$3$N@_DjNc$G$O!"5/F0;~$K(B "ircnet" $B$K@\B3$7$^$9!#(B +@samp{riece-startup-server-list} $B$r0J2<$N$h$&$K@_Dj$9$k$H!"(B "freenode" $B$K$b@\B3$9$k$h$&$K$J$j$^$9!#(B @example (setq riece-startup-server-list '("freenode")) @end example -@section HTTP $B%W%m%-%71[$7$K(B IRC $B%5!<%P$K@\B3$7$?$$(B -relay.el $B$H(B connect.c $B$r;H$&$H!"(B +$B5/F0;~$K!"J#?t$N(B IRC $B%5!<%P$N%A%c%s%M%k$K;22C$9$k>l9g$K$O!"(B +$BJQ?t(B @samp{riece-startup-channel-list} $B$bF1;~$K@_Dj$9$kI,MW$,$"$j$^$9!#(B + +@section HTTP $B%W%m%-%7$r2p$7$F(B IRC $B%5!<%P$K@\B3$7$?$$(B +@file{relay.el} $B$H(B @file{connect.c} $B$r;H$&$H!"(B HTTP $B%W%m%-%7$r2p$7$F(B IRC $B%5!<%P$K@\B3$9$k$3$H$,$G$-$^$9!#(B @table @asis @@ -726,8 +707,9 @@ HTTP $B%W%m%-%7$r2p$7$F(B IRC $B%5!<%P$K@\B3$9$k$3$H$,$G$-$^$9!#(B @uref{http://www.taiyo.co.jp/~gotoh/ssh/connect.html} @end table -$B$?$H$($P!"(B"proxy.example.com:8080" $B7PM3$G(B irc.tokyo.wide.ad.jp $B$K@\B3$9(B -$B$k>l9g$K$O!"0J2<$N9T$r(B @file{~/.riece/init.el} $B$KDI2C$7$^$9!'(B +$B$?$H$($P!"(B@samp{proxy.example.com:8080} $B7PM3$G(B +@samp{irc.tokyo.wide.ad.jp} $B$K@\B3$9$k>l9g$K$O!"0J2<$N9T$r(B +@file{~/.riece/init} $B$KDI2C$7$^$9!#(B @example (require 'relay) @@ -740,444 +722,31 @@ HTTP $B%W%m%-%7$r2p$7$F(B IRC $B%5!<%P$K@\B3$9$k$3$H$,$G$-$^$9!#(B riece-server-alist)) @end example -@section IRC $B%m%0$r%U%!%$%k$KJ]B8$7$?$$(B +@section $B2qOC$N%m%0$r%U%!%$%k$KJ]B8$7$?$$(B @vindex riece-log-directory-map -$B0J2<$N9T$r(B @file{~/.riece/init.el} $B$KDI2C$7$^$9!'(B - -@example -(add-to-list 'riece-addons 'riece-log) -@end example +@samp{riece-log} $B%"%I%*%s$r;H$&$H!"2qOC$N%m%0$r%U%!%$%k$KJ]B8$7!":F5/F0(B +$B;~$K;2>H$G$-$^$9!#(B@samp{riece-log} $B%"%I%*%s$OI8=`$GAH$_9~$^$l$F$$$^$9!#(B -$B%m%0%U%!%$%k$O%G%U%)%k%H$G$O(B @file{~/.riece/log} $B$N2<$K%5!<%PL>!"%A%c%s(B -$B%M%kL>$N%G%#%l%/%j$,:n@.$5$l!"$=$NCf$KF|$K$AKh$KJ]B8$5$l$^$9!#$?$@$7%G%U%)(B -$B%k%H$N%5!<%P$N>l9g$O!"%5!<%PL>$N%G%#%l%/%H%j$O>JN,$5$l$^$9!#(B +$BDL>o$O(B @file{~/.riece/log} $B$N2<$K(B IRC $B%5!<%P$NL>A0!"%A%c%s%M%kL>$N%G%#%l(B +$B%/%j$,:n@.$5$l!"$=$NCf$KF|$K$AKh$KJ,JL$5$l$FJ]B8$5$l$^$9!#(B -US-ASCII $B0J30$N%G%#%l%/%H%jL>$,J8;z2=$1$9$k$H$$$&?M$O!"(B +$B%G%#%l%/%H%jL>$,J8;z2=$1$9$k>l9g$K$O!"(B @code{file-name-coding-system} $B$NCM$rE,@Z$K@_Dj$9$k$+!"$"$k$$$O(B -@code{riece-log-directory-map} $B$G%A%c%s%M%kL>$HJ]B8@h$N%G%#%l%/%H%jL>$H(B -$B$NBP1~%j%9%H$r0J2<$NNc$N$h$&$K!"(BUS-ASCII $B$N$_$r;HMQ$7$?%G%#%l%/%H%jL>$K(B -$B$J$k$h$&$K@_Dj$9$k;v$G2sHr=PMh$^$9!'(B +@code{riece-log-directory-map} $B$r;H$C$F%A%c%s%M%kL>$r(B US-ASCII $BJ8;zNs$K(B +$BJQ49$9$kI,MW$,$"$j$^$9!#(B @example (setq riece-log-directory-map '(("#$B$j!<$9(B" . "riece"))) @end example -@node Development, Index, Tips, Top -@chapter Development - -$B3+H/(B>]" $B%P%C%U%!$K>C$5$l$:(B -$B$K;D$j$^$9!#(B -@vindex riece-debug - -@node Modules, Namespace management, Debugging, Development -@section Modules - -$B4pK\E*$K0MB84X78$N>e0L$K$"$k$b$N$+$i!'(B - -@table @samp -@item riece-globals -$BBg0hJQ?t$NDj5A(B -@item riece-options -$B%f!<%6%*%W%7%g%s$NDj5A(B -@item riece-version -$B%P!<%8%g%s$NDj5A(B -@item riece-coding -$B%3!<%G%#%s%0%7%9%F%`4XO"$N4X?t$NDj5A(B -@item riece-complete -$B%_%K%P%C%U%!$G$NJd40$r=u$1$k4X?t$NDj5A(B -@item riece-addon -$B%"%I%*%s4IM}(B - -@item riece-mode -channel/user $B$N%b!<%I4IM}(B -@item riece-identity -channel/user object $B$NBg0hI=5-$rA`:n$9$k4X?t$NDj5A(B -@item riece-channel -channel object $B4XO"$NDj5A(B -@item riece-user -user object $B4XO"$NDj5A(B - -@item riece-misc -$B;(B?$J4X?t$NDj5A(B -@item riece-signal -$B%7%0%J%k(B(@pxref{Signals})$B4IM}(B - -@item riece-layout -$B%&%#%s%I%&%l%$%"%&%H4IM}(B -@item riece-display -$BI=<(MQ%P%C%U%!$N4IM}(B -@item riece-server -IRC$B%5!<%P$H$N@\B34IM}(B - -@item riece-naming -$BL>A04IM}$N$?$a$N(B mediator $B$N$h$&$J$b$N(B -@item riece-message -message object $B4XO"$NDj5A(B - -@item riece-filter -$B%W%m%;%9%U%#%k%?$N%(%s%H%j%]%$%s%H(B -@item riece-handle -$BDL>o$N%a%C%;!<%8$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B -@item riece-000 -000$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B -@item riece-200 -200$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B -@item riece-300 -300$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B -@item riece-400 -400$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B -@item riece-500 -500$BHVBf$N(B numeric reply $B$N%O%s%I%i!#(Briece-filter $B$+$i8F$P$l$k(B - -@item riece-commands -$B%3%^%s%I$NDj5A(B -@item riece-irc -IRC $B%W%m%H%3%k%$%s%?!<%U%'!<%9(B -@item riece -$B%(%s%H%j%]%$%s%H!#3F%P%C%U%!$N%b!<%IDj5A$J$I(B -@end table - -@node Namespace management, Signals, Modules, Development -@section Namespace management - -Riece $B$OJ#?t$N%5!<%P$KF1;~$K@\B3$9$k$?$a!"%5!<%PKh$KJL!9$NL>A06u4V$r4IM}(B -$B$7$F$$$^$9!#$3$NL>A06u4V$K$O!"%5!<%P$N%W%m%;%9$K7k$SIU$1$i$l$?%P%C%U%!$N(B -$B%m!<%+%kJQ?t$r2p$7$F%"%/%;%9$7$^$9!#(B - -@subsection Obtaining server buffer -$B%5!<%P$N%W%m%;%9$rF@$k$K$O!"$^$:$O$8$a$K%5!<%P$NL>A0$rF@$kI,MW$,$"$j(B -$B$^$9!#%5!<%P$NL>A0$O0J2<$K5s$2$k$$$/$D$+$NJ}K!$G(B($B8e=R(B) -@end enumerate - -$B$3$&$7$FF@$?%5!<%PL>$G(B @code{riece-server-process} $B$r8F=P$7!"%5!<%P$N(B -$B%W%m%;%9$rl9g!"%A%c%s%M%kL>$d%K%C%/$r(B($B%5!<%P$N%P%C%U%!>e$@(B -$B$1$G$O$J$/(B)$BBg0hE*$K6hJL$9$kI,MW$,@8$8$^$9!#$3$N$h$&$JL>A0$rI=8=$9$k$N(B -$B$,(B @samp{riece-identity} $B%*%V%8%'%/%H$G$9!#(B - -@samp{riece-identity} $B%*%V%8%'%/%H$O0J2<$N(B 2 $B$D$NMWAG$r$b$D%Y%/%?!<$G$9!#(B - -@table @samp -@item prefix -$B%5!<%P%m!<%+%k$JL>A0(B -@item server -$B%5!<%P$NL>A0(B -@end table - -@samp{riece-identity} $B%*%V%8%'%/%H$KBP$9$kA`:n$K$O0J2<$N$h$&$J$b$N$,$"$j$^$9!#(B - -@defun riece-make-identity prefix &optional server -@samp{riece-identity} $B%*%V%8%'%/%H$r:n@.$7$^$9!#(Bserver $B$,>JN,$5$l$?>l9g$K$O!"(B -riece-find-server-name $B$r;H$C$F$r;H$$$^$9(B -@end defun - -@defun riece-identity-prefix identity -@samp{riece-identity} $B%*%V%8%'%/%H$+$i%5!<%P%m!<%+%k$JL>A0$rA0$rA0$,F1Ey$+(B -$BD4$Y$^$9!#(B -@end defun - -@defun riece-identity-member elt list -@samp{riece-identity} $B%*%V%8%'%/%H(B @var{elt} $B$,(B @var{list} $B$K4^$^$l$k(B -$B$+8!::$7$^$9!#(B -@end defun - -@subsection Channel and user management -@samp{riece-identity} $B%*%V%8%'%/%H$K$h$C$F<1JL$5$l$k(B IRC $B$N%A%c%s%M%k(B -$B$H%f!<%6$O$=$l$>$l(B @samp{riece-channel} $B%*%V%8%'%/%H$H(B -@samp{riee-user} $B%*%V%8%'%/%H$K$h$jI=8=$5$l$^$9!#(B - -@subsubsection Channels -@code{riece-channel} $B$O!"(BIRC $B$N%A%c%s%M%k$rI=$9%*%V%8%'%/%H$G$9!#0J2<$N(B -$BMWAG$r;}$A$^$9!#(B - -@table @samp -@item users -$B;22C$7$F$$$k%f!<%6$NL>A0(B($B6I=jL>(B)$B$N%j%9%H(B -@item operators -$B%*%Z%l!<%?8"8B$r$b$D%f!<%6$NL>A0$N%j%9%H(B -@item speakers -$BH/8@8"$r$b$D%f!<%6$NL>A0$N%j%9%H(B -@item modes -$B%A%c%s%M%k$N%b!<%I(B($BJ8;z$N%j%9%H(B) -@item banned -@samp{MODE +b} $B$G;XDj$5$l$?%Q%?!<%s$N0lMw(B -@item invited -@samp{MODE +I} $B$G;XDj$5$l$?%Q%?!<%s$N0lMw(B -@item uninvited -@samp{MODE +e} $B$G;XDj$5$l$?%Q%?!<%s$N0lMw(B -@end table - -@subsubsection Users -@code{riece-user} $B$O!"(BIRC $B$K;22C$7$F$$$k%f!<%6$rI=$9%*%V%8%'%/%H$G$9!#0J(B -$B2<$NMWAG$r;}$A$^$9!#(B - -@table @samp -@item channels -$B;22C$7$F$$$k%A%c%s%M%k$NL>A0(B($B6I=jL>(B)$B$N%j%9%H(B -@item user-at-host -"@@" $B$N7A$GM?$($i$l$k%f!<%6$N>pJs(B -@item modes -$B%f!<%6$N%b!<%I(B($BJ8;z$N%j%9%H(B) -@item away -AWAY $BCf$+$I$&$+(B -@end table - -@subsubsection Mediator -$B%A%c%s%M%k$H%f!<%6$N;22C!&N%C&$r4IM}$9$k$?$a$K!"(B @code{riece-naming} -$B$H$$$&>e0L$N%b%8%e!<%k$rMQ0U$7$F$$$^$9!#$3$l$O!"%G%6%$%s%Q%?!<%s$G$$$&(B -$B$H$3$m$N(B Mediator $B%Q%?!<%s$KAjEv$9$k$b$N$G$9!#(B - -@code{riece-naming} $B$r2p$9$k$3$H$G!"A0=R$N%A%c%s%M%k!&%f!<%6%*%V%8%'%/%H(B -$B$KD>@\A06u4V$K0BA4$K%"%/%;%9$9$k$3$H$,$G$-$^$9!#(B - -$BDs6!$9$kA0$,JQ99$5$l$?$3$H$rI=L@$7$^$9(B -@end defun - -@node Signals, Writing add-ons, Namespace management, Development -@section Signals - -$B2hLL$N:FIA2h$r8zN(NI$/9T$&$?$a$K!"%$%Y%s%H$HIA2hBP>]$N%*%V%8%'%/%H(B($B%P%C(B -$B%U%!$d!"%b!<%I%i%$%s$N0u(B @pxref{Indicators})$B$r7k$SIU$1$k%a%+%K%:%`$rMQ0U(B -$B$7$F$$$^$9!#(B - -$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!"(B -Qt $B$d(B GTK+ $B$H$$$C$?(B GUI $B%D!<%k%-%C%H$KMQ0U$5$l$F$$$k$b$N$HF1MM$G$9!#(B - -$B%7%0%J%k$rAw=P$9$k$K$O!"(B@samp{riece-emit-signal} $B$r;H$$$^$9!#(B - -@defun riece-emit-signal signal-name &rest args -@var{signal-name} $B$G;X<($5$l$k%7%0%J%k$r!"0z?t(B @var{args} $B$H$H$b$KAw=P$7$^$9(B -@end defun - -$B%7%0%J%k$K1~Ez$9$k$K$O!"(B@samp{riece-connect-signal} $B$r;H$$$^$9!#(B - -@defun riece-connect-signal signal-name slot-function &optional filter-function handback -@var{signal-name} $B$G;X<($5$l$k%7%0%J%k$K1~Ez$9$k4X?t(B @var{slot-function} -$B$r7k$SIU$1$^$9!#(B@var{slot-function} $B$K;XDj$5$l$?4X?t$O(B 2 $B$D$N0z?t$rl9g$K$O!"(B -@var{slot-function} $B$,8F$P$l$k$3$H$O$"$j$^$;$s!#(B -@end defun - -$B%7%0%J%k%*%V%8%'%/%H$K%"%/%;%9$9$k$K$O!"0J2<$N4X?t$r;H$$$^$9!#(B - -@defun riece-signal-name -$B%7%0%J%k$NL>A0(B($B%7%s%\%k(B)$B$rJV$7$^$9!#(B -@end defun - -@defun riece-signal-args -$B%7%0%J%kAw=P;~$KM?$($i$l$?0z?t$rJV$7$^$9!#(B -@end defun - -$B8=:_!"0J2<$N%7%0%J%k$,I8=`$GEPO?$5$l$F$$$^$9!'(B - -@table @samp -@item channel-list-changed -$B;22C$7$F$$$k%A%c%s%M%k$N0lMw$NJQ2=(B -@item user-list-changed -$B%A%c%s%M%k$N;22CA0$rJQ99(B -($B0z?t$O!"0JA0$H8=:_$NL>A0$KAjEv$9$k(B @samp{riece-identity} $B%*%V%8%'%/%H(B) -@item user-away-changed -$B%f!<%6$NN%@J>uBV$NJQ2=(B -($B0z?t$O!"%f!<%6$KAjEv$9$k(B @samp{riece-identity} $B%*%V%8%'%/%H(B) -@item user-operator-changed -$B%f!<%6$N%*%Z%l!<%?>uBV$NJQ2=(B -($B0z?t$O!"%f!<%6$KAjEv$9$k(B @samp{riece-identity} $B%*%V%8%'%/%H(B) -@item channel-topic-changed -$B%A%c%s%M%k$N%H%T%C%/$NJQ2=(B -($B0z?t$O!"%A%c%s%M%k$KAjEv$9$k(B @samp{riece-identity} $B%*%V%8%'%/%H(B) -@item channel-modes-changed -$B%A%c%s%M%k$N%b!<%I$NJQ2=(B -($B0z?t$O!"%A%c%s%M%k$KAjEv$9$k(B @samp{riece-identity} $B%*%V%8%'%/%H(B) -@item channel-operators-changed -$B%A%c%s%M%k$G%*%Z%l!<%?8"8B$r;}$D%f!<%6$N0lMw$NJQ2=(B -($B0z?t$O!"%A%c%s%M%k$KAjEv$9$k(B @samp{riece-identity} $B%*%V%8%'%/%H(B) -@item channel-speakers-changed -$B%A%c%s%M%k$GH/8@8"$r;}$D%f!<%6$N0lMw$NJQ2=(B -($B0z?t$O!"%A%c%s%M%k$KAjEv$9$k(B @samp{riece-identity} $B%*%V%8%'%/%H(B) -@item buffer-freeze-changed -$B%P%C%U%!$NE`7k>uBV$NJQ2=(B -($B0z?t$O%P%C%U%!(B) -@end table - -@node Writing add-ons, Handler hooks, Signals, Development -@section Writing add-ons - -$B%"%I%*%s$N>r7o$rK~$?$9%b%8%e!<%k$O0J2<$N4X?t$rDs6!$7$^$9!#(B - -@table @samp -@item <$B%b%8%e!<%kL>(B>-requires -$B0MB8$9$kB>$N%"%I%*%s(B($B%7%s%\%k$N%j%9%H(B)$B$rJV$7$^$9(B($B%*%W%7%g%s(B) -@item <$B%b%8%e!<%kL>(B>-insinuate -$B=i4|2==hM}$r9T$$$^$9(B -@end table - -$B$^$?!"%"%I%*%s$N@bL@$r!"JQ?t(B @samp{<$B%b%8%e!<%kL>(B>-description} $B$K@_Dj$9(B -$B$k$3$H$b$G$-$^$9!#$3$NJ8;zNs$O(B @kbd{M-x riece-command-list-addons} $B$K$h(B -$B$k%"%I%*%s$N0lMwI=<($K;H$o$l$^$9!#(B - -$BM-8z2=!&L58z2=$KBP1~$7$?%"%I%*%s$O!"JQ?t(B @samp{<$B%b%8%e!<%kL>(B>-enabled} -$B$K8=:_$N>uBV$rJ];}$7$^$9!#CM$,(B @samp{nil} $B$G$"$l$PL58z!"(B@samp{t} $B$G$"$l(B -$B$PM-8z$G$9!#2C$($F!"0J2<$N4X?t$rDs6!$7$^$9!#(B - -@table @samp -@item <$B%b%8%e!<%kL>(B>-enable -$B%"%I%*%s$rM-8z$K$7$^$9(B -@item <$B%b%8%e!<%kL>(B>-disable -$B%"%I%*%s$rL58z$K$7$^$9(B -@end table - -Riece $B$O5/F0;~$K0J2<$N=hM}$r9T$$$^$9!#(B - -@enumerate -@item -$BJQ?t(B @code{riece-addons} $B$KNs5s$5$l$?%b%8%e!<%k$rFI$_9~$`(B - -@item -$B$=$l$>$l$N%b%8%e!<%k$KBP$7!"(B@samp{<$B%b%8%e!<%kL>(B>-requires} $B$,MQ0U$5$l$F$$$l$P8F$S=P$7$F0MB8%0%i%U$r:n$k(B - -@item -$B0MB8%0%i%U$KBP$7$F%H%]%m%8%+%k%=!<%H(B (cf. tsort(1)) $B$r9T$&(B - -@item -$BF@$i$l$?0MB8=g=x$K=>$C$F(B @samp{<$B%b%8%e!<%kL>(B>-insinuate} $B8F$S=P$9(B - -@item -$B$b$7!"%"%I%*%s$,M-8z2=!&L58z2=$KBP1~$7$F$*$j!"L@<(E*$KL58z2=$5$l$F$$$J$1$l$P!"(B -@samp{<$B%b%8%e!<%kL>(B>-enable}$B$r8F$S=P$9!#(B -@end enumerate - -$B:n@.$7$?%"%I%*%s$O!"(B@code{load-path} $B$NDL$C$?%G%#%l%/%H%j!"$^$?$O(B -@code{riece-addon-directory} ($B%G%U%)%k%H$G$O(B @file{~/.riece/addons/}) $B$K(B -$BCV$/$3$H$GAH$_9~$_2DG=$J>uBV$K$J$j$^$9!#(B -@vindex riece-addon-directory - -@node Handler hooks, , Writing add-ons, Development -@section Handler hooks - -Riece $B$K$O!"%O%s%I%i%U%C%/$H8F$P$l$kFC(B(PRIVMSG $B$J$I(B)$B$rA4$F>.(B -$BJ8;z$K$7$?$b$N$H$7$^$9!#(B - -@table @code -@item riece--hook -@samp{message} $B$,FO$$$?$H$-$K:G=i$K8F$P$l$k%U%C%/(B -@item riece-after--hook -@samp{message} $B$N=hM}$,=*$o$C$?8e$K8F$P$l$k%U%C%/(B -@end table - -$B$3$3$G(B @code{riece--hook} $B$NJV$jCM$K$O0UL#$,$"$j!"Hs(B nil $B$rJV$9(B -$B$b$N$,$"$l$P!"$=$N8e$N=hM}$r$*$3$J$$$^$;$s!#$^$?!"$=$N>l9g$K$O(B -@code{riece-after--hook} $B$b8F$S=P$5$l$^$;$s!#(B +@section $B%&%#%s%I%&4V$r<+M3$K0\F0$7$?$$(B -$B%U%C%/$N0z?t$O(B RFC2812 $B$N(B @samp{prefix} $B$H(B @samp{Parameters} $B$KAjEv$9$k(B -2 $B$D$N0z?t$,EO$j$^$9!#(B +GNU Emacs $B$KImB0$N(B @samp{windmove.el} $B$r;H$&$HJXMx$G$9!#>\:Y$O(B +@samp{windmove.el} $B$N%3%a%s%H$r;2>H$/$@$5$$!#(B@samp{windmove.el} $B$O(B +$B:n riece-channel @@ -44,48 +46,20 @@ 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)) @@ -110,6 +84,13 @@ 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)) @@ -134,32 +115,56 @@ (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 () @@ -169,20 +174,22 @@ (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 () diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6f15dc5..91be375 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,426 @@ +2005-08-27 Daiki Ueno + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * riece-addon.el (riece-uninstall-addon): Update + riece-addon-dependencies. + +2005-08-26 Daiki Ueno + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * riece-addon.el (riece-command-enable-addon): Redraw entire + add-on list. + (riece-command-disable-addon): Ditto. + +2005-08-17 Daiki Ueno + + * 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 + + * riece-options.el (riece-data-directory): Use load-file-name. + +2005-08-15 TAKAHASHI Kaoru + + * riece-options.el (riece-data-directory): Avoid compile time + error when locate-data-directory undefined. + +2005-08-15 Daiki Ueno + + * 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 + + * 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 + + * 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 + + * riece-ruby.el (riece-ruby-filter): Pass timestamp of output + event to output-handler. + +2005-08-12 Daiki Ueno + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * riece-ruby.el: New file. + * rubyserv.rb: Rewrite. + +2005-08-09 Daiki Ueno + + * riece-mini.el (riece-mini-message-no-log): Defined as a + function. + (riece-mini-requires): Fixed indent. + +2005-08-08 Daiki Ueno + + * 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 + + * riece-alias.el (riece-alias-alternate-separator): Set to "@". + +2005-07-28 Daiki Ueno + + * riece-debug.el: Don't bind unused variable; prepend time to + debug message. + +2005-07-19 Daiki Ueno + + * 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 + + * 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 * riece-server.el (riece-server-keyword-map): Add :coding-system-alist. diff --git a/lisp/Makefile.am b/lisp/Makefile.am index 5d49803..5b7f1b6 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -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 index 0000000..df88f94 --- /dev/null +++ b/lisp/aproxy.rb @@ -0,0 +1,107 @@ +# aproxy.rb --- async proxy between an IRC server and a client +# Copyright (C) 1998-2005 Daiki Ueno + +# Author: Daiki Ueno +# 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 diff --git a/lisp/riece-300.el b/lisp/riece-300.el index 2f758dc..109f2f2 100644 --- a/lisp/riece-300.el +++ b/lisp/riece-300.el @@ -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 index 0000000..7cb2107 --- /dev/null +++ b/lisp/riece-addon-modules.el @@ -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 diff --git a/lisp/riece-addon.el b/lisp/riece-addon.el index 092e6a5..8887394 100644 --- a/lisp/riece-addon.el +++ b/lisp/riece-addon.el @@ -28,18 +28,19 @@ (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) @@ -68,12 +69,19 @@ :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) @@ -92,13 +100,14 @@ '((?+ . 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))) @@ -110,6 +119,9 @@ (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) @@ -122,10 +134,13 @@ 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. @@ -136,91 +151,160 @@ ;; 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) diff --git a/lisp/riece-alias.el b/lisp/riece-alias.el index f8243ff..dc11b52 100644 --- a/lisp/riece-alias.el +++ b/lisp/riece-alias.el @@ -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 @@ -21,14 +21,15 @@ ;; 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) @@ -60,10 +61,8 @@ :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 "^#\\([^ ]+\\):" @@ -166,14 +165,12 @@ #'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) diff --git a/lisp/riece-async.el b/lisp/riece-async.el index 930a2c3..b234b58 100644 --- a/lisp/riece-async.el +++ b/lisp/riece-async.el @@ -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 @@ -23,12 +23,11 @@ ;;; 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 @@ -38,107 +37,44 @@ ;;; 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 diff --git a/lisp/riece-biff.el b/lisp/riece-biff.el index dfacb9f..62c306c 100644 --- a/lisp/riece-biff.el +++ b/lisp/riece-biff.el @@ -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 @@ -23,15 +23,15 @@ ;;; 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 @@ -51,13 +51,11 @@ (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 () @@ -78,6 +76,13 @@ (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 @@ -98,8 +102,7 @@ (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) diff --git a/lisp/riece-button.el b/lisp/riece-button.el index f125dbf..7f78388 100644 --- a/lisp/riece-button.el +++ b/lisp/riece-button.el @@ -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 @@ -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: @@ -45,14 +44,12 @@ '("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 diff --git a/lisp/riece-coding.el b/lisp/riece-coding.el index 459797b..a505f20 100644 --- a/lisp/riece-coding.el +++ b/lisp/riece-coding.el @@ -27,7 +27,7 @@ (require 'riece-globals) (defgroup riece-coding nil - "Coding system" + "Coding system." :tag "Coding" :prefix "riece-" :group 'riece) diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index b3398ce..bc6fbcb 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -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 diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index 45eebf8..0afefe8 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -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 @@ -22,6 +22,10 @@ ;; 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) @@ -50,13 +54,11 @@ (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) ",")) @@ -73,16 +75,18 @@ (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) @@ -215,7 +219,7 @@ "\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) ",")) @@ -231,16 +235,18 @@ (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) @@ -366,32 +372,40 @@ (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) diff --git a/lisp/riece-ctlseq.el b/lisp/riece-ctlseq.el index 987e4ca..842c6a1 100644 --- a/lisp/riece-ctlseq.el +++ b/lisp/riece-ctlseq.el @@ -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 @@ -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 @@ -57,10 +57,8 @@ (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)) @@ -156,7 +154,7 @@ 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) @@ -187,11 +185,14 @@ (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) diff --git a/lisp/riece-debug.el b/lisp/riece-debug.el index def5997..cddd944 100644 --- a/lisp/riece-debug.el +++ b/lisp/riece-debug.el @@ -27,18 +27,21 @@ (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'." diff --git a/lisp/riece-display.el b/lisp/riece-display.el index 037f437..a3d59e2 100644 --- a/lisp/riece-display.el +++ b/lisp/riece-display.el @@ -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) diff --git a/lisp/riece-doctor.el b/lisp/riece-doctor.el index 61a33f0..941841d 100644 --- a/lisp/riece-doctor.el +++ b/lisp/riece-doctor.el @@ -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 @@ -23,10 +23,7 @@ ;;; 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: @@ -36,26 +33,24 @@ (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) diff --git a/lisp/riece-emacs.el b/lisp/riece-emacs.el index 7477633..0805794 100644 --- a/lisp/riece-emacs.el +++ b/lisp/riece-emacs.el @@ -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 index 0000000..a6c2315 --- /dev/null +++ b/lisp/riece-eval-ruby.el @@ -0,0 +1,97 @@ +;;; riece-eval-ruby.el --- evaluate input string as a Ruby program +;; Copyright (C) 1998-2005 Daiki Ueno + +;; Author: Daiki Ueno +;; 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 diff --git a/lisp/riece-eval.el b/lisp/riece-eval.el index c54079f..71b308e 100644 --- a/lisp/riece-eval.el +++ b/lisp/riece-eval.el @@ -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 @@ -23,11 +23,7 @@ ;;; 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) @@ -49,13 +45,11 @@ :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))) @@ -91,11 +85,15 @@ (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) diff --git a/lisp/riece-filter.el b/lisp/riece-filter.el index a07d0c6..44b5eda 100644 --- a/lisp/riece-filter.el +++ b/lisp/riece-filter.el @@ -56,13 +56,15 @@ (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) diff --git a/lisp/riece-foolproof.el b/lisp/riece-foolproof.el index 75e2e97..6c1a352 100644 --- a/lisp/riece-foolproof.el +++ b/lisp/riece-foolproof.el @@ -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 @@ -23,10 +23,7 @@ ;;; 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: @@ -34,10 +31,8 @@ (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)) @@ -65,11 +60,15 @@ (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) diff --git a/lisp/riece-globals.el b/lisp/riece-globals.el index 8a9b634..c36c752 100644 --- a/lisp/riece-globals.el +++ b/lisp/riece-globals.el @@ -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" diff --git a/lisp/riece-google.el b/lisp/riece-google.el index f3e0df9..368d431 100644 --- a/lisp/riece-google.el +++ b/lisp/riece-google.el @@ -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 @@ -24,19 +24,16 @@ ;;; 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) diff --git a/lisp/riece-guess.el b/lisp/riece-guess.el index a4df612..c5c3270 100644 --- a/lisp/riece-guess.el +++ b/lisp/riece-guess.el @@ -21,13 +21,17 @@ ;; 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) @@ -37,10 +41,8 @@ :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) diff --git a/lisp/riece-hangman.el b/lisp/riece-hangman.el index c4fd54c..a559c36 100644 --- a/lisp/riece-hangman.el +++ b/lisp/riece-hangman.el @@ -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 @@ -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: @@ -34,16 +33,16 @@ (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) @@ -56,10 +55,8 @@ (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) diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index 6b3dbb5..7758627 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -22,6 +22,10 @@ ;; 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) @@ -32,13 +36,13 @@ (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) @@ -197,10 +201,8 @@ (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) @@ -214,8 +216,8 @@ (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 () @@ -224,7 +226,7 @@ ;; 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) @@ -234,7 +236,7 @@ (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 @@ -245,7 +247,7 @@ (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)) @@ -260,12 +262,8 @@ (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 @@ -279,6 +277,29 @@ (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 @@ -288,8 +309,7 @@ '(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)) @@ -300,8 +320,7 @@ '(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) diff --git a/lisp/riece-history.el b/lisp/riece-history.el index 4ea6448..d9e309f 100644 --- a/lisp/riece-history.el +++ b/lisp/riece-history.el @@ -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 @@ -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: @@ -33,13 +35,13 @@ (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) @@ -74,10 +76,8 @@ (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)) @@ -114,12 +114,18 @@ ;;; (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 @@ -133,15 +139,24 @@ ;;; '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) diff --git a/lisp/riece-icon.el b/lisp/riece-icon.el index 9e99799..2f9bab2 100644 --- a/lisp/riece-icon.el +++ b/lisp/riece-icon.el @@ -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 -;; 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)) diff --git a/lisp/riece-identity.el b/lisp/riece-identity.el index 09c45bf..adada4c 100644 --- a/lisp/riece-identity.el +++ b/lisp/riece-identity.el @@ -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))) diff --git a/lisp/riece-ignore.el b/lisp/riece-ignore.el index 99ad310..7beea30 100644 --- a/lisp/riece-ignore.el +++ b/lisp/riece-ignore.el @@ -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 @@ -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) diff --git a/lisp/riece-irc.el b/lisp/riece-irc.el index d9c1ccd..050a6e2 100644 --- a/lisp/riece-irc.el +++ b/lisp/riece-irc.el @@ -97,9 +97,19 @@ (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 diff --git a/lisp/riece-kakasi.el b/lisp/riece-kakasi.el index 62f3e1f..fd018c7 100644 --- a/lisp/riece-kakasi.el +++ b/lisp/riece-kakasi.el @@ -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 @@ -24,15 +24,12 @@ ;;; 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)))) @@ -59,18 +56,19 @@ (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) diff --git a/lisp/riece-keepalive.el b/lisp/riece-keepalive.el index 6526d5c..4e6586c 100644 --- a/lisp/riece-keepalive.el +++ b/lisp/riece-keepalive.el @@ -24,12 +24,12 @@ ;;; 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." @@ -64,8 +64,12 @@ (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) diff --git a/lisp/riece-keyword.el b/lisp/riece-keyword.el index 33a479b..53415f6 100644 --- a/lisp/riece-keyword.el +++ b/lisp/riece-keyword.el @@ -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 @@ -24,15 +24,15 @@ ;;; 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) diff --git a/lisp/riece-layout.el b/lisp/riece-layout.el index 05bdabd..584c2c0 100644 --- a/lisp/riece-layout.el +++ b/lisp/riece-layout.el @@ -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) diff --git a/lisp/riece-log.el b/lisp/riece-log.el index a905e73..6c3ae7c 100644 --- a/lisp/riece-log.el +++ b/lisp/riece-log.el @@ -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 @@ -25,10 +25,7 @@ ;;; 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) diff --git a/lisp/riece-lsdb.el b/lisp/riece-lsdb.el index bec5701..cd620a8 100644 --- a/lisp/riece-lsdb.el +++ b/lisp/riece-lsdb.el @@ -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 @@ -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: @@ -43,10 +42,8 @@ (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)))) @@ -117,6 +114,9 @@ (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 @@ -126,19 +126,25 @@ (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) diff --git a/lisp/riece-menu.el b/lisp/riece-menu.el index d11641e..4023b7d 100644 --- a/lisp/riece-menu.el +++ b/lisp/riece-menu.el @@ -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 @@ -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) @@ -103,14 +102,27 @@ (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) diff --git a/lisp/riece-message.el b/lisp/riece-message.el index c943e50..81d430c 100644 --- a/lisp/riece-message.el +++ b/lisp/riece-message.el @@ -30,7 +30,7 @@ (require 'riece-misc) (defgroup riece-message nil - "Messages" + "Display messages." :tag "Message" :prefix "riece-" :group 'riece) diff --git a/lisp/riece-mini.el b/lisp/riece-mini.el index 2c88006..99d4f33 100644 --- a/lisp/riece-mini.el +++ b/lisp/riece-mini.el @@ -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 @@ -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 @@ -56,19 +58,17 @@ (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) diff --git a/lisp/riece-ndcc.el b/lisp/riece-ndcc.el index 3dd90d6..cd553ae 100644 --- a/lisp/riece-ndcc.el +++ b/lisp/riece-ndcc.el @@ -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 @@ -21,6 +21,10 @@ ;; 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)) diff --git a/lisp/riece-options.el b/lisp/riece-options.el index 51735ff..8330ff5 100644 --- a/lisp/riece-options.el +++ b/lisp/riece-options.el @@ -29,18 +29,21 @@ ;; 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 diff --git a/lisp/riece-rdcc.el b/lisp/riece-rdcc.el index 4a34937..7af34af 100644 --- a/lisp/riece-rdcc.el +++ b/lisp/riece-rdcc.el @@ -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 @@ -21,6 +21,10 @@ ;; 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) @@ -28,9 +32,10 @@ (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) diff --git a/lisp/riece-ruby.el b/lisp/riece-ruby.el index a0006e4..97f4e5b 100644 --- a/lisp/riece-ruby.el +++ b/lisp/riece-ruby.el @@ -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 ;; Created: 1998-09-28 -;; Keywords: IRC, riece +;; Keywords: IRC, riece, Ruby ;; This file is part of Riece. @@ -22,19 +22,104 @@ ;; 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)) @@ -56,58 +141,259 @@ 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 diff --git a/lisp/riece-server.el b/lisp/riece-server.el index 48ad91e..a333baf 100644 --- a/lisp/riece-server.el +++ b/lisp/riece-server.el @@ -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 index 0000000..8fc0bfc --- /dev/null +++ b/lisp/riece-shrink-buffer.el @@ -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 +;; 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 diff --git a/lisp/riece-skk-kakutei.el b/lisp/riece-skk-kakutei.el index 35ac4f1..a861c7a 100644 --- a/lisp/riece-skk-kakutei.el +++ b/lisp/riece-skk-kakutei.el @@ -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 @@ -23,19 +23,14 @@ ;;; 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." @@ -71,14 +66,12 @@ (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) diff --git a/lisp/riece-toolbar.el b/lisp/riece-toolbar.el index fc22878..4bcec8a 100644 --- a/lisp/riece-toolbar.el +++ b/lisp/riece-toolbar.el @@ -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 @@ -24,15 +24,14 @@ ;;; 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 @@ -62,14 +61,10 @@ (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)) @@ -84,10 +79,21 @@ (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))) @@ -99,10 +105,12 @@ 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 @@ -113,9 +121,18 @@ '(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) diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index e11a3f8..f0355a9 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -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 @@ -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: @@ -36,11 +38,10 @@ (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) @@ -68,13 +69,11 @@ (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)))) @@ -86,20 +85,20 @@ (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)) @@ -123,7 +122,7 @@ (error "No unread channel!"))) (defun riece-guess-channel-from-unread () - riece-unread-channels) + (reverse riece-unread-channels)) (defun riece-unread-requires () (let (requires) @@ -151,6 +150,23 @@ ;;; '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) @@ -160,8 +176,7 @@ (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 () @@ -171,8 +186,7 @@ "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) diff --git a/lisp/riece-url.el b/lisp/riece-url.el index c502328..9ec45f5 100644 --- a/lisp/riece-url.el +++ b/lisp/riece-url.el @@ -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 @@ -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) diff --git a/lisp/riece-xemacs.el b/lisp/riece-xemacs.el index 70735ac..b50d265 100644 --- a/lisp/riece-xemacs.el +++ b/lisp/riece-xemacs.el @@ -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 diff --git a/lisp/riece-xface.el b/lisp/riece-xface.el index 1ec5066..a4fd4ae 100644 --- a/lisp/riece-xface.el +++ b/lisp/riece-xface.el @@ -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 @@ -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: @@ -34,15 +33,13 @@ (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) @@ -64,19 +61,30 @@ (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))) diff --git a/lisp/riece-yank.el b/lisp/riece-yank.el index 12a21cc..b6a2115 100644 --- a/lisp/riece-yank.el +++ b/lisp/riece-yank.el @@ -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 @@ -20,16 +20,14 @@ ;; 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 diff --git a/lisp/riece.el b/lisp/riece.el index 5b0105f..adcd0c4 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -62,12 +62,6 @@ (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 index 7c894fc..0000000 --- a/lisp/rubyserv.rb +++ /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 index 0000000..87b094e --- /dev/null +++ b/lisp/server.rb @@ -0,0 +1,226 @@ +# server.rb --- A simple IPC server executing Ruby programs. +# Copyright (C) 1998-2005 Daiki Ueno + +# Author: Daiki Ueno +# 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 diff --git a/lisp/test/test-riece-addon.el b/lisp/test/test-riece-addon.el index b0e39b1..9fae05c 100644 --- a/lisp/test/test-riece-addon.el +++ b/lisp/test/test-riece-addon.el @@ -28,15 +28,16 @@ (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))))) diff --git a/lisp/test/test-riece-log.el b/lisp/test/test-riece-log.el index 98a3c05..8f92dc9 100644 --- a/lisp/test/test-riece-log.el +++ b/lisp/test/test-riece-log.el @@ -25,10 +25,10 @@ (make-directory riece-log-directory) (make-directory test-riece-log-directory) (write-region "03:14 a b c\n03:15 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 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 1 2 3 (2038/01/18)\n" - "03:14 a b c (2038/01/19)\n" - "03:15 a b c (2038/01/19)\n") + (concat "03:14 1 2 3 (1970/01/01)\n" + "03:14 a b c (1970/01/02)\n" + "03:15 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 index 0000000..ca99573 --- /dev/null +++ b/lisp/test/test-riece-ruby.el @@ -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