Commit | Line | Data |
---|---|---|
97ed0ac3 EZ |
1 | \input texinfo |
2 | @c %**start of header | |
3 | @setfilename ../info/rcirc | |
4 | @settitle rcirc Manual | |
5 | @c %**end of header | |
6 | ||
7 | @copying | |
b223e22d | 8 | Copyright @copyright{} 2006 Free Software Foundation, Inc. |
97ed0ac3 EZ |
9 | |
10 | @quotation | |
11 | Permission is granted to copy, distribute and/or modify this document | |
12 | under the terms of the GNU Free Documentation License, Version 1.2 or | |
13 | any later version published by the Free Software Foundation; with no | |
14 | Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', | |
15 | and with the Back-Cover Texts as in (a) below. A copy of the license is | |
16 | included in the section entitled ``GNU Free Documentation License'' in | |
17 | the Emacs manual. | |
18 | ||
19 | (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify | |
20 | this GNU Manual, like GNU software. Copies published by the Free | |
21 | Software Foundation raise funds for GNU development.'' | |
22 | ||
23 | This document is part of a collection distributed under the GNU Free | |
24 | Documentation License. If you want to distribute this document | |
25 | separately from the collection, you can do so by adding a copy of the | |
26 | license to the document, as described in section 6 of the license. | |
27 | @end quotation | |
28 | @end copying | |
29 | ||
30 | @dircategory Emacs | |
31 | @direntry | |
62e77f3d | 32 | * Rcirc: (rcirc). Internet Relay Chat (IRC) client. |
97ed0ac3 EZ |
33 | @end direntry |
34 | ||
35 | @titlepage | |
36 | @title rcirc Manual | |
37 | @page | |
38 | @vskip 0pt plus 1filll | |
39 | @insertcopying | |
40 | @end titlepage | |
41 | ||
42 | @ifnottex | |
43 | @node Top, Basics, (dir), (dir) | |
44 | @top rcirc Manual | |
45 | @end ifnottex | |
46 | ||
47 | @code{rcirc} is an Emacs IRC client. | |
48 | ||
49 | IRC (Internet Relay Chat) is a multi-user chat protocol. Users | |
50 | communicate with each other in real-time. Communication occurs both in | |
51 | topic channels which are collections of many users, or privately, with | |
52 | just one other user. | |
53 | ||
54 | @menu | |
62e77f3d LT |
55 | * Basics:: |
56 | * Reference:: | |
57 | * Hacking and Tweaking:: | |
58 | * Key Index:: | |
59 | * Variable Index:: | |
60 | * Index:: | |
97ed0ac3 EZ |
61 | |
62 | @detailmenu | |
63 | --- The Detailed Node Listing --- | |
64 | ||
65 | Basics | |
66 | ||
67 | * Internet Relay Chat:: | |
68 | * Getting started with rcirc:: | |
69 | ||
70 | Reference | |
71 | ||
72 | * rcirc commands:: | |
73 | * Useful IRC commands:: | |
74 | * Configuration:: | |
75 | ||
76 | Hacking and Tweaking | |
77 | ||
78 | * Skipping /away messages using handlers:: | |
79 | * Using fly spell mode:: | |
80 | * Scrolling conservatively:: | |
81 | * Changing the time stamp format:: | |
82 | * Defining a new command:: | |
83 | * Reconnecting after you have lost the connection:: | |
84 | ||
85 | @end detailmenu | |
86 | @end menu | |
87 | ||
88 | @node Basics, Reference, Top, Top | |
89 | @chapter Basics | |
97ed0ac3 EZ |
90 | |
91 | This chapter contains a brief introduction to IRC (Internet Relay Chat), | |
92 | and a quick tutorial on @code{rcirc}. | |
93 | ||
94 | @menu | |
62e77f3d LT |
95 | * Internet Relay Chat:: |
96 | * Getting started with rcirc:: | |
97ed0ac3 EZ |
97 | @end menu |
98 | ||
99 | @node Internet Relay Chat, Getting started with rcirc, Basics, Basics | |
100 | @section Internet Relay Chat | |
101 | @cindex internet relay chat | |
102 | @cindex irc | |
103 | ||
104 | @cindex channel | |
105 | @dfn{Internet Relay Chat} (IRC) is a form of instant communication over the | |
106 | Internet. It is mainly designed for group (many-to-many) communication | |
107 | in discussion forums called channels, but also allows one-to-one | |
108 | communication. | |
109 | ||
110 | @cindex instant messaging, comparison | |
111 | @cindex server | |
112 | @cindex network | |
113 | Contrary to most Instant Messenger (IM) systems, users usually don't | |
114 | connect to a central server. Instead, users connect to a random server | |
115 | in a network, and the servers share information between them. | |
116 | ||
117 | Here's a typical example: | |
118 | ||
119 | @cindex redirection to random servers | |
120 | When you connect to the Freenode network | |
121 | (@indicateurl{http://freenode.net/}), you point your IRC client at the | |
122 | server @code{irc.freenode.net}. That server will redirect your client | |
123 | to a random server on the network, such as @code{zelazny.freenode.net}. | |
124 | ||
d177d64e | 125 | @cindex channel name |
97ed0ac3 EZ |
126 | @cindex # starts a channel name |
127 | Once you're connected, you can send messages to all other users | |
128 | connected to the same network, and you can join all channels on the same | |
129 | network. You might join the @code{#emacs} and the @code{#rcirc} | |
130 | channels, for example. (Typically, channel names begin with a hash | |
131 | character.) | |
132 | ||
133 | Once you have joined a channel, anything you type will be broadcast to | |
134 | all the other users on the same channel. | |
135 | ||
136 | @cindex addressing other people | |
137 | @cindex other people, addressing them | |
138 | @cindex talk to other people | |
139 | If you want to address someone specifically, for example as an answer | |
140 | to a question, it is custom to prefix the message with the nick | |
141 | followed by a colon, like this: | |
142 | ||
143 | @example | |
144 | deego: fsbot rules! | |
145 | @end example | |
146 | ||
147 | @cindex nick completion | |
148 | @cindex completion of nicks | |
149 | @kindex TAB | |
150 | Since this is so common, you can use @key{TAB} to do nick completion. | |
151 | ||
152 | @node Getting started with rcirc, , Internet Relay Chat, Basics | |
153 | @section Getting started with rcirc | |
154 | @cindex getting started | |
155 | @cindex connecting to a server | |
156 | ||
157 | @cindex irc command | |
158 | Use the command @kbd{M-x irc} to connect to a server. You will be asked | |
159 | for four things: | |
160 | ||
161 | @table @asis | |
162 | @cindex server, connecting | |
163 | @cindex Freenode network | |
164 | @item IRC server | |
165 | What server do you want to connect to? All the servers in a particular | |
166 | network are equivalent. Some networks use a round-robin system where a | |
167 | single server redirects new connections to a random server in the | |
168 | network. @code{irc.freenode.net} is such a server for the Freenode | |
169 | network. Freenode provides the network ``for the Free and Open Source | |
170 | Software communities, for not-for-profit organisations and for related | |
171 | communities and organizations.'' | |
172 | ||
173 | @cindex port, connecting | |
174 | @cindex 6667, default IRC port | |
175 | @item IRC port | |
176 | All network connections require a port. Just as web servers and clients | |
177 | use port 80 per default, IRC uses port 6667 per default. You rarely | |
178 | have to use a different port. | |
179 | ||
180 | @cindex nick, connecting | |
181 | @cindex changing nick | |
182 | @cindex name changes | |
183 | @item IRC nick | |
184 | @vindex user-login-name | |
185 | Every users needs a handle on-line. You will automatically be assigned | |
186 | a slightly different nick if your chosen nick is already in use. If | |
187 | your @code{user-login-name} is @code{"alex"}, and this nick is already | |
188 | in use, you might for example get assigned the nick @code{alex`}. | |
189 | ||
190 | @cindex channels, connecting | |
191 | @cindex initial channels | |
192 | @cindex startup channels | |
193 | @item Channels | |
194 | A space separated list of channels you want to join when connecting. | |
195 | You don't need to join any channels, if you just want to have one-to-one | |
196 | conversations with friends on the same network. If you're new to the | |
197 | Freenode network, join @code{#emacs}, the about all things Emacs. | |
198 | @end table | |
199 | ||
200 | @cindex server buffer | |
201 | When you have answered these questions, @code{rcirc} will create a server | |
202 | buffer, which will be named something like @code{*irc.freenode.net*}, | |
203 | and a channel buffer for each of the channels you wanted to join. | |
204 | ||
205 | @kindex RET | |
206 | @cindex talking | |
207 | @cindex communicating | |
208 | To talk in a channel, just type in what you want to say in a channel | |
d177d64e | 209 | buffer, and press @key{RET}. |
97ed0ac3 EZ |
210 | |
211 | @kindex C-c C-c | |
212 | @cindex multiline messages | |
213 | @cindex messages, multiple lines | |
214 | @cindex pasting multiple lines | |
215 | @cindex edit message before sending | |
216 | If you want to paste multiple lines, such as source code, you can use | |
217 | @kbd{C-c C-c} to edit your message in a separate buffer. Use @kbd{C-c | |
d177d64e | 218 | C-c} to finish editing. You still need to press @key{RET} to send it, |
97ed0ac3 EZ |
219 | though. Generally, IRC users don't like people pasting more than around |
220 | four lines of code, so use with care. | |
221 | ||
222 | @kindex C-c C-SPC | |
223 | @cindex switching channels | |
224 | @cindex tracking activity | |
225 | @cindex active channel | |
226 | @cindex abbreviated channel names | |
227 | @cindex modeline tracks activity | |
228 | You will note that when other people say things in buffers that are | |
229 | currently buried (no window is showing them), the mode line will show | |
d177d64e | 230 | you the abbreviated channel or nick name. Use @kbd{C-c C-@key{SPC}} to switch |
97ed0ac3 EZ |
231 | to these buffers. |
232 | ||
233 | @node Reference, Hacking and Tweaking, Basics, Top | |
234 | @chapter Reference | |
235 | @cindex reference | |
236 | ||
237 | This is the reference section of the manual. It is not complete. For | |
238 | complete listings of @code{rcirc} features, use Emacs built-in | |
239 | documentation. | |
240 | ||
241 | @menu | |
62e77f3d LT |
242 | * rcirc commands:: |
243 | * Useful IRC commands:: | |
244 | * Configuration:: | |
97ed0ac3 EZ |
245 | @end menu |
246 | ||
247 | @node rcirc commands, Useful IRC commands, Reference, Reference | |
248 | @section rcirc commands | |
d177d64e | 249 | @cindex rcirc commands |
97ed0ac3 EZ |
250 | @cindex commands |
251 | ||
252 | @kindex C-h m | |
253 | This is a list of commands that you may use in @code{rcirc}. It is not | |
254 | complete. For a complete listing, press @kbd{C-h m} in an @code{rcirc} | |
255 | buffer. | |
256 | ||
257 | In addition to using regular Emacs key bindings, you can call them by | |
258 | typing them into an @code{rcirc} buffer. | |
259 | ||
260 | @cindex call commands | |
261 | @cindex typing commands | |
262 | @cindex commands | |
263 | For instance, instead of using the command @kbd{C-c C-j} to join a new | |
d177d64e | 264 | channel, you may type this in an @code{rcirc} buffer, and press @key{RET}: |
97ed0ac3 EZ |
265 | |
266 | @example | |
267 | /join #emacs | |
268 | @end example | |
269 | ||
270 | @cindex / starts a command | |
271 | @cindex messages starting with a slash disappear | |
272 | @cindex disappearing messages if starting with a slash | |
273 | @cindex slash hides message | |
274 | This is why you cannot start a message with a slash. You will have to | |
275 | precede the command with a space, or rewrite your message in order to | |
276 | send it to a channel. | |
277 | ||
278 | @cindex multiple words as parameters | |
279 | @cindex string delimiters | |
280 | @cindex quotes | |
281 | @cindex double-quotes | |
282 | Many commands take parameters. IRC commands usually ignore string | |
283 | delimiters. Neither quote nor double-quote have special meanings in | |
284 | IRC. | |
285 | ||
286 | @example | |
287 | /nick "alex schroeder" | |
288 | @end example | |
289 | ||
290 | This will try to change your nick to @code{"alex}. Usually this will | |
291 | fail because the double quote character is not a legal character for | |
292 | nicks. | |
293 | ||
294 | @cindex case insensitive commands | |
295 | These commands are case insensitive. | |
296 | ||
297 | @cindex new command | |
298 | @cindex unknown command | |
299 | @cindex command unknown | |
300 | If a command isn't known by @code{rcirc}, it will simply be sent along to the | |
301 | server. There is a list of some useful commands like that in the next | |
302 | section. | |
303 | ||
304 | @table @kbd | |
305 | @item C-c C-j | |
306 | @kindex C-c C-j | |
307 | @cindex /join | |
308 | @cindex join channels | |
309 | @cindex other channels | |
310 | @cindex rooms, joining | |
311 | @cindex discussion, joining | |
312 | This joins a channel such as @code{#rcirc} or @code{#emacs}. On most | |
313 | networks, anybody can create new channels. If you want to talk with | |
314 | some friends, for example, all you have to do is agree on a valid | |
315 | channel name and join that channel. (Also @code{/join #emacs}.) | |
316 | ||
317 | @item C-c C-p | |
318 | @kindex C-c C-p | |
319 | @cindex /part | |
320 | @cindex part a channel | |
321 | @cindex leave a channel | |
322 | @cindex disconnect from a channel | |
323 | @cindex stop talking on a channel | |
324 | @cindex kill channel buffer | |
325 | This leaves the current channel. You can optionally provide a reason | |
326 | for parting. When you kill a channel buffer, you automatically part the | |
327 | corresponding channel. (Also @code{/part you are too weird!}.) | |
328 | ||
329 | @item C-c C-r | |
330 | @kindex C-c C-r | |
331 | @cindex /nick | |
332 | @cindex change name | |
333 | @cindex nick changing | |
334 | @cindex rename yourself | |
335 | @cindex other name | |
336 | This changes your nick to some other name. Your nick must be unique | |
337 | across the network. Most networks don't allow too many nick changes in | |
338 | quick succession, and have restrictions on the valid characters in nick | |
339 | names. (Also @code{/nick alex-test}) | |
340 | ||
341 | @item C-c C-w | |
342 | @kindex C-c C-w | |
343 | @cindex /whois | |
344 | @cindex who are these people | |
345 | @cindex identifying people | |
346 | @cindex channels other people are on | |
347 | @cindex what channels people are on | |
348 | Gives you some basic information about a nick. This often includes what | |
349 | other channels people are on. (Also @code{/whois fsbot}.) | |
350 | ||
351 | @item C-c C-q | |
352 | @kindex C-c C-q | |
353 | @cindex /query | |
354 | @cindex starting a private conversation | |
355 | @cindex one-to-one conversation | |
356 | @cindex talk privately | |
357 | @cindex private conversation | |
358 | @cindex contact one person only | |
359 | @cindex query a person | |
360 | Starts a one-to-one conversation with another person on the same | |
361 | network. A new buffer will be created for this conversation. It works | |
362 | like a channel with only two members. (Also @code{/query fsbot}.) | |
363 | ||
d177d64e | 364 | @item C-c @key{RET} |
97ed0ac3 EZ |
365 | @kindex C-c RET |
366 | @cindex /msg | |
367 | @cindex single message | |
368 | @cindex message sending | |
369 | This sends a single message to a nick. Like with @kbd{C-c C-q}, a new | |
370 | buffer is created, where the response from the other party will show | |
371 | up. (Also @code{/msg nickserv identify secret}.) | |
372 | ||
373 | @item C-c C-x | |
374 | @kindex C-c C-x | |
375 | @cindex /quit | |
376 | @cindex quit | |
377 | @cindex disconnect | |
378 | @cindex kill connection | |
379 | @cindex connection end | |
380 | @cindex part all channels | |
381 | @cindex end connection | |
382 | @cindex server buffer killing | |
383 | @cindex reason for quitting | |
384 | This disconnects from the server and parts all channels. You can | |
385 | optionally provide a reason for quitting. When you kill the server | |
386 | buffer, you automatically quit the server and part all channels. (Also | |
387 | @code{/quit ZZZzzz...}.) | |
388 | @end table | |
389 | ||
390 | Some commands may not have a key binding, but only be available as typed | |
391 | commands, such as: | |
392 | ||
393 | @table @code | |
394 | @item /ignore | |
395 | @cindex /ignore | |
396 | @cindex ignoring other people | |
397 | @cindex trolls, ignoring | |
398 | @cindex hide some posts | |
399 | @cindex idiots online | |
400 | This command toggles the ignore status of a nick, if you provide one. | |
401 | If you don't provide a nick, the command lists all the nicks you are | |
d177d64e AS |
402 | ignoring. All messages by ignored nicks are---you guessed it---ignored. |
403 | Since only ``operators'' can kick people from channels, the | |
97ed0ac3 EZ |
404 | ignore command is often the only way to deal with some of the more |
405 | obnoxious fellows online. Example: @code{/ignore xah}. | |
406 | @end table | |
407 | ||
408 | @node Useful IRC commands, Configuration, rcirc commands, Reference | |
409 | @section Useful IRC commands | |
410 | @cindex irc commands | |
411 | @cindex commands | |
412 | ||
413 | As mentioned, if a command isn't known by @code{rcirc}, it will simply be sent | |
414 | along to the server. Some such commands are available on nearly all IRC | |
415 | servers, such as: | |
416 | ||
417 | @table @code | |
418 | @item /away | |
419 | @cindex /away | |
420 | @cindex away status | |
421 | @cindex pause status | |
422 | @cindex unavailable status | |
423 | @cindex set away status | |
424 | This sets your status as ``being away'' if you provide a reason, or sets | |
425 | your status as ``being back'' if you do not. People can use the | |
426 | @kbd{C-c C-w} command to check your status. Example: @code{/away food}. | |
427 | @end table | |
428 | ||
429 | @cindex irc resources | |
430 | @cindex help about irc | |
431 | Typical IRC servers implement many more commands. You can read more | |
432 | about the fantastic world of IRC online at | |
433 | @indicateurl{http://www.irchelp.org/}, the Internet Relay Chat (IRC) | |
434 | help archive. | |
435 | ||
436 | @node Configuration, , Useful IRC commands, Reference | |
437 | @section Configuration | |
d177d64e | 438 | @cindex configuring rcirc |
97ed0ac3 EZ |
439 | |
440 | These are some variables you can change to configure @code{rcirc} to your | |
441 | liking. | |
442 | ||
443 | @table @code | |
444 | @item rcirc-server | |
445 | @vindex rcirc-server | |
446 | the default server to connect to. | |
447 | ||
448 | @item rcirc-port | |
449 | @vindex rcirc-port | |
450 | the default port to connect to. | |
451 | ||
452 | @item rcirc-nick | |
453 | @vindex rcirc-nick | |
454 | the default nick to use. | |
455 | @end table | |
456 | ||
457 | @example | |
458 | (setq rcirc-server "irc.mozilla.org" | |
459 | rcirc-port 6666 | |
460 | rcirc-nick "alx") | |
461 | @end example | |
462 | ||
463 | @vindex rcirc-user-full-name | |
464 | @cindex full name | |
465 | @cindex real name | |
466 | @cindex surname | |
467 | @code{rcirc-user-full-name} is used to set your ``real name'' on IRC. | |
468 | It defaults to @code{user-full-name}. If you want to hide your full | |
469 | name, you might want to set it to some pseudonym. | |
470 | ||
471 | @example | |
472 | (setq rcirc-user-full-name "Curious Minds Want To Know") | |
473 | @end example | |
474 | ||
475 | @vindex rcirc-startup-channels-alist | |
476 | @cindex channels, configuration | |
477 | @cindex initial channels, configuration | |
478 | @cindex startup channels, configuration | |
479 | @code{rcirc-startup-channels-alist} is the alist of channels to join | |
480 | when connecting to a particular network. An alist is a list of lists. | |
481 | Each sublist starts with a regular expression that is compared to the | |
482 | server address you're connecting to. The remaining sublist items are | |
483 | the channels to join. | |
484 | ||
485 | @example | |
486 | (setq rcirc-startup-channels-alist | |
487 | '(("\\.freenode\\.net$" "#emacs" "#rcirc" "#wiki"))) | |
488 | @end example | |
489 | ||
490 | Note the subtle problem, here --- IRC clients connect to servers, and | |
491 | there is no way of knowing which servers belong to a particular network. | |
492 | In the example above we're exploiting a naming convention used by within | |
493 | the Freenode network --- all servers within the network have a host in | |
494 | the @code{freenode.net} domain. | |
495 | ||
496 | @node Hacking and Tweaking, Key Index, Reference, Top | |
497 | @chapter Hacking and Tweaking | |
498 | @cindex hacking and tweaking | |
499 | ||
500 | Here are some examples of stuff you can do to configure @code{rcirc}. | |
501 | ||
502 | @menu | |
62e77f3d LT |
503 | * Skipping /away messages using handlers:: |
504 | * Using fly spell mode:: | |
505 | * Scrolling conservatively:: | |
506 | * Changing the time stamp format:: | |
507 | * Defining a new command:: | |
508 | * Reconnecting after you have lost the connection:: | |
97ed0ac3 EZ |
509 | @end menu |
510 | ||
511 | @node Skipping /away messages using handlers, Using fly spell mode, Hacking and Tweaking, Hacking and Tweaking | |
512 | @section Skipping @code{/away} messages using handlers | |
513 | @cindex /away messages | |
514 | ||
515 | @cindex handlers | |
516 | @cindex status codes | |
62e77f3d | 517 | The IRC protocol specifies how certain events are signaled from server |
97ed0ac3 EZ |
518 | to client. These events have numbers and are dealt with using so-called |
519 | handlers. You can override existing handlers by exploiting the naming | |
520 | convention adopted for @code{rcirc}. | |
521 | ||
522 | Here's how to stop @code{rcirc} from printing @code{/away} messages. | |
523 | Since @code{rcirc} doesn't define a 301 handler, you don't need to | |
524 | require @code{rcirc} before defining the handler: | |
525 | ||
526 | @example | |
527 | (defun rcirc-handler-301 (process cmd sender args) | |
528 | "/away message handler.") | |
529 | @end example | |
530 | ||
531 | @node Using fly spell mode, Scrolling conservatively, Skipping /away messages using handlers, Hacking and Tweaking | |
532 | @section Using fly spell mode | |
533 | @cindex fly spell | |
534 | @cindex spelling | |
535 | @cindex spell-checking as you type | |
536 | @cindex automatic spelling | |
537 | @vindex rcirc-mode-hook | |
538 | ||
539 | The following code activates Fly Spell Mode | |
540 | for @code{rcirc} buffers: | |
541 | ||
542 | @example | |
543 | (add-hook 'rcirc-mode-hook (lambda () | |
544 | (flyspell-mode 1))) | |
545 | @end example | |
546 | ||
547 | @xref{Spelling, , Flyspell mode, emacs, The GNU Emacs Manual}, | |
548 | for details. | |
549 | ||
550 | @node Scrolling conservatively, Changing the time stamp format, Using fly spell mode, Hacking and Tweaking | |
551 | @section Scrolling conservatively | |
552 | @cindex input line | |
553 | @cindex scrolling | |
554 | @vindex scroll-conservatively | |
555 | @vindex rcirc-mode-hook | |
556 | ||
557 | IRC buffers are constantly growing. If you want to see as much as | |
558 | possible at all times, you would want the prompt at the bottom of the | |
559 | window when possible. The following snippet uses a local value for | |
560 | @code{scroll-conservatively} to achieve this: | |
561 | ||
562 | @example | |
563 | (add-hook 'rcirc-mode-hook | |
564 | (lambda () | |
565 | (set (make-local-variable 'scroll-conservatively) | |
566 | 8192))) | |
567 | @end example | |
568 | ||
62e77f3d | 569 | @xref{Scrolling, , Scrolling conservatively, emacs, The GNU Emacs |
97ed0ac3 EZ |
570 | Manual}, for details. |
571 | ||
572 | @node Changing the time stamp format, Defining a new command, Scrolling conservatively, Hacking and Tweaking | |
573 | @section Changing the time stamp format | |
574 | @cindex time stamp | |
575 | @cindex date time | |
576 | @cindex format time stamp | |
577 | @vindex rcirc-time-format | |
578 | ||
579 | @code{rcirc-time-format} is the format used for the time stamp. Here's | |
580 | how to include the date in the time stamp: | |
581 | ||
582 | @example | |
583 | (setq rcirc-time-format "%Y-%m-%d %H:%M ") | |
584 | @end example | |
585 | ||
586 | @node Defining a new command, Reconnecting after you have lost the connection, Changing the time stamp format, Hacking and Tweaking | |
587 | @section Defining a new command | |
588 | @cindex defining commands | |
589 | @cindex commands, defining | |
590 | @cindex new commands, defining | |
591 | ||
592 | Here's a simple new command, @code{/sv}. With it, you can boast about | |
593 | your IRC client. It shows how you can use @code{defun-rcirc-command} to | |
594 | define new commands. | |
595 | ||
596 | We're waiting for the definition of this command until @code{rcirc} is loaded | |
597 | because @code{defun-rcirc-command} is not yet available, and without | |
598 | @code{rcirc} loaded, the command wouldn't do us much good anyway. | |
599 | ||
600 | @smallexample | |
601 | (eval-after-load 'rcirc | |
602 | '(defun-rcirc-command sv (arg) | |
603 | "Boast about rcirc." | |
604 | (interactive "i") | |
605 | (rcirc-send-message process target | |
606 | (concat "I use " rcirc-id-string)))) | |
607 | @end smallexample | |
608 | ||
609 | @node Reconnecting after you have lost the connection, , Defining a new command, Hacking and Tweaking | |
610 | @section Reconnecting after you have lost the connection | |
611 | @cindex reconnecting | |
612 | @cindex disconnecting servers, reconnecting | |
613 | ||
614 | If you're chatting from a laptop, then you might be familiar with this | |
615 | problem: When your laptop falls asleep and wakes up later, your IRC | |
616 | client doesn't realise that it has been disconnected. It takes several | |
617 | minutes until the client decides that the connection has in fact been | |
618 | lost. The simple solution is to use @kbd{M-x rcirc}. The problem is | |
619 | that this opens an @emph{additional} connection, so you'll have two | |
620 | copies of every channel buffer --- one dead and one live. | |
621 | ||
622 | The real answer, therefore, is a @code{/reconnect} command: | |
623 | ||
624 | @smallexample | |
625 | (eval-after-load 'rcirc | |
626 | '(defun-rcirc-command reconnect (arg) | |
627 | "Reconnect the server process." | |
628 | (interactive "i") | |
629 | (unless process | |
630 | (error "There's no process for this target")) | |
631 | (let* ((server (car (process-contact process))) | |
632 | (port (process-contact process :service)) | |
633 | (nick (with-rcirc-process-buffer process rcirc-nick)) | |
634 | channels query-buffers) | |
635 | (dolist (buf (buffer-list)) | |
636 | (with-current-buffer buf | |
637 | (when (eq process rcirc-process) | |
638 | (if (rcirc-channel-p rcirc-target) | |
639 | (setq channels (cons rcirc-target channels)) | |
640 | (setq query-buffers (cons buf query-buffers)))))) | |
641 | (delete-process process) | |
642 | (let ((new-process (rcirc-connect server port nick | |
643 | rcirc-user-name user-full-name | |
644 | channels))) | |
645 | (dolist (buf query-buffers) | |
646 | (with-current-buffer buf | |
647 | (setq rcirc-process new-process))))))) | |
648 | @end smallexample | |
649 | ||
650 | @node Key Index, Variable Index, Hacking and Tweaking, Top | |
651 | @unnumbered Key Index | |
652 | @printindex ky | |
653 | ||
654 | @node Variable Index, Index, Key Index, Top | |
655 | @unnumbered Variable Index | |
656 | @printindex vr | |
657 | ||
658 | @node Index, , Variable Index, Top | |
659 | @unnumbered Index | |
660 | @printindex cp | |
661 | ||
662 | @bye | |
cd7070ad MB |
663 | |
664 | @ignore | |
665 | arch-tag: 2589e562-3843-4ffc-8c2f-477cbad57c01 | |
666 | @end ignore |