Mercurial > emacs
annotate lisp/net/rcirc.el @ 72521:3b571ee389d0
*** empty log message ***
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 25 Aug 2006 20:44:49 +0000 |
parents | 5e47ca87ee3c |
children | 1c7de7b9540b 694bbb62a75d 6823a91487f2 |
rev | line source |
---|---|
66248 | 1 ;;; rcirc.el --- default, simple IRC client. |
2 | |
68648
067115a6e738
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68578
diff
changeset
|
3 ;; Copyright (C) 2005, 2006 Free Software Foundation, Inc. |
66248 | 4 |
5 ;; Author: Ryan Yeske | |
6 ;; URL: http://www.nongnu.org/rcirc | |
7 ;; Keywords: comm | |
8 | |
66272
79d2a5d86ee4
Now part of GNU Emacs. Update FSF's address.
Romain Francoise <romain@orebokech.com>
parents:
66258
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
66248 | 10 |
11 ;; This file is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; This file is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
66272
79d2a5d86ee4
Now part of GNU Emacs. Update FSF's address.
Romain Francoise <romain@orebokech.com>
parents:
66258
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
79d2a5d86ee4
Now part of GNU Emacs. Update FSF's address.
Romain Francoise <romain@orebokech.com>
parents:
66258
diff
changeset
|
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
79d2a5d86ee4
Now part of GNU Emacs. Update FSF's address.
Romain Francoise <romain@orebokech.com>
parents:
66258
diff
changeset
|
24 ;; Boston, MA 02110-1301, USA. |
66248 | 25 |
26 ;;; Commentary: | |
27 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
28 ;; Internet Relay Chat (IRC) is a form of instant communication over |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
29 ;; the Internet. It is mainly designed for group (many-to-many) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
30 ;; communication in discussion forums called channels, but also allows |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
31 ;; one-to-one communication. |
66248 | 32 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
33 ;; Rcirc has simple defaults and clear and consistent behaviour. |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
34 ;; Message arrival timestamps, activity notification on the modeline, |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
35 ;; message filling, nick completion, and keepalive pings are all |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
36 ;; enabled by default, but can easily be adjusted or turned off. Each |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
37 ;; discussion takes place in its own buffer and there is a single |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
38 ;; server buffer per connection. |
66248 | 39 |
40 ;; Open a new irc connection with: | |
41 ;; M-x irc RET | |
42 | |
72468 | 43 ;;; Todo: |
44 | |
66248 | 45 ;;; Code: |
46 | |
47 (require 'ring) | |
48 (require 'time-date) | |
49 (eval-when-compile (require 'cl)) | |
50 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
51 (defgroup rcirc nil |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
52 "Simple IRC client." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
53 :version "22.1" |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
54 :prefix "rcirc-" |
69461
1527bb09ec30
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-156
Miles Bader <miles@gnu.org>
parents:
69460
diff
changeset
|
55 :link '(custom-manual "(rcirc)") |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
56 :group 'applications) |
66248 | 57 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
58 (defcustom rcirc-default-server "irc.freenode.net" |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
59 "The default server to connect to." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
60 :type 'string |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
61 :group 'rcirc) |
66248 | 62 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
63 (defcustom rcirc-default-port 6667 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
64 "The default port to connect to." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
65 :type 'integer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
66 :group 'rcirc) |
66248 | 67 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
68 (defcustom rcirc-default-nick (user-login-name) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
69 "Your nick." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
70 :type 'string |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
71 :group 'rcirc) |
66248 | 72 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
73 (defcustom rcirc-default-user-name (user-login-name) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
74 "Your user name sent to the server when connecting." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
75 :type 'string |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
76 :group 'rcirc) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
77 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
78 (defcustom rcirc-default-user-full-name (if (string= (user-full-name) "") |
71442
00a28b680b71
(rcirc-default-user-full-name): Default to `rcirc-default-user-name' instead
Eli Zaretskii <eliz@gnu.org>
parents:
71440
diff
changeset
|
79 rcirc-default-user-name |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
80 (user-full-name)) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
81 "The full name sent to the server when connecting." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
82 :type 'string |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
83 :group 'rcirc) |
66248 | 84 |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
85 (defcustom rcirc-startup-channels-alist '(("^irc.freenode.net$" "#rcirc")) |
66248 | 86 "Alist of channels to join at startup. |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
87 Each element looks like (SERVER-REGEXP . CHANNEL-LIST)." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
88 :type '(alist :key-type string :value-type (repeat string)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
89 :group 'rcirc) |
66248 | 90 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
91 (defcustom rcirc-fill-flag t |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
92 "*Non-nil means line-wrap messages printed in channel buffers." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
93 :type 'boolean |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
94 :group 'rcirc) |
66248 | 95 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
96 (defcustom rcirc-fill-column nil |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
97 "*Column beyond which automatic line-wrapping should happen. |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
98 If nil, use value of `fill-column'. If 'frame-width, use the |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
99 maximum frame width." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
100 :type '(choice (const :tag "Value of `fill-column'") |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
101 (const :tag "Full frame width" frame-width) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
102 (integer :tag "Number of columns")) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
103 :group 'rcirc) |
66248 | 104 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
105 (defcustom rcirc-fill-prefix nil |
66248 | 106 "*Text to insert before filled lines. |
107 If nil, calculate the prefix dynamically to line up text | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
108 underneath each nick." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
109 :type '(choice (const :tag "Dynamic" nil) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
110 (string :tag "Prefix text")) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
111 :group 'rcirc) |
66248 | 112 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
113 (defvar rcirc-ignore-buffer-activity-flag nil |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
114 "If non-nil, ignore activity in this buffer.") |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
115 (make-variable-buffer-local 'rcirc-ignore-buffer-activity-flag) |
66248 | 116 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
117 (defvar rcirc-low-priority-flag nil |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
118 "If non-nil, activity in this buffer is considered low priority.") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
119 (make-variable-buffer-local 'rcirc-low-priority-flag) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
120 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
121 (defcustom rcirc-time-format "%H:%M " |
66248 | 122 "*Describes how timestamps are printed. |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
123 Used as the first arg to `format-time-string'." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
124 :type 'string |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
125 :group 'rcirc) |
66248 | 126 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
127 (defcustom rcirc-input-ring-size 1024 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
128 "*Size of input history ring." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
129 :type 'integer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
130 :group 'rcirc) |
66248 | 131 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
132 (defcustom rcirc-read-only-flag t |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
133 "*Non-nil means make text in IRC buffers read-only." |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
134 :type 'boolean |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
135 :group 'rcirc) |
66248 | 136 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
137 (defcustom rcirc-buffer-maximum-lines nil |
66248 | 138 "*The maximum size in lines for rcirc buffers. |
139 Channel buffers are truncated from the top to be no greater than this | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
140 number. If zero or nil, no truncating is done." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
141 :type '(choice (const :tag "No truncation" nil) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
142 (integer :tag "Number of lines")) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
143 :group 'rcirc) |
66248 | 144 |
72468 | 145 (defcustom rcirc-show-maximum-output t |
146 "*If non-nil, scroll buffer to keep the point at the bottom of | |
147 the window.") | |
148 | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
149 (defcustom rcirc-authinfo nil |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
150 "List of authentication passwords. |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
151 Each element of the list is a list with a SERVER-REGEXP string |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
152 and a method symbol followed by method specific arguments. |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
153 |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
154 The valid METHOD symbols are `nickserv', `chanserv' and |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
155 `bitlbee'. |
66248 | 156 |
157 The required ARGUMENTS for each METHOD symbol are: | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
158 `nickserv': NICK PASSWORD |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
159 `chanserv': NICK CHANNEL PASSWORD |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
160 `bitlbee': NICK PASSWORD |
66248 | 161 |
162 Example: | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
163 ((\"freenode\" nickserv \"bob\" \"p455w0rd\") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
164 (\"freenode\" chanserv \"bob\" \"#bobland\" \"passwd99\") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
165 (\"bitlbee\" bitlbee \"robert\" \"sekrit\"))" |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
166 :type '(alist :key-type (string :tag "Server") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
167 :value-type (choice (list :tag "NickServ" |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
168 (const nickserv) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
169 (string :tag "Nick") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
170 (string :tag "Password")) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
171 (list :tag "ChanServ" |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
172 (const chanserv) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
173 (string :tag "Nick") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
174 (string :tag "Channel") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
175 (string :tag "Password")) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
176 (list :tag "BitlBee" |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
177 (const bitlbee) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
178 (string :tag "Nick") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
179 (string :tag "Password")))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
180 :group 'rcirc) |
66248 | 181 |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
182 (defcustom rcirc-auto-authenticate-flag t |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
183 "*Non-nil means automatically send authentication string to server. |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
184 See also `rcirc-authinfo'." |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
185 :type 'boolean |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
186 :group 'rcirc) |
66248 | 187 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
188 (defcustom rcirc-prompt "> " |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
189 "Prompt string to use in IRC buffers. |
66248 | 190 |
191 The following replacements are made: | |
192 %n is your nick. | |
193 %s is the server. | |
194 %t is the buffer target, a channel or a user. | |
195 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
196 Setting this alone will not affect the prompt; |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
197 use either M-x customize or also call `rcirc-update-prompt'." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
198 :type 'string |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
199 :set 'rcirc-set-changed |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
200 :initialize 'custom-initialize-default |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
201 :group 'rcirc) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
202 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
203 (defcustom rcirc-ignore-list () |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
204 "List of ignored nicks. |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
205 Use /ignore to list them, use /ignore NICK to add or remove a nick." |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
206 :type '(repeat string) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
207 :group 'rcirc) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
208 |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
209 (defvar rcirc-ignore-list-automatic () |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
210 "List of ignored nicks added to `rcirc-ignore-list' because of renaming. |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
211 When an ignored person renames, their nick is added to both lists. |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
212 Nicks will be removed from the automatic list on follow-up renamings or |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
213 parts.") |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
214 |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
215 (defcustom rcirc-bright-nick-regexp nil |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
216 "Regexp matching nicks to be emphasized. |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
217 See `rcirc-bright-nick' face." |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
218 :type 'regexp |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
219 :group 'rcirc) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
220 |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
221 (defcustom rcirc-dim-nick-regexp nil |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
222 "Regexp matching nicks to be deemphasized. |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
223 See `rcirc-dim-nick' face." |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
224 :type 'regexp |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
225 :group 'rcirc) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
226 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
227 (defcustom rcirc-print-hooks nil |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
228 "Hook run after text is printed. |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
229 Called with 5 arguments, PROCESS, SENDER, RESPONSE, TARGET and TEXT." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
230 :type 'hook |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
231 :group 'rcirc) |
66248 | 232 |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
233 (defcustom rcirc-always-use-server-buffer-flag nil |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
234 "Non-nil means messages without a channel target will go to the server buffer." |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
235 :type 'boolean |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
236 :group 'rcirc) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
237 |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
238 (defcustom rcirc-decode-coding-system 'utf-8 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
239 "Coding system used to decode incoming irc messages." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
240 :type 'coding-system |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
241 :group 'rcirc) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
242 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
243 (defcustom rcirc-encode-coding-system 'utf-8 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
244 "Coding system used to encode outgoing irc messages." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
245 :type 'coding-system |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
246 :group 'rcirc) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
247 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
248 (defcustom rcirc-coding-system-alist nil |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
249 "Alist to decide a coding system to use for a file I/O operation. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
250 The format is ((PATTERN . VAL) ...). |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
251 PATTERN is either a string or a cons of strings. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
252 If PATTERN is a string, it is used to match a target. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
253 If PATTERN is a cons of strings, the car part is used to match a |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
254 target, and the cdr part is used to match a server. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
255 VAL is either a coding system or a cons of coding systems. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
256 If VAL is a coding system, it is used for both decoding and encoding |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
257 messages. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
258 If VAL is a cons of coding systems, the car part is used for decoding, |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
259 and the cdr part is used for encoding." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
260 :type '(alist :key-type (choice (string :tag "Channel Regexp") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
261 (cons (string :tag "Channel Regexp") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
262 (string :tag "Server Regexp"))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
263 :value-type (choice coding-system |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
264 (cons (coding-system :tag "Decode") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
265 (coding-system :tag "Encode")))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
266 :group 'rcirc) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
267 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
268 (defcustom rcirc-multiline-major-mode 'fundamental-mode |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
269 "Major-mode function to use in multiline edit buffers." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
270 :type 'function |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
271 :group 'rcirc) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
272 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
273 (defvar rcirc-nick nil) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
274 |
66248 | 275 (defvar rcirc-prompt-start-marker nil) |
276 (defvar rcirc-prompt-end-marker nil) | |
277 | |
278 (defvar rcirc-nick-table nil) | |
279 | |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
280 (defvar rcirc-nick-syntax-table |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
281 (let ((table (make-syntax-table text-mode-syntax-table))) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
282 (mapc (lambda (c) (modify-syntax-entry c "w" table)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
283 "[]\\`_^{|}-") |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
284 (modify-syntax-entry ?' "_" table) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
285 table) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
286 "Syntax table which includes all nick characters as word constituents.") |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
287 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
288 ;; each process has an alist of (target . buffer) pairs |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
289 (defvar rcirc-buffer-alist nil) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
290 |
66248 | 291 (defvar rcirc-activity nil |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
292 "List of buffers with unviewed activity.") |
66248 | 293 |
294 (defvar rcirc-activity-string "" | |
295 "String displayed in modeline representing `rcirc-activity'.") | |
296 (put 'rcirc-activity-string 'risky-local-variable t) | |
297 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
298 (defvar rcirc-server-buffer nil |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
299 "The server buffer associated with this channel buffer.") |
66248 | 300 |
301 (defvar rcirc-target nil | |
302 "The channel or user associated with this buffer.") | |
303 | |
304 (defvar rcirc-urls nil | |
305 "List of urls seen in the current buffer.") | |
72468 | 306 (put 'rcirc-urls 'permanent-local t) |
66248 | 307 |
308 (defvar rcirc-keepalive-seconds 60 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
309 "Number of seconds between keepalive pings. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
310 If nil, do not send keepalive pings.") |
66248 | 311 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
312 (defconst rcirc-id-string (concat "rcirc on GNU Emacs " emacs-version)) |
66248 | 313 |
314 (defvar rcirc-startup-channels nil) | |
315 ;;;###autoload | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
316 (defun rcirc (arg) |
66248 | 317 "Connect to IRC. |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
318 If ARG is non-nil, prompt for a server to connect to." |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
319 (interactive "P") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
320 (if arg |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
321 (let* ((server (read-string "IRC Server: " rcirc-default-server)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
322 (port (read-string "IRC Port: " (number-to-string rcirc-default-port))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
323 (nick (read-string "IRC Nick: " rcirc-default-nick)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
324 (channels (split-string |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
325 (read-string "IRC Channels: " |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
326 (mapconcat 'identity (rcirc-startup-channels server) " ")) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
327 "[, ]+" t))) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
328 (rcirc-connect server port nick rcirc-default-user-name rcirc-default-user-full-name |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
329 channels)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
330 ;; make new connection using defaults unless already connected to |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
331 ;; the default rcirc-server |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
332 (let (connected) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
333 (dolist (p (rcirc-process-list)) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
334 (when (string= rcirc-default-server (process-name p)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
335 (setq connected p))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
336 (if (not connected) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
337 (rcirc-connect rcirc-default-server rcirc-default-port |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
338 rcirc-default-nick rcirc-default-user-name |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
339 rcirc-default-user-full-name |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
340 (rcirc-startup-channels rcirc-default-server)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
341 (switch-to-buffer (process-buffer connected)) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
342 (message "Connected to %s" |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
343 (process-contact (get-buffer-process (current-buffer)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
344 :host)))))) |
66248 | 345 ;;;###autoload |
346 (defalias 'irc 'rcirc) | |
347 | |
348 | |
349 (defvar rcirc-process-output nil) | |
350 (defvar rcirc-topic nil) | |
351 (defvar rcirc-keepalive-timer nil) | |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
352 (defvar rcirc-last-server-message-time nil) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
353 (defvar rcirc-server nil) |
69694
f712cf2b3ceb
(rcirc-connect): Add autoload cookie.
Romain Francoise <romain@orebokech.com>
parents:
69461
diff
changeset
|
354 |
f712cf2b3ceb
(rcirc-connect): Add autoload cookie.
Romain Francoise <romain@orebokech.com>
parents:
69461
diff
changeset
|
355 ;;;###autoload |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
356 (defun rcirc-connect (&optional server port nick user-name full-name startup-channels) |
66248 | 357 (save-excursion |
358 (message "Connecting to %s..." server) | |
359 (let* ((inhibit-eol-conversion) | |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
360 (port-number (if port |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
361 (if (stringp port) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
362 (string-to-number port) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
363 port) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
364 rcirc-default-port)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
365 (server (or server rcirc-default-server)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
366 (nick (or nick rcirc-default-nick)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
367 (user-name (or user-name rcirc-default-user-name)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
368 (full-name (or full-name rcirc-default-user-full-name)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
369 (startup-channels startup-channels) |
66248 | 370 (process (open-network-stream server nil server port-number))) |
371 ;; set up process | |
372 (set-process-coding-system process 'raw-text 'raw-text) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
373 (switch-to-buffer (rcirc-generate-new-buffer-name process nil)) |
66248 | 374 (set-process-buffer process (current-buffer)) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
375 (rcirc-mode process nil) |
66248 | 376 (set-process-sentinel process 'rcirc-sentinel) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
377 (set-process-filter process 'rcirc-filter) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
378 (make-local-variable 'rcirc-server) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
379 (setq rcirc-server server) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
380 (make-local-variable 'rcirc-buffer-alist) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
381 (setq rcirc-buffer-alist nil) |
66248 | 382 (make-local-variable 'rcirc-nick-table) |
383 (setq rcirc-nick-table (make-hash-table :test 'equal)) | |
384 (make-local-variable 'rcirc-nick) | |
385 (setq rcirc-nick nick) | |
386 (make-local-variable 'rcirc-process-output) | |
387 (setq rcirc-process-output nil) | |
388 (make-local-variable 'rcirc-startup-channels) | |
389 (setq rcirc-startup-channels startup-channels) | |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
390 (make-local-variable 'rcirc-last-server-message-time) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
391 (setq rcirc-last-server-message-time (current-time)) |
66248 | 392 |
393 ;; identify | |
394 (rcirc-send-string process (concat "NICK " nick)) | |
395 (rcirc-send-string process (concat "USER " user-name | |
396 " hostname servername :" | |
397 full-name)) | |
398 | |
399 ;; setup ping timer if necessary | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
400 (when rcirc-keepalive-seconds |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
401 (unless rcirc-keepalive-timer |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
402 (setq rcirc-keepalive-timer |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
403 (run-at-time 0 rcirc-keepalive-seconds 'rcirc-keepalive)))) |
66248 | 404 |
405 (message "Connecting to %s...done" server) | |
406 | |
407 ;; return process object | |
408 process))) | |
409 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
410 (defmacro with-rcirc-process-buffer (process &rest body) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
411 (declare (indent 1) (debug t)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
412 `(with-current-buffer (process-buffer ,process) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
413 ,@body)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
414 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
415 (defmacro with-rcirc-server-buffer (&rest body) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
416 (declare (indent 0) (debug t)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
417 `(with-current-buffer rcirc-server-buffer |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
418 ,@body)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
419 |
66248 | 420 (defun rcirc-keepalive () |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
421 "Send keep alive pings to active rcirc processes. |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
422 Kill processes that have not received a server message since the |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
423 last ping." |
66248 | 424 (if (rcirc-process-list) |
425 (mapc (lambda (process) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
426 (with-rcirc-process-buffer process |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
427 (if (> (cadr (time-since rcirc-last-server-message-time)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
428 rcirc-keepalive-seconds) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
429 (kill-process process) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
430 (rcirc-send-string process (concat "PING " rcirc-server))))) |
66248 | 431 (rcirc-process-list)) |
432 (cancel-timer rcirc-keepalive-timer) | |
433 (setq rcirc-keepalive-timer nil))) | |
434 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
435 (defvar rcirc-debug-buffer " *rcirc debug*") |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
436 (defvar rcirc-debug-flag nil |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
437 "If non-nil, write information to `rcirc-debug-buffer'.") |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
438 (defun rcirc-debug (process text) |
66248 | 439 "Add an entry to the debug log including PROCESS and TEXT. |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
440 Debug text is written to `rcirc-debug-buffer' if `rcirc-debug-flag' |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
441 is non-nil." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
442 (when rcirc-debug-flag |
66248 | 443 (save-excursion |
444 (save-window-excursion | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
445 (set-buffer (get-buffer-create rcirc-debug-buffer)) |
66248 | 446 (goto-char (point-max)) |
447 (insert (concat | |
448 "[" | |
449 (format-time-string "%Y-%m-%dT%T ") (process-name process) | |
450 "] " | |
451 text)))))) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
452 |
66248 | 453 (defvar rcirc-sentinel-hooks nil |
454 "Hook functions called when the process sentinel is called. | |
455 Functions are called with PROCESS and SENTINEL arguments.") | |
456 | |
457 (defun rcirc-sentinel (process sentinel) | |
458 "Called when PROCESS receives SENTINEL." | |
459 (let ((sentinel (replace-regexp-in-string "\n" "" sentinel))) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
460 (rcirc-debug process (format "SENTINEL: %S %S\n" process sentinel)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
461 (with-rcirc-process-buffer process |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
462 (dolist (buffer (cons nil (mapcar 'cdr rcirc-buffer-alist))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
463 (with-current-buffer (or buffer (current-buffer)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
464 (rcirc-print process "rcirc.el" "ERROR" rcirc-target |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
465 (format "%s: %s (%S)" |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
466 (process-name process) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
467 sentinel |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
468 (process-status process)) t) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
469 ;; remove the prompt from buffers |
66248 | 470 (let ((inhibit-read-only t)) |
471 (delete-region rcirc-prompt-start-marker | |
472 rcirc-prompt-end-marker))))) | |
473 (run-hook-with-args 'rcirc-sentinel-hooks process sentinel))) | |
474 | |
475 (defun rcirc-process-list () | |
476 "Return a list of rcirc processes." | |
477 (let (ps) | |
478 (mapc (lambda (p) | |
71442
00a28b680b71
(rcirc-default-user-full-name): Default to `rcirc-default-user-name' instead
Eli Zaretskii <eliz@gnu.org>
parents:
71440
diff
changeset
|
479 (when (buffer-live-p (process-buffer p)) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
480 (with-rcirc-process-buffer p |
66248 | 481 (when (eq major-mode 'rcirc-mode) |
482 (setq ps (cons p ps)))))) | |
483 (process-list)) | |
484 ps)) | |
485 | |
486 (defvar rcirc-receive-message-hooks nil | |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
487 "Hook functions run when a message is received from server. |
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
488 Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") |
66248 | 489 (defun rcirc-filter (process output) |
490 "Called when PROCESS receives OUTPUT." | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
491 (rcirc-debug process output) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
492 (with-rcirc-process-buffer process |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
493 (setq rcirc-last-server-message-time (current-time)) |
66248 | 494 (setq rcirc-process-output (concat rcirc-process-output output)) |
495 (when (= (aref rcirc-process-output | |
496 (1- (length rcirc-process-output))) ?\n) | |
497 (mapc (lambda (line) | |
498 (rcirc-process-server-response process line)) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
499 (split-string rcirc-process-output "[\n\r]" t)) |
66248 | 500 (setq rcirc-process-output nil)))) |
501 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
502 (defvar rcirc-trap-errors-flag t) |
66248 | 503 (defun rcirc-process-server-response (process text) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
504 (if rcirc-trap-errors-flag |
66248 | 505 (condition-case err |
506 (rcirc-process-server-response-1 process text) | |
507 (error | |
508 (rcirc-print process "RCIRC" "ERROR" nil | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
509 (format "\"%s\" %s" text err) t))) |
66248 | 510 (rcirc-process-server-response-1 process text))) |
511 | |
512 (defun rcirc-process-server-response-1 (process text) | |
513 (if (string-match "^\\(:\\([^ ]+\\) \\)?\\([^ ]+\\) \\(.+\\)$" text) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
514 (let* ((user (match-string 2 text)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
515 (sender (rcirc-user-nick user)) |
66248 | 516 (cmd (match-string 3 text)) |
517 (args (match-string 4 text)) | |
518 (handler (intern-soft (concat "rcirc-handler-" cmd)))) | |
519 (string-match "^\\([^:]*\\):?\\(.+\\)?$" args) | |
520 (let* ((args1 (match-string 1 args)) | |
521 (args2 (match-string 2 args)) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
522 (args (delq nil (append (split-string args1 " " t) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
523 (list args2))))) |
66248 | 524 (if (not (fboundp handler)) |
525 (rcirc-handler-generic process cmd sender args text) | |
526 (funcall handler process sender args text)) | |
527 (run-hook-with-args 'rcirc-receive-message-hooks | |
528 process cmd sender args text))) | |
529 (message "UNHANDLED: %s" text))) | |
530 | |
531 (defun rcirc-handler-generic (process command sender args text) | |
532 "Generic server response handler." | |
533 (rcirc-print process sender command nil | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
534 (mapconcat 'identity (cdr args) " ") t)) |
66248 | 535 |
536 (defun rcirc-send-string (process string) | |
537 "Send PROCESS a STRING plus a newline." | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
538 (let ((string (concat (encode-coding-string string rcirc-encode-coding-system) |
66248 | 539 "\n"))) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
540 (unless (eq (process-status process) 'open) |
68077
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
541 (error "Network connection to %s is not open" |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
542 (process-name process))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
543 (rcirc-debug process string) |
66248 | 544 (process-send-string process string))) |
545 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
546 (defun rcirc-buffer-process (&optional buffer) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
547 "Return the process associated with channel BUFFER. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
548 With no argument or nil as argument, use the current buffer." |
72468 | 549 (get-buffer-process (if buffer |
550 (with-current-buffer buffer | |
551 rcirc-server-buffer) | |
552 rcirc-server-buffer))) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
553 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
554 (defun rcirc-server-name (process) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
555 "Return PROCESS server name, given by the 001 response." |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
556 (with-rcirc-process-buffer process |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
557 (or rcirc-server rcirc-default-server))) |
66248 | 558 |
559 (defun rcirc-nick (process) | |
560 "Return PROCESS nick." | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
561 (with-rcirc-process-buffer process |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
562 (or rcirc-nick rcirc-default-nick))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
563 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
564 (defun rcirc-buffer-nick (&optional buffer) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
565 "Return the nick associated with BUFFER. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
566 With no argument or nil as argument, use the current buffer." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
567 (with-current-buffer (or buffer (current-buffer)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
568 (with-current-buffer rcirc-server-buffer |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
569 (or rcirc-nick rcirc-default-nick)))) |
66248 | 570 |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
571 (defvar rcirc-max-message-length 420 |
66248 | 572 "Messages longer than this value will be split.") |
573 | |
574 (defun rcirc-send-message (process target message &optional noticep) | |
575 "Send TARGET associated with PROCESS a privmsg with text MESSAGE. | |
576 If NOTICEP is non-nil, send a notice instead of privmsg." | |
577 ;; max message length is 512 including CRLF | |
578 (let* ((response (if noticep "NOTICE" "PRIVMSG")) | |
579 (oversize (> (length message) rcirc-max-message-length)) | |
580 (text (if oversize | |
581 (substring message 0 rcirc-max-message-length) | |
582 message)) | |
583 (text (if (string= text "") | |
584 " " | |
585 text)) | |
586 (more (if oversize | |
587 (substring message rcirc-max-message-length)))) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
588 (rcirc-get-buffer-create process target) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
589 (rcirc-print process (rcirc-nick process) response target text) |
66248 | 590 (rcirc-send-string process (concat response " " target " :" text)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
591 (when more (rcirc-send-message process target more noticep)))) |
66248 | 592 |
593 (defvar rcirc-input-ring nil) | |
594 (defvar rcirc-input-ring-index 0) | |
595 (defun rcirc-prev-input-string (arg) | |
596 (ring-ref rcirc-input-ring (+ rcirc-input-ring-index arg))) | |
597 | |
598 (defun rcirc-insert-prev-input (arg) | |
599 (interactive "p") | |
600 (when (<= rcirc-prompt-end-marker (point)) | |
601 (delete-region rcirc-prompt-end-marker (point-max)) | |
602 (insert (rcirc-prev-input-string 0)) | |
603 (setq rcirc-input-ring-index (1+ rcirc-input-ring-index)))) | |
604 | |
605 (defun rcirc-insert-next-input (arg) | |
606 (interactive "p") | |
607 (when (<= rcirc-prompt-end-marker (point)) | |
608 (delete-region rcirc-prompt-end-marker (point-max)) | |
609 (setq rcirc-input-ring-index (1- rcirc-input-ring-index)) | |
610 (insert (rcirc-prev-input-string -1)))) | |
611 | |
612 (defvar rcirc-nick-completions nil) | |
613 (defvar rcirc-nick-completion-start-offset nil) | |
72468 | 614 |
66248 | 615 (defun rcirc-complete-nick () |
616 "Cycle through nick completions from list of nicks in channel." | |
617 (interactive) | |
72468 | 618 (if (eq last-command this-command) |
66248 | 619 (setq rcirc-nick-completions |
620 (append (cdr rcirc-nick-completions) | |
621 (list (car rcirc-nick-completions)))) | |
622 (setq rcirc-nick-completion-start-offset | |
623 (- (save-excursion | |
624 (if (re-search-backward " " rcirc-prompt-end-marker t) | |
625 (1+ (point)) | |
626 rcirc-prompt-end-marker)) | |
627 rcirc-prompt-end-marker)) | |
628 (setq rcirc-nick-completions | |
629 (let ((completion-ignore-case t)) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
630 (all-completions |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
631 (buffer-substring |
66248 | 632 (+ rcirc-prompt-end-marker |
633 rcirc-nick-completion-start-offset) | |
634 (point)) | |
635 (mapcar (lambda (x) (cons x nil)) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
636 (rcirc-channel-nicks (rcirc-buffer-process) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
637 rcirc-target)))))) |
66248 | 638 (let ((completion (car rcirc-nick-completions))) |
639 (when completion | |
72468 | 640 (rcirc-put-nick-channel (rcirc-buffer-process) completion rcirc-target) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
641 (delete-region (+ rcirc-prompt-end-marker |
72468 | 642 rcirc-nick-completion-start-offset) |
643 (point)) | |
66248 | 644 (insert (concat completion |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
645 (if (= (+ rcirc-prompt-end-marker |
66248 | 646 rcirc-nick-completion-start-offset) |
647 rcirc-prompt-end-marker) | |
648 ": ")))))) | |
649 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
650 (defun set-rcirc-decode-coding-system (coding-system) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
651 "Set the decode coding system used in this channel." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
652 (interactive "zCoding system for incoming messages: ") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
653 (setq rcirc-decode-coding-system coding-system)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
654 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
655 (defun set-rcirc-encode-coding-system (coding-system) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
656 "Set the encode coding system used in this channel." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
657 (interactive "zCoding system for outgoing messages: ") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
658 (setq rcirc-encode-coding-system coding-system)) |
66248 | 659 |
660 (defvar rcirc-mode-map (make-sparse-keymap) | |
661 "Keymap for rcirc mode.") | |
662 | |
663 (define-key rcirc-mode-map (kbd "RET") 'rcirc-send-input) | |
664 (define-key rcirc-mode-map (kbd "M-p") 'rcirc-insert-prev-input) | |
665 (define-key rcirc-mode-map (kbd "M-n") 'rcirc-insert-next-input) | |
666 (define-key rcirc-mode-map (kbd "TAB") 'rcirc-complete-nick) | |
667 (define-key rcirc-mode-map (kbd "C-c C-b") 'rcirc-browse-url) | |
668 (define-key rcirc-mode-map (kbd "C-c C-c") 'rcirc-edit-multiline) | |
669 (define-key rcirc-mode-map (kbd "C-c C-j") 'rcirc-cmd-join) | |
670 (define-key rcirc-mode-map (kbd "C-c C-k") 'rcirc-cmd-kick) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
671 (define-key rcirc-mode-map (kbd "C-c C-l") 'rcirc-toggle-low-priority) |
66248 | 672 (define-key rcirc-mode-map (kbd "C-c C-d") 'rcirc-cmd-mode) |
673 (define-key rcirc-mode-map (kbd "C-c C-m") 'rcirc-cmd-msg) | |
674 (define-key rcirc-mode-map (kbd "C-c C-r") 'rcirc-cmd-nick) ; rename | |
675 (define-key rcirc-mode-map (kbd "C-c C-o") 'rcirc-cmd-oper) | |
676 (define-key rcirc-mode-map (kbd "C-c C-p") 'rcirc-cmd-part) | |
677 (define-key rcirc-mode-map (kbd "C-c C-q") 'rcirc-cmd-query) | |
678 (define-key rcirc-mode-map (kbd "C-c C-t") 'rcirc-cmd-topic) | |
679 (define-key rcirc-mode-map (kbd "C-c C-n") 'rcirc-cmd-names) | |
680 (define-key rcirc-mode-map (kbd "C-c C-w") 'rcirc-cmd-whois) | |
681 (define-key rcirc-mode-map (kbd "C-c C-x") 'rcirc-cmd-quit) | |
682 (define-key rcirc-mode-map (kbd "C-c TAB") ; C-i | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
683 'rcirc-toggle-ignore-buffer-activity) |
66248 | 684 (define-key rcirc-mode-map (kbd "C-c C-s") 'rcirc-switch-to-server-buffer) |
685 (define-key rcirc-mode-map (kbd "C-c C-a") 'rcirc-jump-to-first-unread-line) | |
686 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
687 (defvar rcirc-browse-url-map (make-sparse-keymap) |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
688 "Keymap used for browsing URLs in `rcirc-mode'.") |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
689 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
690 (define-key rcirc-browse-url-map (kbd "RET") 'rcirc-browse-url-at-point) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
691 (define-key rcirc-browse-url-map (kbd "<mouse-2>") 'rcirc-browse-url-at-mouse) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
692 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
693 (defvar rcirc-short-buffer-name nil |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
694 "Generated abbreviation to use to indicate buffer activity.") |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
695 |
66248 | 696 (defvar rcirc-mode-hook nil |
697 "Hook run when setting up rcirc buffer.") | |
698 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
699 (defvar rcirc-last-post-time nil) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
700 |
66248 | 701 (defun rcirc-mode (process target) |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
702 "Major mode for IRC channel buffers. |
66248 | 703 |
704 \\{rcirc-mode-map}" | |
705 (kill-all-local-variables) | |
706 (use-local-map rcirc-mode-map) | |
707 (setq mode-name "rcirc") | |
708 (setq major-mode 'rcirc-mode) | |
709 | |
710 (make-local-variable 'rcirc-input-ring) | |
711 (setq rcirc-input-ring (make-ring rcirc-input-ring-size)) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
712 (make-local-variable 'rcirc-server-buffer) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
713 (setq rcirc-server-buffer (process-buffer process)) |
66248 | 714 (make-local-variable 'rcirc-target) |
715 (setq rcirc-target target) | |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
716 (make-local-variable 'rcirc-topic) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
717 (setq rcirc-topic nil) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
718 (make-local-variable 'rcirc-last-post-time) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
719 (setq rcirc-last-post-time (current-time)) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
720 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
721 (make-local-variable 'rcirc-short-buffer-name) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
722 (setq rcirc-short-buffer-name nil) |
66248 | 723 (make-local-variable 'rcirc-urls) |
724 (setq use-hard-newlines t) | |
725 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
726 (make-local-variable 'rcirc-decode-coding-system) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
727 (make-local-variable 'rcirc-encode-coding-system) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
728 (dolist (i rcirc-coding-system-alist) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
729 (let ((chan (if (consp (car i)) (caar i) (car i))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
730 (serv (if (consp (car i)) (cdar i) ""))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
731 (when (and (string-match chan (or target "")) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
732 (string-match serv (rcirc-server-name process))) |
71440
fd07cc034d56
(rcirc-mode): Fix initialization of coding systems based on
Eli Zaretskii <eliz@gnu.org>
parents:
70215
diff
changeset
|
733 (setq rcirc-decode-coding-system (if (consp (cdr i)) (cadr i) (cdr i)) |
fd07cc034d56
(rcirc-mode): Fix initialization of coding systems based on
Eli Zaretskii <eliz@gnu.org>
parents:
70215
diff
changeset
|
734 rcirc-encode-coding-system (if (consp (cdr i)) (cddr i) (cdr i)))))) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
735 |
66248 | 736 ;; setup the prompt and markers |
737 (make-local-variable 'rcirc-prompt-start-marker) | |
738 (setq rcirc-prompt-start-marker (make-marker)) | |
739 (set-marker rcirc-prompt-start-marker (point-max)) | |
740 (make-local-variable 'rcirc-prompt-end-marker) | |
741 (setq rcirc-prompt-end-marker (make-marker)) | |
742 (set-marker rcirc-prompt-end-marker (point-max)) | |
743 (rcirc-update-prompt) | |
744 (goto-char rcirc-prompt-end-marker) | |
745 (make-local-variable 'overlay-arrow-position) | |
746 (setq overlay-arrow-position (make-marker)) | |
747 (set-marker overlay-arrow-position nil) | |
748 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
749 ;; if the user changes the major mode or kills the buffer, there is |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
750 ;; cleanup work to do |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
751 (make-local-variable 'change-major-mode-hook) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
752 (add-hook 'change-major-mode-hook 'rcirc-change-major-mode-hook) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
753 (make-local-variable 'kill-buffer-hook) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
754 (add-hook 'kill-buffer-hook 'rcirc-kill-buffer-hook) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
755 |
72468 | 756 (make-local-variable 'window-scroll-functions) |
757 (add-hook 'window-scroll-functions 'rcirc-scroll-to-bottom) | |
758 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
759 ;; add to buffer list, and update buffer abbrevs |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
760 (when target ; skip server buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
761 (let ((buffer (current-buffer))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
762 (with-rcirc-process-buffer process |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
763 (setq rcirc-buffer-alist (cons (cons target buffer) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
764 rcirc-buffer-alist)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
765 (rcirc-update-short-buffer-names)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
766 |
66248 | 767 (run-hooks 'rcirc-mode-hook)) |
768 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
769 (defun rcirc-update-prompt (&optional all) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
770 "Reset the prompt string in the current buffer. |
66252
684cec8133e3
(with-rcirc-process-buffer): Move above its first user.
Romain Francoise <romain@orebokech.com>
parents:
66250
diff
changeset
|
771 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
772 If ALL is non-nil, update prompts in all IRC buffers." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
773 (if all |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
774 (mapc (lambda (process) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
775 (mapc (lambda (buffer) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
776 (with-current-buffer buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
777 (rcirc-update-prompt))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
778 (with-rcirc-process-buffer process |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
779 (mapcar 'cdr rcirc-buffer-alist)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
780 (rcirc-process-list)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
781 (let ((inhibit-read-only t) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
782 (prompt (or rcirc-prompt ""))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
783 (mapc (lambda (rep) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
784 (setq prompt |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
785 (replace-regexp-in-string (car rep) (cdr rep) prompt))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
786 (list (cons "%n" (rcirc-buffer-nick)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
787 (cons "%s" (with-rcirc-server-buffer (or rcirc-server ""))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
788 (cons "%t" (or rcirc-target "")))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
789 (save-excursion |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
790 (delete-region rcirc-prompt-start-marker rcirc-prompt-end-marker) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
791 (goto-char rcirc-prompt-start-marker) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
792 (let ((start (point))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
793 (insert-before-markers prompt) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
794 (set-marker rcirc-prompt-start-marker start) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
795 (when (not (zerop (- rcirc-prompt-end-marker |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
796 rcirc-prompt-start-marker))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
797 (add-text-properties rcirc-prompt-start-marker |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
798 rcirc-prompt-end-marker |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
799 (list 'face 'rcirc-prompt |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
800 'read-only t 'field t |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
801 'front-sticky t 'rear-nonsticky t)))))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
802 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
803 (defun rcirc-set-changed (option value) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
804 "Set OPTION to VALUE and do updates after a customization change." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
805 (set-default option value) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
806 (cond ((eq option 'rcirc-prompt) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
807 (rcirc-update-prompt 'all)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
808 (t |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
809 (error "Bad option %s" option)))) |
66248 | 810 |
811 (defun rcirc-channel-p (target) | |
812 "Return t if TARGET is a channel name." | |
813 (and target | |
814 (not (zerop (length target))) | |
815 (or (eq (aref target 0) ?#) | |
816 (eq (aref target 0) ?&)))) | |
817 | |
818 (defun rcirc-kill-buffer-hook () | |
819 "Part the channel when killing an rcirc buffer." | |
820 (when (eq major-mode 'rcirc-mode) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
821 (rcirc-clean-up-buffer "Killed buffer"))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
822 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
823 (defun rcirc-change-major-mode-hook () |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
824 "Part the channel when changing the major-mode." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
825 (rcirc-clean-up-buffer "Changed major mode")) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
826 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
827 (defun rcirc-clean-up-buffer (reason) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
828 (let ((buffer (current-buffer))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
829 (rcirc-clear-activity buffer) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
830 (when (and (rcirc-buffer-process) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
831 (eq (process-status (rcirc-buffer-process)) 'open)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
832 (with-rcirc-server-buffer |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
833 (setq rcirc-buffer-alist |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
834 (rassq-delete-all buffer rcirc-buffer-alist))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
835 (rcirc-update-short-buffer-names) |
66248 | 836 (if (rcirc-channel-p rcirc-target) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
837 (rcirc-send-string (rcirc-buffer-process) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
838 (concat "PART " rcirc-target " :" reason)) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
839 (when rcirc-target |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
840 (rcirc-remove-nick-channel (rcirc-buffer-process) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
841 (rcirc-buffer-nick) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
842 rcirc-target)))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
843 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
844 (defun rcirc-generate-new-buffer-name (process target) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
845 "Return a buffer name based on PROCESS and TARGET. |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
846 This is used for the initial name given to IRC buffers." |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
847 (if target |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
848 (concat target "@" (process-name process)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
849 (concat "*" (process-name process) "*"))) |
66248 | 850 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
851 (defun rcirc-get-buffer (process target &optional server) |
66248 | 852 "Return the buffer associated with the PROCESS and TARGET. |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
853 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
854 If optional argument SERVER is non-nil, return the server buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
855 if there is no existing buffer for TARGET, otherwise return nil." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
856 (with-rcirc-process-buffer process |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
857 (if (null target) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
858 (current-buffer) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
859 (let ((buffer (cdr (assoc-string target rcirc-buffer-alist t)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
860 (or buffer (when server (current-buffer))))))) |
66248 | 861 |
862 (defun rcirc-get-buffer-create (process target) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
863 "Return the buffer associated with the PROCESS and TARGET. |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
864 Create the buffer if it doesn't exist." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
865 (let ((buffer (rcirc-get-buffer process target))) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
866 (if (and buffer (buffer-live-p buffer)) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
867 (with-current-buffer buffer |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
868 (when (not rcirc-target) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
869 (setq rcirc-target target)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
870 buffer) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
871 ;; create the buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
872 (with-rcirc-process-buffer process |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
873 (let ((new-buffer (get-buffer-create |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
874 (rcirc-generate-new-buffer-name process target)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
875 (with-current-buffer new-buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
876 (rcirc-mode process target)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
877 (rcirc-put-nick-channel process (rcirc-nick process) target) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
878 new-buffer))))) |
66248 | 879 |
880 (defun rcirc-send-input () | |
881 "Send input to target associated with the current buffer." | |
882 (interactive) | |
68077
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
883 (if (< (point) rcirc-prompt-end-marker) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
884 ;; copy the line down to the input area |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
885 (progn |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
886 (forward-line 0) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
887 (let ((start (if (eq (point) (point-min)) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
888 (point) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
889 (if (get-text-property (1- (point)) 'hard) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
890 (point) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
891 (previous-single-property-change (point) 'hard)))) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
892 (end (next-single-property-change (1+ (point)) 'hard))) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
893 (goto-char (point-max)) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
894 (insert (replace-regexp-in-string |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
895 "\n\\s-+" " " |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
896 (buffer-substring-no-properties start end))))) |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
897 ;; process input |
7e0fcbf84eb8
(rcirc-send-input): No longer check whether the
Alex Schroeder <alex@gnu.org>
parents:
67014
diff
changeset
|
898 (goto-char (point-max)) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
899 (when (not (equal 0 (- (point) rcirc-prompt-end-marker))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
900 ;; delete a trailing newline |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
901 (when (eq (point) (point-at-bol)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
902 (delete-backward-char 1)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
903 (let ((input (buffer-substring-no-properties |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
904 rcirc-prompt-end-marker (point)))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
905 (dolist (line (split-string input "\n")) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
906 (rcirc-process-input-line line)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
907 ;; add to input-ring |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
908 (save-excursion |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
909 (ring-insert rcirc-input-ring input) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
910 (setq rcirc-input-ring-index 0)))))) |
66248 | 911 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
912 (defun rcirc-process-input-line (line) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
913 (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" line) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
914 (rcirc-process-command (match-string 1 line) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
915 (match-string 2 line) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
916 line) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
917 (rcirc-process-message line))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
918 |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
919 (defun rcirc-process-message (line) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
920 (if (not rcirc-target) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
921 (message "Not joined (no target)") |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
922 (delete-region rcirc-prompt-end-marker (point)) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
923 (rcirc-send-message (rcirc-buffer-process) rcirc-target line) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
924 (setq rcirc-last-post-time (current-time)))) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
925 |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
926 (defun rcirc-process-command (command args line) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
927 (if (eq (aref command 0) ?/) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
928 ;; "//text" will send "/text" as a message |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
929 (rcirc-process-message (substring line 1)) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
930 (let ((fun (intern-soft (concat "rcirc-cmd-" command))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
931 (process (rcirc-buffer-process))) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
932 (newline) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
933 (with-current-buffer (current-buffer) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
934 (delete-region rcirc-prompt-end-marker (point)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
935 (if (string= command "me") |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
936 (rcirc-print process (rcirc-buffer-nick) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
937 "ACTION" rcirc-target args) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
938 (rcirc-print process (rcirc-buffer-nick) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
939 "COMMAND" rcirc-target line)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
940 (set-marker rcirc-prompt-end-marker (point)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
941 (if (fboundp fun) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
942 (funcall fun args process rcirc-target) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
943 (rcirc-send-string process |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
944 (concat command " " args))))))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
945 |
66248 | 946 (defvar rcirc-parent-buffer nil) |
947 (defvar rcirc-window-configuration nil) | |
948 (defun rcirc-edit-multiline () | |
949 "Move current edit to a dedicated buffer." | |
950 (interactive) | |
951 (let ((pos (1+ (- (point) rcirc-prompt-end-marker)))) | |
952 (goto-char (point-max)) | |
953 (let ((text (buffer-substring rcirc-prompt-end-marker (point))) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
954 (parent (buffer-name))) |
66248 | 955 (delete-region rcirc-prompt-end-marker (point)) |
956 (setq rcirc-window-configuration (current-window-configuration)) | |
957 (pop-to-buffer (concat "*multiline " parent "*")) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
958 (funcall rcirc-multiline-major-mode) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
959 (rcirc-multiline-minor-mode 1) |
66248 | 960 (setq rcirc-parent-buffer parent) |
961 (insert text) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
962 (and (> pos 0) (goto-char pos)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
963 (message "Type C-c C-c to return text to %s, or C-c C-k to cancel" parent)))) |
66248 | 964 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
965 (defvar rcirc-multiline-minor-mode-map (make-sparse-keymap) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
966 "Keymap for multiline mode in rcirc.") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
967 (define-key rcirc-multiline-minor-mode-map |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
968 (kbd "C-c C-c") 'rcirc-multiline-minor-submit) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
969 (define-key rcirc-multiline-minor-mode-map |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
970 (kbd "C-x C-s") 'rcirc-multiline-minor-submit) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
971 (define-key rcirc-multiline-minor-mode-map |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
972 (kbd "C-c C-k") 'rcirc-multiline-minor-cancel) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
973 (define-key rcirc-multiline-minor-mode-map |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
974 (kbd "ESC ESC ESC") 'rcirc-multiline-minor-cancel) |
66248 | 975 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
976 (define-minor-mode rcirc-multiline-minor-mode |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
977 "Minor mode for editing multiple lines in rcirc." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
978 :init-value nil |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
979 :lighter " rcirc-mline" |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
980 :keymap rcirc-multiline-minor-mode-map |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
981 :global nil |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
982 :group 'rcirc |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
983 (make-local-variable 'rcirc-parent-buffer) |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
984 (put 'rcirc-parent-buffer 'permanent-local t) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
985 (setq fill-column rcirc-max-message-length)) |
66248 | 986 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
987 (defun rcirc-multiline-minor-submit () |
66248 | 988 "Send the text in buffer back to parent buffer." |
989 (interactive) | |
990 (assert rcirc-parent-buffer) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
991 (untabify (point-min) (point-max)) |
66248 | 992 (let ((text (buffer-substring (point-min) (point-max))) |
993 (buffer (current-buffer)) | |
994 (pos (point))) | |
995 (set-buffer rcirc-parent-buffer) | |
996 (goto-char (point-max)) | |
997 (insert text) | |
998 (kill-buffer buffer) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
999 (set-window-configuration rcirc-window-configuration) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1000 (goto-char (+ rcirc-prompt-end-marker (1- pos))))) |
66248 | 1001 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1002 (defun rcirc-multiline-minor-cancel () |
66248 | 1003 "Cancel the multiline edit." |
1004 (interactive) | |
1005 (kill-buffer (current-buffer)) | |
1006 (set-window-configuration rcirc-window-configuration)) | |
1007 | |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1008 (defun rcirc-any-buffer (process) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1009 "Return a buffer for PROCESS, either the one selected or the process buffer." |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1010 (if rcirc-always-use-server-buffer-flag |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1011 (process-buffer process) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1012 (let ((buffer (window-buffer (selected-window)))) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1013 (if (and buffer |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1014 (with-current-buffer buffer |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1015 (and (eq major-mode 'rcirc-mode) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1016 (eq (rcirc-buffer-process) process)))) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1017 buffer |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1018 (process-buffer process))))) |
66248 | 1019 |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1020 (defcustom rcirc-response-formats |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1021 '(("PRIVMSG" . "%T<%N> %m") |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1022 ("NOTICE" . "%T-%N- %m") |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1023 ("ACTION" . "%T[%N %m]") |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1024 ("COMMAND" . "%T%m") |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1025 ("ERROR" . "%T%fw!!! %m") |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1026 (t . "%T%fp*** %fs%n %r %m")) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1027 "An alist of formats used for printing responses. |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1028 The format is looked up using the response-type as a key; |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1029 if no match is found, the default entry (with a key of `t') is used. |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1030 |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1031 The entry's value part should be a string, which is inserted with |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1032 the of the following escape sequences replaced by the described values: |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1033 |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1034 %m The message text |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1035 %n The sender's nick |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1036 %N The sender's nick (with face `rcirc-my-nick' or `rcirc-other-nick') |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1037 %r The response-type |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1038 %T The timestamp (with face `rcirc-timestamp') |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1039 %t The target |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1040 %fw Following text uses the face `font-lock-warning-face' |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1041 %fp Following text uses the face `rcirc-server-prefix' |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1042 %fs Following text uses the face `rcirc-server' |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1043 %f[FACE] Following text uses the face FACE |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1044 %f- Following text uses the default face |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1045 %% A literal `%' character" |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1046 :type '(alist :key-type (choice (string :tag "Type") |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1047 (const :tag "Default" t)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1048 :value-type string) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1049 :group 'rcirc) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1050 |
66248 | 1051 (defun rcirc-format-response-string (process sender response target text) |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1052 "Return a nicely-formatted response string, incorporating TEXT |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1053 \(and perhaps other arguments). The specific formatting used |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1054 is found by looking up RESPONSE in `rcirc-response-formats'." |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1055 (let ((chunks |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1056 (split-string (or (cdr (assoc response rcirc-response-formats)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1057 (cdr (assq t rcirc-response-formats))) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1058 "%")) |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1059 (sender (or sender "")) |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1060 (result "") |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1061 (face nil) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1062 key face-key repl) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1063 (when (equal (car chunks) "") |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1064 (pop chunks)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1065 (dolist (chunk chunks) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1066 (if (equal chunk "") |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1067 (setq key ?%) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1068 (setq key (aref chunk 0)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1069 (setq chunk (substring chunk 1))) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1070 (setq repl |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1071 (cond ((eq key ?%) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1072 ;; %% -- literal % character |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1073 "%") |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1074 ((or (eq key ?n) (eq key ?N)) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1075 ;; %n/%N -- nick |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1076 (let ((nick (concat (if (string= (with-rcirc-process-buffer process |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1077 rcirc-server) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1078 sender) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1079 "" |
69460
df75d16d140e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-155
Miles Bader <miles@gnu.org>
parents:
69252
diff
changeset
|
1080 sender) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1081 (and target (concat "," target))))) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1082 (rcirc-facify nick |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1083 (if (eq key ?n) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1084 face |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1085 (cond ((string= sender (rcirc-nick process)) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1086 'rcirc-my-nick) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1087 ((and rcirc-bright-nick-regexp |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1088 (string-match rcirc-bright-nick-regexp sender)) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1089 'rcirc-bright-nick) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1090 ((and rcirc-dim-nick-regexp |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1091 (string-match rcirc-dim-nick-regexp sender)) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1092 'rcirc-dim-nick) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1093 (t |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1094 'rcirc-other-nick)))))) |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1095 ((eq key ?T) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1096 ;; %T -- timestamp |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1097 (rcirc-facify |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1098 (format-time-string rcirc-time-format (current-time)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1099 'rcirc-timestamp)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1100 ((eq key ?m) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1101 ;; %m -- message text |
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1102 ;; We add the text property `rcirc-text' to identify this |
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1103 ;; as the body text. |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1104 (propertize |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1105 (rcirc-mangle-text process (rcirc-facify text face)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1106 'rcirc-text text)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1107 ((eq key ?t) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1108 ;; %t -- target |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1109 (rcirc-facify (or rcirc-target "") face)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1110 ((eq key ?r) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1111 ;; %r -- response |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1112 (rcirc-facify response face)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1113 ((eq key ?f) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1114 ;; %f -- change face |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1115 (setq face-key (aref chunk 0)) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1116 (setq chunk (substring chunk 1)) |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1117 (cond ((eq face-key ?w) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1118 ;; %fw -- warning face |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1119 (setq face 'font-lock-warning-face)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1120 ((eq face-key ?p) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1121 ;; %fp -- server-prefix face |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1122 (setq face 'rcirc-server-prefix)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1123 ((eq face-key ?s) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1124 ;; %fs -- warning face |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1125 (setq face 'rcirc-server)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1126 ((eq face-key ?-) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1127 ;; %fs -- warning face |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1128 (setq face nil)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1129 ((and (eq face-key ?\[) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1130 (string-match "^\\([^]]*\\)[]]" chunk) |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1131 (facep (match-string 1 chunk))) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1132 ;; %f[...] -- named face |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1133 (setq face (intern (match-string 1 chunk))) |
68838
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1134 (setq chunk (substring chunk (match-end 0))))) |
6a3bf61d8473
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-79
Miles Bader <miles@gnu.org>
parents:
68807
diff
changeset
|
1135 ""))) |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1136 (setq result (concat result repl (rcirc-facify chunk face)))) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1137 result)) |
66248 | 1138 |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1139 (defun rcirc-target-buffer (process sender response target text) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1140 "Return a buffer to print the server response." |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1141 (assert (not (bufferp target))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1142 (with-rcirc-process-buffer process |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1143 (cond ((not target) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1144 (rcirc-any-buffer process)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1145 ((not (rcirc-channel-p target)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1146 ;; message from another user |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1147 (if (string= response "PRIVMSG") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1148 (rcirc-get-buffer-create process (if (string= sender rcirc-nick) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1149 target |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1150 sender)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1151 (rcirc-get-buffer process target t))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1152 ((or (rcirc-get-buffer process target) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1153 (rcirc-any-buffer process)))))) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1154 |
66248 | 1155 (defvar rcirc-activity-type nil) |
1156 (make-variable-buffer-local 'rcirc-activity-type) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1157 (defvar rcirc-last-sender nil) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1158 (make-variable-buffer-local 'rcirc-last-sender) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1159 (defvar rcirc-gray-toggle nil) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1160 (make-variable-buffer-local 'rcirc-gray-toggle) |
72468 | 1161 |
1162 (defun rcirc-scroll-to-bottom (window display-start) | |
1163 "Scroll window to show maximum output if `rcirc-show-maximum-output' is | |
1164 non-nil." | |
1165 (when rcirc-show-maximum-output | |
1166 (with-selected-window window | |
1167 (when (>= (window-point) rcirc-prompt-end-marker) | |
1168 (recenter -1))))) | |
1169 | |
66248 | 1170 (defun rcirc-print (process sender response target text &optional activity) |
1171 "Print TEXT in the buffer associated with TARGET. | |
1172 Format based on SENDER and RESPONSE. If ACTIVITY is non-nil, | |
1173 record activity." | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1174 (or text (setq text "")) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1175 (unless (or (member sender rcirc-ignore-list) |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1176 (member (with-syntax-table rcirc-nick-syntax-table |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1177 (when (string-match "^\\([^/]\\w*\\)[:,]" text) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1178 (match-string 1 text))) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1179 rcirc-ignore-list)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1180 (let* ((buffer (rcirc-target-buffer process sender response target text)) |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1181 (inhibit-read-only t)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1182 (with-current-buffer buffer |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1183 (let ((moving (= (point) rcirc-prompt-end-marker)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1184 (old-point (point-marker)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1185 (fill-start (marker-position rcirc-prompt-start-marker))) |
66248 | 1186 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1187 (unless (string= sender (rcirc-nick process)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1188 ;; only decode text from other senders, not ours |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1189 (setq text (decode-coding-string text rcirc-decode-coding-system)) |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1190 ;; mark the line with overlay arrow |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1191 (unless (or (marker-position overlay-arrow-position) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1192 (get-buffer-window (current-buffer))) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1193 (set-marker overlay-arrow-position |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1194 (marker-position rcirc-prompt-start-marker)))) |
66248 | 1195 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1196 ;; temporarily set the marker insertion-type because |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1197 ;; insert-before-markers results in hidden text in new buffers |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1198 (goto-char rcirc-prompt-start-marker) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1199 (set-marker-insertion-type rcirc-prompt-start-marker t) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1200 (set-marker-insertion-type rcirc-prompt-end-marker t) |
68807
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1201 |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1202 (let ((fmted-text |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1203 (rcirc-format-response-string process sender response nil |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1204 text))) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1205 |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1206 (insert fmted-text (propertize "\n" 'hard t)) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1207 (set-marker-insertion-type rcirc-prompt-start-marker nil) |
7ba97c461db7
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-69
Miles Bader <miles@gnu.org>
parents:
68731
diff
changeset
|
1208 (set-marker-insertion-type rcirc-prompt-end-marker nil) |
66248 | 1209 |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1210 (let ((text-start (make-marker))) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1211 (set-marker text-start |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1212 (or (next-single-property-change fill-start |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1213 'rcirc-text) |
69461
1527bb09ec30
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-156
Miles Bader <miles@gnu.org>
parents:
69460
diff
changeset
|
1214 rcirc-prompt-end-marker)) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1215 ;; squeeze spaces out of text before rcirc-text |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1216 (fill-region fill-start (1- text-start)) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1217 |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1218 ;; fill the text we just inserted, maybe |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1219 (when (and rcirc-fill-flag |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1220 (not (string= response "372"))) ;/motd |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1221 (let ((fill-prefix |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1222 (or rcirc-fill-prefix |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1223 (make-string (- text-start fill-start) ?\s))) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1224 (fill-column (cond ((eq rcirc-fill-column 'frame-width) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1225 (1- (frame-width))) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1226 (rcirc-fill-column |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1227 rcirc-fill-column) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1228 (t fill-column)))) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1229 (fill-region fill-start rcirc-prompt-start-marker 'left t))))) |
66248 | 1230 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1231 ;; set inserted text to be read-only |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1232 (when rcirc-read-only-flag |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1233 (put-text-property rcirc-prompt-start-marker fill-start 'read-only t) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1234 (let ((inhibit-read-only t)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1235 (put-text-property rcirc-prompt-start-marker fill-start |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1236 'front-sticky t) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1237 (put-text-property (1- (point)) (point) 'rear-nonsticky t))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1238 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1239 ;; truncate buffer if it is very long |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1240 (save-excursion |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1241 (when (and rcirc-buffer-maximum-lines |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1242 (> rcirc-buffer-maximum-lines 0) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1243 (= (forward-line (- rcirc-buffer-maximum-lines)) 0)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1244 (delete-region (point-min) (point)))) |
66248 | 1245 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1246 ;; set the window point for buffers show in windows |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1247 (walk-windows (lambda (w) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1248 (unless (eq (selected-window) w) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1249 (when (and (eq (current-buffer) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1250 (window-buffer w)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1251 (>= (window-point w) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1252 rcirc-prompt-end-marker)) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1253 (set-window-point w (point-max))))) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1254 nil t) |
66248 | 1255 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1256 ;; restore the point |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1257 (goto-char (if moving rcirc-prompt-end-marker old-point)) |
66248 | 1258 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1259 ;; flush undo (can we do something smarter here?) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1260 (buffer-disable-undo) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1261 (buffer-enable-undo)) |
66248 | 1262 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1263 ;; record modeline activity |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1264 (when activity |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1265 (let ((nick-match |
72468 | 1266 (with-syntax-table rcirc-nick-syntax-table |
1267 (string-match (concat "\\b" | |
1268 (regexp-quote (rcirc-nick process)) | |
1269 "\\b") | |
1270 text)))) | |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1271 (when (if rcirc-ignore-buffer-activity-flag |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1272 ;; - Always notice when our nick is mentioned |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1273 nick-match |
72468 | 1274 ;; - unless our nick is mentioned, don't bother us |
1275 ;; - with dim-nicks | |
1276 (or nick-match | |
1277 (not (and rcirc-dim-nick-regexp sender | |
1278 (string-match rcirc-dim-nick-regexp sender))))) | |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1279 (rcirc-record-activity |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1280 (current-buffer) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1281 (when (or nick-match (and (not (rcirc-channel-p rcirc-target)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1282 (not rcirc-low-priority-flag))) |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1283 'nick))))) |
66248 | 1284 |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1285 (sit-for 0) ; displayed text before hook |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1286 (run-hook-with-args 'rcirc-print-hooks |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1287 process sender response target text))))) |
66248 | 1288 |
1289 (defun rcirc-startup-channels (server) | |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1290 "Return the list of startup channels for SERVER." |
66248 | 1291 (let (channels) |
1292 (dolist (i rcirc-startup-channels-alist) | |
1293 (if (string-match (car i) server) | |
1294 (setq channels (append channels (cdr i))))) | |
1295 channels)) | |
1296 | |
1297 (defun rcirc-join-channels (process channels) | |
1298 "Join CHANNELS." | |
1299 (save-window-excursion | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1300 (dolist (channel channels) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1301 (with-rcirc-process-buffer process |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1302 (rcirc-cmd-join channel process))))) |
66248 | 1303 |
1304 ;;; nick management | |
1305 (defun rcirc-user-nick (user) | |
1306 "Return the nick from USER. Remove any non-nick junk." | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1307 (save-match-data |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1308 (if (string-match "^[@%+]?\\([^! ]+\\)!?" (or user "")) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1309 (match-string 1 user) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1310 user))) |
66248 | 1311 |
1312 (defun rcirc-user-non-nick (user) | |
1313 "Return the non-nick portion of USER." | |
1314 (if (string-match "^[@+]?[^! ]+!?\\(.*\\)" (or user "")) | |
1315 (match-string 1 user) | |
1316 user)) | |
1317 | |
1318 (defun rcirc-nick-channels (process nick) | |
1319 "Return list of channels for NICK." | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1320 (with-rcirc-process-buffer process |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1321 (mapcar (lambda (x) (car x)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1322 (gethash nick rcirc-nick-table)))) |
66248 | 1323 |
1324 (defun rcirc-put-nick-channel (process nick channel) | |
1325 "Add CHANNEL to list associated with NICK." | |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1326 (let ((nick (rcirc-user-nick nick))) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1327 (with-rcirc-process-buffer process |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1328 (let* ((chans (gethash nick rcirc-nick-table)) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1329 (record (assoc-string channel chans t))) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1330 (if record |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1331 (setcdr record (current-time)) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1332 (puthash nick (cons (cons channel (current-time)) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1333 chans) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1334 rcirc-nick-table)))))) |
66248 | 1335 |
1336 (defun rcirc-nick-remove (process nick) | |
1337 "Remove NICK from table." | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1338 (with-rcirc-process-buffer process |
66248 | 1339 (remhash nick rcirc-nick-table))) |
1340 | |
1341 (defun rcirc-remove-nick-channel (process nick channel) | |
1342 "Remove the CHANNEL from list associated with NICK." | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1343 (with-rcirc-process-buffer process |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1344 (let* ((chans (gethash nick rcirc-nick-table)) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1345 (newchans |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1346 ;; instead of assoc-string-delete-all: |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1347 (let ((record (assoc-string channel chans t))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1348 (when record |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1349 (setcar record 'delete) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1350 (assq-delete-all 'delete chans))))) |
66248 | 1351 (if newchans |
1352 (puthash nick newchans rcirc-nick-table) | |
1353 (remhash nick rcirc-nick-table))))) | |
1354 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1355 (defun rcirc-channel-nicks (process target) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1356 "Return the list of nicks associated with TARGET sorted by last activity." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1357 (when target |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1358 (if (rcirc-channel-p target) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1359 (with-rcirc-process-buffer process |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1360 (let (nicks) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1361 (maphash |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1362 (lambda (k v) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1363 (let ((record (assoc-string target v t))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1364 (if record |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1365 (setq nicks (cons (cons k (cdr record)) nicks))))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1366 rcirc-nick-table) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1367 (mapcar (lambda (x) (car x)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1368 (sort nicks (lambda (x y) (time-less-p (cdr y) (cdr x))))))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1369 (list target)))) |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1370 |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1371 (defun rcirc-ignore-update-automatic (nick) |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1372 "Remove NICK from `rcirc-ignore-list' |
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1373 if NICK is also on `rcirc-ignore-list-automatic'." |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1374 (when (member nick rcirc-ignore-list-automatic) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1375 (setq rcirc-ignore-list-automatic |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1376 (delete nick rcirc-ignore-list-automatic) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1377 rcirc-ignore-list |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1378 (delete nick rcirc-ignore-list)))) |
66248 | 1379 |
1380 ;;; activity tracking | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1381 (defvar rcirc-track-minor-mode-map (make-sparse-keymap) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1382 "Keymap for rcirc track minor mode.") |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1383 |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1384 (define-key rcirc-track-minor-mode-map (kbd "C-c `") 'rcirc-next-active-buffer) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1385 (define-key rcirc-track-minor-mode-map (kbd "C-c C-@") 'rcirc-next-active-buffer) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1386 (define-key rcirc-track-minor-mode-map (kbd "C-c C-SPC") 'rcirc-next-active-buffer) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1387 |
69461
1527bb09ec30
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-156
Miles Bader <miles@gnu.org>
parents:
69460
diff
changeset
|
1388 ;;;###autoload |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1389 (define-minor-mode rcirc-track-minor-mode |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1390 "Global minor mode for tracking activity in rcirc buffers." |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1391 :init-value nil |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1392 :lighter "" |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1393 :keymap rcirc-track-minor-mode-map |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1394 :global t |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1395 :group 'rcirc |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1396 (or global-mode-string (setq global-mode-string '(""))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1397 ;; toggle the mode-line channel indicator |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1398 (if rcirc-track-minor-mode |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1399 (progn |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1400 (and (not (memq 'rcirc-activity-string global-mode-string)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1401 (setq global-mode-string |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1402 (append global-mode-string '(rcirc-activity-string)))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1403 (add-hook 'window-configuration-change-hook |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1404 'rcirc-window-configuration-change)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1405 (setq global-mode-string |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1406 (delete 'rcirc-activity-string global-mode-string)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1407 (remove-hook 'window-configuration-change-hook |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1408 'rcirc-window-configuration-change))) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1409 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1410 (or (assq 'rcirc-ignore-buffer-activity-flag minor-mode-alist) |
66248 | 1411 (setq minor-mode-alist |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1412 (cons '(rcirc-ignore-buffer-activity-flag " Ignore") minor-mode-alist))) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1413 (or (assq 'rcirc-low-priority-flag minor-mode-alist) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1414 (setq minor-mode-alist |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1415 (cons '(rcirc-low-priority-flag " LowPri") minor-mode-alist))) |
66248 | 1416 |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1417 (defun rcirc-toggle-ignore-buffer-activity () |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1418 "Toggle the value of `rcirc-ignore-buffer-activity-flag'." |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1419 (interactive) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1420 (setq rcirc-ignore-buffer-activity-flag |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1421 (not rcirc-ignore-buffer-activity-flag)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1422 (message (if rcirc-ignore-buffer-activity-flag |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1423 "Ignore activity in this buffer" |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1424 "Notice activity in this buffer")) |
66248 | 1425 (force-mode-line-update)) |
1426 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1427 (defun rcirc-toggle-low-priority () |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1428 "Toggle the value of `rcirc-low-priority-flag'." |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1429 (interactive) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1430 (setq rcirc-low-priority-flag |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1431 (not rcirc-low-priority-flag)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1432 (message (if rcirc-low-priority-flag |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1433 "Activity in this buffer is low priority" |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1434 "Activity in this buffer is normal priority")) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1435 (force-mode-line-update)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1436 |
66248 | 1437 (defvar rcirc-switch-to-buffer-function 'switch-to-buffer |
1438 "Function to use when switching buffers. | |
1439 Possible values are `switch-to-buffer', `pop-to-buffer', and | |
1440 `display-buffer'.") | |
1441 | |
1442 (defun rcirc-switch-to-server-buffer () | |
1443 "Switch to the server buffer associated with current channel buffer." | |
1444 (interactive) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1445 (funcall rcirc-switch-to-buffer-function rcirc-server-buffer)) |
66248 | 1446 |
1447 (defun rcirc-jump-to-first-unread-line () | |
1448 "Move the point to the first unread line in this buffer." | |
1449 (interactive) | |
1450 (when (marker-position overlay-arrow-position) | |
1451 (goto-char overlay-arrow-position))) | |
1452 | |
1453 (defvar rcirc-last-non-irc-buffer nil | |
1454 "The buffer to switch to when there is no more activity.") | |
1455 | |
1456 (defun rcirc-next-active-buffer (arg) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1457 "Go to the next rcirc buffer with activity. |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1458 With prefix ARG, go to the next low priority buffer with activity. |
66248 | 1459 The function given by `rcirc-switch-to-buffer-function' is used to |
1460 show the buffer." | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1461 (interactive "P") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1462 (let* ((pair (rcirc-split-activity rcirc-activity)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1463 (lopri (car pair)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1464 (hipri (cdr pair))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1465 (if (or (and (not arg) hipri) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1466 (and arg lopri)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1467 (progn |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1468 (unless (eq major-mode 'rcirc-mode) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1469 (setq rcirc-last-non-irc-buffer (current-buffer))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1470 (funcall rcirc-switch-to-buffer-function |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1471 (car (if arg lopri hipri)))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1472 (if (eq major-mode 'rcirc-mode) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1473 (if (not (and rcirc-last-non-irc-buffer |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1474 (buffer-live-p rcirc-last-non-irc-buffer))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1475 (message "No IRC activity. Start something.") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1476 (message "No more IRC activity. Go back to work.") |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1477 (funcall rcirc-switch-to-buffer-function rcirc-last-non-irc-buffer) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1478 (setq rcirc-last-non-irc-buffer nil)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1479 (message (concat |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1480 "No IRC activity." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1481 (when lopri |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1482 (concat |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1483 " Type C-u " |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1484 (key-description (this-command-keys)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1485 " for low priority activity.")))))))) |
66248 | 1486 |
1487 (defvar rcirc-activity-hooks nil | |
1488 "Hook to be run when there is channel activity. | |
1489 | |
1490 Functions are called with a single argument, the buffer with the | |
1491 activity. Only run if the buffer is not visible and | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1492 `rcirc-ignore-buffer-activity-flag' is non-nil.") |
66248 | 1493 |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1494 (defun rcirc-record-activity (buffer &optional type) |
66248 | 1495 "Record BUFFER activity with TYPE." |
1496 (with-current-buffer buffer | |
1497 (when (not (get-buffer-window (current-buffer) t)) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1498 (setq rcirc-activity |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1499 (sort (add-to-list 'rcirc-activity (current-buffer)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1500 (lambda (b1 b2) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1501 (let ((t1 (with-current-buffer b1 rcirc-last-post-time)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1502 (t2 (with-current-buffer b2 rcirc-last-post-time))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1503 (time-less-p t2 t1))))) |
66248 | 1504 (if (not rcirc-activity-type) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1505 (setq rcirc-activity-type type)) |
66248 | 1506 (rcirc-update-activity-string))) |
1507 (run-hook-with-args 'rcirc-activity-hooks buffer)) | |
1508 | |
1509 (defun rcirc-clear-activity (buffer) | |
1510 "Clear the BUFFER activity." | |
1511 (setq rcirc-activity (delete buffer rcirc-activity)) | |
1512 (with-current-buffer buffer | |
1513 (setq rcirc-activity-type nil))) | |
1514 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1515 (defun rcirc-split-activity (activity) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1516 "Return a cons cell with ACTIVITY split into (lopri . hipri)." |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1517 (let (lopri hipri) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1518 (dolist (buf rcirc-activity) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1519 (with-current-buffer buf |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1520 (if (and rcirc-low-priority-flag |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1521 (not (eq rcirc-activity-type 'nick))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1522 (add-to-list 'lopri buf t) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1523 (add-to-list 'hipri buf t)))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1524 (cons lopri hipri))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1525 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1526 ;; TODO: add mouse properties |
66248 | 1527 (defun rcirc-update-activity-string () |
1528 "Update mode-line string." | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1529 (let* ((pair (rcirc-split-activity rcirc-activity)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1530 (lopri (car pair)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1531 (hipri (cdr pair))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1532 (setq rcirc-activity-string |
72468 | 1533 (cond ((or hipri lopri) |
1534 (concat "-" | |
1535 (and hipri "[") | |
1536 (rcirc-activity-string hipri) | |
1537 (and hipri lopri ",") | |
1538 (and lopri | |
1539 (concat "(" | |
1540 (rcirc-activity-string lopri) | |
1541 ")")) | |
1542 (and hipri "]") | |
1543 "-")) | |
1544 ((not (null (rcirc-process-list))) | |
1545 "-[]-") | |
1546 (t ""))))) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1547 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1548 (defun rcirc-activity-string (buffers) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1549 (mapconcat (lambda (b) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1550 (let ((s (rcirc-short-buffer-name b))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1551 (with-current-buffer b |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1552 (if (not (eq rcirc-activity-type 'nick)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1553 s |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1554 (rcirc-facify s 'rcirc-mode-line-nick))))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1555 buffers ",")) |
66248 | 1556 |
1557 (defun rcirc-short-buffer-name (buffer) | |
1558 "Return a short name for BUFFER to use in the modeline indicator." | |
1559 (with-current-buffer buffer | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1560 (or rcirc-short-buffer-name (buffer-name)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1561 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1562 (defvar rcirc-current-buffer nil) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1563 (defun rcirc-window-configuration-change () |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1564 "Go through visible windows and remove buffers from activity list. |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1565 Also, clear the overlay arrow if the current buffer is now hidden." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1566 (let ((current-now-hidden t)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1567 (walk-windows (lambda (w) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1568 (let ((buf (window-buffer w))) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1569 (when (eq major-mode 'rcirc-mode) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1570 (rcirc-clear-activity buf) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1571 (when (eq buf rcirc-current-buffer) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1572 (setq current-now-hidden nil)))))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1573 ;; add overlay arrow if the buffer isn't displayed |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1574 (when (and rcirc-current-buffer current-now-hidden) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1575 (with-current-buffer rcirc-current-buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1576 (when (eq major-mode 'rcirc-mode) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1577 (marker-position overlay-arrow-position) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1578 (set-marker overlay-arrow-position nil))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1579 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1580 ;; remove any killed buffers from list |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1581 (setq rcirc-activity |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1582 (delq nil (mapcar (lambda (buf) (when (buffer-live-p buf) buf)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1583 rcirc-activity))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1584 (rcirc-update-activity-string) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1585 (setq rcirc-current-buffer (current-buffer))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1586 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1587 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1588 ;;; buffer name abbreviation |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1589 (defun rcirc-update-short-buffer-names () |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1590 (let ((bufalist |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1591 (apply 'append (mapcar (lambda (process) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1592 (with-rcirc-process-buffer process |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1593 rcirc-buffer-alist)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1594 (rcirc-process-list))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1595 (dolist (i (rcirc-abbreviate bufalist)) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1596 (when (buffer-live-p (cdr i)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1597 (with-current-buffer (cdr i) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1598 (setq rcirc-short-buffer-name (car i))))))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1599 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1600 (defun rcirc-abbreviate (pairs) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1601 (apply 'append (mapcar 'rcirc-rebuild-tree (rcirc-make-trees pairs)))) |
66248 | 1602 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1603 (defun rcirc-rebuild-tree (tree &optional acc) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1604 (let ((ch (char-to-string (car tree)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1605 (dolist (x (cdr tree)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1606 (if (listp x) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1607 (setq acc (append acc |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1608 (mapcar (lambda (y) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1609 (cons (concat ch (car y)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1610 (cdr y))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1611 (rcirc-rebuild-tree x)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1612 (setq acc (cons (cons ch x) acc)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1613 acc)) |
66248 | 1614 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1615 (defun rcirc-make-trees (pairs) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1616 (let (alist) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1617 (mapc (lambda (pair) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1618 (if (consp pair) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1619 (let* ((str (car pair)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1620 (data (cdr pair)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1621 (char (unless (zerop (length str)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1622 (aref str 0))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1623 (rest (unless (zerop (length str)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1624 (substring str 1))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1625 (part (if char (assq char alist)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1626 (if part |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1627 ;; existing partition |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1628 (setcdr part (cons (cons rest data) (cdr part))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1629 ;; new partition |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1630 (setq alist (cons (if char |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1631 (list char (cons rest data)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1632 data) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1633 alist)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1634 (setq alist (cons pair alist)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1635 pairs) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1636 ;; recurse into cdrs of alist |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1637 (mapc (lambda (x) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1638 (when (and (listp x) (listp (cadr x))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1639 (setcdr x (if (> (length (cdr x)) 1) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1640 (rcirc-make-trees (cdr x)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1641 (setcdr x (list (cdadr x))))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1642 alist))) |
66248 | 1643 |
1644 ;;; /commands these are called with 3 args: PROCESS, TARGET, which is | |
1645 ;; the current buffer/channel/user, and ARGS, which is a string | |
1646 ;; containing the text following the /cmd. | |
1647 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1648 (defmacro defun-rcirc-command (command argument docstring interactive-form |
66248 | 1649 &rest body) |
1650 "Define a command." | |
1651 `(defun ,(intern (concat "rcirc-cmd-" (symbol-name command))) | |
1652 (,@argument &optional process target) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1653 ,(concat docstring "\n\nNote: If PROCESS or TARGET are nil, the values given" |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1654 "\nby `rcirc-buffer-process' and `rcirc-target' will be used.") |
66248 | 1655 ,interactive-form |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1656 (let ((process (or process (rcirc-buffer-process))) |
66248 | 1657 (target (or target rcirc-target))) |
1658 ,@body))) | |
1659 | |
1660 (defun-rcirc-command msg (message) | |
1661 "Send private MESSAGE to TARGET." | |
1662 (interactive "i") | |
1663 (if (null message) | |
1664 (progn | |
1665 (setq target (completing-read "Message nick: " | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1666 (with-rcirc-server-buffer |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1667 rcirc-nick-table))) |
66248 | 1668 (when (> (length target) 0) |
1669 (setq message (read-string (format "Message %s: " target))) | |
1670 (when (> (length message) 0) | |
1671 (rcirc-send-message process target message)))) | |
1672 (if (not (string-match "\\([^ ]+\\) \\(.+\\)" message)) | |
1673 (message "Not enough args, or something.") | |
1674 (setq target (match-string 1 message) | |
1675 message (match-string 2 message)) | |
1676 (rcirc-send-message process target message)))) | |
1677 | |
1678 (defun-rcirc-command query (nick) | |
1679 "Open a private chat buffer to NICK." | |
1680 (interactive (list (completing-read "Query nick: " | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1681 (with-rcirc-server-buffer rcirc-nick-table)))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1682 (let ((existing-buffer (rcirc-get-buffer process nick))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1683 (switch-to-buffer (or existing-buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1684 (rcirc-get-buffer-create process nick))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1685 (when (not existing-buffer) |
66248 | 1686 (rcirc-cmd-whois nick)))) |
1687 | |
68578
2b5f6787aa4f
(rcirc-cmd-join): Improve argument/docstring consistency.
Juanma Barranquero <lekktu@gmail.com>
parents:
68563
diff
changeset
|
1688 (defun-rcirc-command join (channel) |
66248 | 1689 "Join CHANNEL." |
1690 (interactive "sJoin channel: ") | |
68578
2b5f6787aa4f
(rcirc-cmd-join): Improve argument/docstring consistency.
Juanma Barranquero <lekktu@gmail.com>
parents:
68563
diff
changeset
|
1691 (let ((buffer (rcirc-get-buffer-create process |
2b5f6787aa4f
(rcirc-cmd-join): Improve argument/docstring consistency.
Juanma Barranquero <lekktu@gmail.com>
parents:
68563
diff
changeset
|
1692 (car (split-string channel))))) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1693 (rcirc-send-string process (concat "JOIN " channel)) |
66248 | 1694 (when (not (eq (selected-window) (minibuffer-window))) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1695 (funcall rcirc-switch-to-buffer-function buffer)))) |
66248 | 1696 |
1697 (defun-rcirc-command part (channel) | |
1698 "Part CHANNEL." | |
1699 (interactive "sPart channel: ") | |
1700 (let ((channel (if (> (length channel) 0) channel target))) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1701 (rcirc-send-string process (concat "PART " channel " :" rcirc-id-string)))) |
66248 | 1702 |
1703 (defun-rcirc-command quit (reason) | |
1704 "Send a quit message to server with REASON." | |
1705 (interactive "sQuit reason: ") | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1706 (rcirc-send-string process (concat "QUIT :" |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1707 (if (not (zerop (length reason))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1708 reason |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1709 rcirc-id-string)))) |
66248 | 1710 |
1711 (defun-rcirc-command nick (nick) | |
1712 "Change nick to NICK." | |
1713 (interactive "i") | |
1714 (when (null nick) | |
1715 (setq nick (read-string "New nick: " (rcirc-nick process)))) | |
1716 (rcirc-send-string process (concat "NICK " nick))) | |
1717 | |
1718 (defun-rcirc-command names (channel) | |
1719 "Display list of names in CHANNEL or in current channel if CHANNEL is nil. | |
1720 If called interactively, prompt for a channel when prefix arg is supplied." | |
1721 (interactive "P") | |
1722 (if (interactive-p) | |
1723 (if channel | |
1724 (setq channel (read-string "List names in channel: " target)))) | |
1725 (let ((channel (if (> (length channel) 0) | |
1726 channel | |
1727 target))) | |
1728 (rcirc-send-string process (concat "NAMES " channel)))) | |
1729 | |
1730 (defun-rcirc-command topic (topic) | |
1731 "List TOPIC for the TARGET channel. | |
1732 With a prefix arg, prompt for new topic." | |
1733 (interactive "P") | |
1734 (if (and (interactive-p) topic) | |
1735 (setq topic (read-string "New Topic: " rcirc-topic))) | |
1736 (rcirc-send-string process (concat "TOPIC " target | |
1737 (when (> (length topic) 0) | |
1738 (concat " :" topic))))) | |
1739 | |
1740 (defun-rcirc-command whois (nick) | |
1741 "Request information from server about NICK." | |
1742 (interactive (list | |
1743 (completing-read "Whois: " | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1744 (with-rcirc-server-buffer rcirc-nick-table)))) |
66248 | 1745 (rcirc-send-string process (concat "WHOIS " nick))) |
1746 | |
1747 (defun-rcirc-command mode (args) | |
1748 "Set mode with ARGS." | |
1749 (interactive (list (concat (read-string "Mode nick or channel: ") | |
1750 " " (read-string "Mode: ")))) | |
1751 (rcirc-send-string process (concat "MODE " args))) | |
1752 | |
1753 (defun-rcirc-command list (channels) | |
1754 "Request information on CHANNELS from server." | |
1755 (interactive "sList Channels: ") | |
1756 (rcirc-send-string process (concat "LIST " channels))) | |
1757 | |
1758 (defun-rcirc-command oper (args) | |
1759 "Send operator command to server." | |
1760 (interactive "sOper args: ") | |
1761 (rcirc-send-string process (concat "OPER " args))) | |
1762 | |
1763 (defun-rcirc-command quote (message) | |
1764 "Send MESSAGE literally to server." | |
1765 (interactive "sServer message: ") | |
1766 (rcirc-send-string process message)) | |
1767 | |
1768 (defun-rcirc-command kick (arg) | |
1769 "Kick NICK from current channel." | |
1770 (interactive (list | |
1771 (concat (completing-read "Kick nick: " | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1772 (rcirc-channel-nicks |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1773 (rcirc-buffer-process) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1774 rcirc-target)) |
66248 | 1775 (read-from-minibuffer "Kick reason: ")))) |
1776 (let* ((arglist (split-string arg)) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1777 (argstring (concat (car arglist) " :" |
66248 | 1778 (mapconcat 'identity (cdr arglist) " ")))) |
1779 (rcirc-send-string process (concat "KICK " target " " argstring)))) | |
1780 | |
1781 (defun rcirc-cmd-ctcp (args &optional process target) | |
1782 (if (string-match "^\\([^ ]+\\)\\s-+\\(.+\\)$" args) | |
1783 (let ((target (match-string 1 args)) | |
1784 (request (match-string 2 args))) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1785 (rcirc-send-string process |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1786 (format "PRIVMSG %s \C-a%s\C-a" |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1787 target (upcase request)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1788 (rcirc-print process (rcirc-nick process) "ERROR" nil |
66248 | 1789 "usage: /ctcp NICK REQUEST"))) |
1790 | |
1791 (defun rcirc-cmd-me (args &optional process target) | |
1792 (rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a" | |
1793 target args))) | |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1794 |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1795 (defun-rcirc-command ignore (nick) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1796 "Manage the ignore list. |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1797 Ignore NICK, unignore NICK if already ignored, or list ignored |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1798 nicks when no NICK is given. When listing ignored nicks, the |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1799 ones added to the list automatically are marked with an asterisk." |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1800 (interactive "sToggle ignoring of nick: ") |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1801 (when (not (string= "" nick)) |
72468 | 1802 (if (member-ignore-case nick rcirc-ignore-list) |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1803 (setq rcirc-ignore-list (delete nick rcirc-ignore-list)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1804 (setq rcirc-ignore-list (cons nick rcirc-ignore-list)))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1805 (rcirc-print process (rcirc-nick process) "IGNORE" target |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1806 (mapconcat |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1807 (lambda (nick) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1808 (concat nick |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1809 (if (member nick rcirc-ignore-list-automatic) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1810 "*" ""))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1811 rcirc-ignore-list " "))) |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
1812 |
66248 | 1813 |
1814 (defun rcirc-message-leader (sender face) | |
1815 "Return a string with SENDER propertized with FACE." | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1816 (rcirc-facify (concat "<" sender "> ") face)) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1817 |
66248 | 1818 (defun rcirc-facify (string face) |
1819 "Return a copy of STRING with FACE property added." | |
1820 (propertize (or string "") 'face face 'rear-nonsticky t)) | |
1821 | |
1822 (defvar rcirc-url-regexp | |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1823 (rx-to-string |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1824 `(and word-boundary |
69252
45e1ec6f858b
(rcirc-url-regexp): Match entire url when it starts with "www".
Eli Zaretskii <eliz@gnu.org>
parents:
68960
diff
changeset
|
1825 (or (and |
45e1ec6f858b
(rcirc-url-regexp): Match entire url when it starts with "www".
Eli Zaretskii <eliz@gnu.org>
parents:
68960
diff
changeset
|
1826 (or (and (or "http" "https" "ftp" "file" "gopher" "news" |
45e1ec6f858b
(rcirc-url-regexp): Match entire url when it starts with "www".
Eli Zaretskii <eliz@gnu.org>
parents:
68960
diff
changeset
|
1827 "telnet" "wais" "mailto") |
45e1ec6f858b
(rcirc-url-regexp): Match entire url when it starts with "www".
Eli Zaretskii <eliz@gnu.org>
parents:
68960
diff
changeset
|
1828 "://") |
45e1ec6f858b
(rcirc-url-regexp): Match entire url when it starts with "www".
Eli Zaretskii <eliz@gnu.org>
parents:
68960
diff
changeset
|
1829 "www.") |
45e1ec6f858b
(rcirc-url-regexp): Match entire url when it starts with "www".
Eli Zaretskii <eliz@gnu.org>
parents:
68960
diff
changeset
|
1830 (1+ (char "-a-zA-Z0-9_.")) |
72468 | 1831 (1+ (char "-a-zA-Z0-9_")) |
69252
45e1ec6f858b
(rcirc-url-regexp): Match entire url when it starts with "www".
Eli Zaretskii <eliz@gnu.org>
parents:
68960
diff
changeset
|
1832 (optional ":" (1+ (char "0-9")))) |
68960
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1833 (and (1+ (char "-a-zA-Z0-9_.")) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1834 (or ".com" ".net" ".org") |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1835 word-boundary)) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1836 (optional |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1837 (and "/" |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1838 (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,{}[]")) |
6e3160901812
(rcirc-connect): Make all arguments optional, and default to global variable
Eli Zaretskii <eliz@gnu.org>
parents:
68838
diff
changeset
|
1839 (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]"))))) |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1840 "Regexp matching URLs. Set to nil to disable URL features in rcirc.") |
66248 | 1841 |
1842 (defun rcirc-browse-url (&optional arg) | |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1843 "Prompt for URL to browse based on URLs in buffer." |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1844 (interactive "P") |
66248 | 1845 (let ((completions (mapcar (lambda (x) (cons x nil)) rcirc-urls)) |
1846 (initial-input (car rcirc-urls)) | |
1847 (history (cdr rcirc-urls))) | |
1848 (browse-url (completing-read "rcirc browse-url: " | |
1849 completions nil nil initial-input 'history) | |
1850 arg))) | |
1851 | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1852 (defun rcirc-browse-url-at-point (point) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1853 "Send URL at point to `browse-url'." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1854 (interactive "d") |
72468 | 1855 (let ((beg (previous-single-property-change (1+ point) 'mouse-face)) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1856 (end (next-single-property-change point 'mouse-face))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1857 (browse-url (buffer-substring-no-properties beg end)))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1858 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1859 (defun rcirc-browse-url-at-mouse (event) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1860 "Send URL at mouse click to `browse-url'." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1861 (interactive "e") |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1862 (let ((position (event-end event))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1863 (with-current-buffer (window-buffer (posn-window position)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1864 (rcirc-browse-url-at-point (posn-point position))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1865 |
66248 | 1866 (defun rcirc-map-regexp (function regexp string) |
1867 "Return a copy of STRING after calling FUNCTION for each REGEXP match. | |
1868 FUNCTION takes 3 arguments, MATCH-START, MATCH-END, and STRING." | |
1869 (let ((start 0)) | |
1870 (while (string-match regexp string start) | |
1871 (setq start (match-end 0)) | |
1872 (funcall function (match-beginning 0) (match-end 0) string))) | |
1873 string) | |
1874 | |
1875 (defun rcirc-mangle-text (process text) | |
1876 "Return TEXT with properties added based on various patterns." | |
1877 ;; ^B | |
1878 (setq text | |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1879 (rcirc-map-regexp |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1880 (lambda (start end string) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1881 (let ((orig-face (get-text-property start 'face string))) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1882 (add-text-properties |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1883 start end |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1884 (list 'face (if (listp orig-face) |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1885 (append orig-face |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1886 (list 'bold)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1887 (list orig-face 'bold)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1888 'rear-nonsticky t) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1889 string))) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1890 ".*?" |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1891 text)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1892 ;; TODO: deal with ^_ and ^C colors sequences |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1893 (while (string-match "\\(.*\\)[]\\(.*\\)" text) |
66248 | 1894 (setq text (concat (match-string 1 text) |
1895 (match-string 2 text)))) | |
1896 ;; my nick | |
1897 (setq text | |
1898 (with-syntax-table rcirc-nick-syntax-table | |
1899 (rcirc-map-regexp (lambda (start end string) | |
1900 (add-text-properties | |
1901 start end | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1902 (list 'face 'rcirc-nick-in-message |
66248 | 1903 'rear-nonsticky t) |
1904 string)) | |
1905 (concat "\\b" | |
1906 (regexp-quote (rcirc-nick process)) | |
1907 "\\b") | |
1908 text))) | |
1909 ;; urls | |
1910 (setq text | |
1911 (rcirc-map-regexp | |
1912 (lambda (start end string) | |
1913 (let ((orig-face (get-text-property start 'face string))) | |
1914 (add-text-properties start end | |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1915 (list 'face (if (listp orig-face) |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
1916 (append orig-face |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1917 (list 'bold)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
1918 (list orig-face 'bold)) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1919 'rear-nonsticky t |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1920 'mouse-face 'highlight |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1921 'keymap rcirc-browse-url-map) |
66248 | 1922 string)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1923 (push (substring-no-properties string start end) rcirc-urls)) |
66248 | 1924 rcirc-url-regexp |
1925 text)) | |
1926 text) | |
1927 | |
1928 | |
1929 ;;; handlers | |
1930 ;; these are called with the server PROCESS, the SENDER, which is a | |
1931 ;; server or a user, depending on the command, the ARGS, which is a | |
1932 ;; list of strings, and the TEXT, which is the original server text, | |
1933 ;; verbatim | |
1934 (defun rcirc-handler-001 (process sender args text) | |
1935 (rcirc-handler-generic process "001" sender args text) | |
1936 ;; set the real server name | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1937 (with-rcirc-process-buffer process |
66248 | 1938 (setq rcirc-server sender) |
1939 (setq rcirc-nick (car args)) | |
1940 (rcirc-update-prompt) | |
1941 (when rcirc-auto-authenticate-flag (rcirc-authenticate)) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1942 (rcirc-join-channels process rcirc-startup-channels))) |
66248 | 1943 |
1944 (defun rcirc-handler-PRIVMSG (process sender args text) | |
1945 (let ((target (if (rcirc-channel-p (car args)) | |
1946 (car args) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1947 sender)) |
66248 | 1948 (message (or (cadr args) ""))) |
1949 (if (string-match "^\C-a\\(.*\\)\C-a$" message) | |
1950 (rcirc-handler-CTCP process target sender (match-string 1 message)) | |
1951 (rcirc-print process sender "PRIVMSG" target message t)) | |
1952 ;; update nick timestamp | |
1953 (if (member target (rcirc-nick-channels process sender)) | |
1954 (rcirc-put-nick-channel process sender target)))) | |
1955 | |
1956 (defun rcirc-handler-NOTICE (process sender args text) | |
1957 (let ((target (car args)) | |
1958 (message (cadr args))) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1959 (if (string-match "^\C-a\\(.*\\)\C-a$" message) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1960 (rcirc-handler-CTCP-response process target sender |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1961 (match-string 1 message)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1962 (rcirc-print process sender "NOTICE" |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1963 (cond ((rcirc-channel-p target) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1964 target) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1965 ;;; -ChanServ- [#gnu] Welcome... |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
1966 ((string-match "\\[\\(#[^\] ]+\\)\\]" message) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1967 (match-string 1 message)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1968 (sender |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1969 (if (string= sender (rcirc-server-name process)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1970 nil ; server notice |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1971 sender))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1972 message t)))) |
66248 | 1973 |
1974 (defun rcirc-handler-WALLOPS (process sender args text) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1975 (rcirc-print process sender "WALLOPS" sender (car args) t)) |
66248 | 1976 |
1977 (defun rcirc-handler-JOIN (process sender args text) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1978 (let ((channel (car args))) |
66248 | 1979 (rcirc-get-buffer-create process channel) |
1980 (rcirc-print process sender "JOIN" channel "") | |
1981 | |
1982 ;; print in private chat buffer if it exists | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1983 (when (rcirc-get-buffer (rcirc-buffer-process) sender) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
1984 (rcirc-print process sender "JOIN" sender channel)) |
66248 | 1985 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1986 (rcirc-put-nick-channel process sender channel))) |
66248 | 1987 |
1988 ;; PART and KICK are handled the same way | |
1989 (defun rcirc-handler-PART-or-KICK (process response channel sender nick args) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
1990 (rcirc-ignore-update-automatic nick) |
66248 | 1991 (if (not (string= nick (rcirc-nick process))) |
1992 ;; this is someone else leaving | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1993 (rcirc-remove-nick-channel process nick channel) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1994 ;; this is us leaving |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1995 (mapc (lambda (n) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1996 (rcirc-remove-nick-channel process n channel)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1997 (rcirc-channel-nicks process channel)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1998 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
1999 ;; if the buffer is still around, make it inactive |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2000 (let ((buffer (rcirc-get-buffer process channel))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2001 (when buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2002 (with-current-buffer buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2003 (setq rcirc-target nil)))))) |
66248 | 2004 |
2005 (defun rcirc-handler-PART (process sender args text) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2006 (let* ((channel (car args)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2007 (reason (cadr args)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2008 (message (concat channel " " reason))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2009 (rcirc-print process sender "PART" channel message) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2010 ;; print in private chat buffer if it exists |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2011 (when (rcirc-get-buffer (rcirc-buffer-process) sender) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2012 (rcirc-print process sender "PART" sender message)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2013 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2014 (rcirc-handler-PART-or-KICK process "PART" channel sender sender reason))) |
66248 | 2015 |
2016 (defun rcirc-handler-KICK (process sender args text) | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2017 (let* ((channel (car args)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2018 (nick (cadr args)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2019 (reason (caddr args)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2020 (message (concat nick " " channel " " reason))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2021 (rcirc-print process sender "KICK" channel message t) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2022 ;; print in private chat buffer if it exists |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2023 (when (rcirc-get-buffer (rcirc-buffer-process) nick) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2024 (rcirc-print process sender "KICK" nick message)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2025 |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2026 (rcirc-handler-PART-or-KICK process "KICK" channel sender nick reason))) |
66248 | 2027 |
2028 (defun rcirc-handler-QUIT (process sender args text) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2029 (rcirc-ignore-update-automatic sender) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2030 (mapc (lambda (channel) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2031 (rcirc-print process sender "QUIT" channel (apply 'concat args))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2032 (rcirc-nick-channels process sender)) |
66248 | 2033 |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2034 ;; print in private chat buffer if it exists |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2035 (when (rcirc-get-buffer (rcirc-buffer-process) sender) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2036 (rcirc-print process sender "QUIT" sender (apply 'concat args))) |
66248 | 2037 |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2038 (rcirc-nick-remove process sender)) |
66248 | 2039 |
2040 (defun rcirc-handler-NICK (process sender args text) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2041 (let* ((old-nick sender) |
66248 | 2042 (new-nick (car args)) |
2043 (channels (rcirc-nick-channels process old-nick))) | |
68079
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
2044 ;; update list of ignored nicks |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
2045 (rcirc-ignore-update-automatic old-nick) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
2046 (when (member old-nick rcirc-ignore-list) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
2047 (add-to-list 'rcirc-ignore-list new-nick) |
61e9ea461d3c
(rcirc-ignore-list): New option.
Alex Schroeder <alex@gnu.org>
parents:
68077
diff
changeset
|
2048 (add-to-list 'rcirc-ignore-list-automatic new-nick)) |
66248 | 2049 ;; print message to nick's channels |
2050 (dolist (target channels) | |
2051 (rcirc-print process sender "NICK" target new-nick)) | |
2052 ;; update private chat buffer, if it exists | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2053 (let ((chat-buffer (rcirc-get-buffer process old-nick))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2054 (when chat-buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2055 (with-current-buffer chat-buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2056 (rcirc-print process sender "NICK" old-nick new-nick) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2057 (setq rcirc-target new-nick) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2058 (rename-buffer (rcirc-generate-new-buffer-name process new-nick))))) |
66248 | 2059 ;; remove old nick and add new one |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2060 (with-rcirc-process-buffer process |
66248 | 2061 (let ((v (gethash old-nick rcirc-nick-table))) |
2062 (remhash old-nick rcirc-nick-table) | |
2063 (puthash new-nick v rcirc-nick-table)) | |
2064 ;; if this is our nick... | |
2065 (when (string= old-nick rcirc-nick) | |
2066 (setq rcirc-nick new-nick) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2067 (rcirc-update-prompt t) |
66248 | 2068 ;; reauthenticate |
2069 (when rcirc-auto-authenticate-flag (rcirc-authenticate)))))) | |
2070 | |
2071 (defun rcirc-handler-PING (process sender args text) | |
2072 (rcirc-send-string process (concat "PONG " (car args)))) | |
2073 | |
2074 (defun rcirc-handler-PONG (process sender args text) | |
2075 ;; do nothing | |
2076 ) | |
2077 | |
2078 (defun rcirc-handler-TOPIC (process sender args text) | |
2079 (let ((topic (cadr args))) | |
2080 (rcirc-print process sender "TOPIC" (car args) topic) | |
2081 (with-current-buffer (rcirc-get-buffer process (car args)) | |
2082 (setq rcirc-topic topic)))) | |
2083 | |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2084 (defvar rcirc-nick-away-alist nil) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2085 (defun rcirc-handler-301 (process sender args text) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2086 "RPL_AWAY" |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2087 (let* ((nick (cadr args)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2088 (rec (assoc-string nick rcirc-nick-away-alist)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2089 (away-message (caddr args))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2090 (when (or (not rec) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2091 (not (string= (cdr rec) away-message))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2092 ;; away message has changed |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2093 (rcirc-handler-generic process "AWAY" nick (cdr args) text) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2094 (if rec |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2095 (setcdr rec away-message) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2096 (setq rcirc-nick-away-alist (cons (cons nick away-message) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2097 rcirc-nick-away-alist)))))) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2098 |
66248 | 2099 (defun rcirc-handler-332 (process sender args text) |
2100 "RPL_TOPIC" | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2101 (let ((buffer (or (rcirc-get-buffer process (cadr args)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2102 (rcirc-get-temp-buffer-create process (cadr args))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2103 (with-current-buffer buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2104 (setq rcirc-topic (caddr args))))) |
66248 | 2105 |
2106 (defun rcirc-handler-333 (process sender args text) | |
2107 "Not in rfc1459.txt" | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2108 (let ((buffer (or (rcirc-get-buffer process (cadr args)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2109 (rcirc-get-temp-buffer-create process (cadr args))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2110 (with-current-buffer buffer |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2111 (let ((setter (caddr args)) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2112 (time (current-time-string |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2113 (seconds-to-time |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2114 (string-to-number (cadddr args)))))) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2115 (rcirc-print process sender "TOPIC" (cadr args) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2116 (format "%s (%s on %s)" rcirc-topic setter time)))))) |
66248 | 2117 |
2118 (defun rcirc-handler-477 (process sender args text) | |
2119 "ERR_NOCHANMODES" | |
2120 (rcirc-print process sender "477" (cadr args) (caddr args))) | |
2121 | |
2122 (defun rcirc-handler-MODE (process sender args text) | |
2123 (let ((target (car args)) | |
2124 (msg (mapconcat 'identity (cdr args) " "))) | |
2125 (rcirc-print process sender "MODE" | |
2126 (if (string= target (rcirc-nick process)) | |
2127 nil | |
2128 target) | |
2129 msg) | |
2130 | |
2131 ;; print in private chat buffers if they exist | |
2132 (mapc (lambda (nick) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2133 (when (rcirc-get-buffer process nick) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2134 (rcirc-print process sender "MODE" nick msg))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2135 (cddr args)))) |
66248 | 2136 |
2137 (defun rcirc-get-temp-buffer-create (process channel) | |
2138 "Return a buffer based on PROCESS and CHANNEL." | |
2139 (let ((tmpnam (concat " " (downcase channel) "TMP" (process-name process)))) | |
2140 (get-buffer-create tmpnam))) | |
2141 | |
2142 (defun rcirc-handler-353 (process sender args text) | |
2143 "RPL_NAMREPLY" | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2144 (let ((channel (caddr args))) |
66248 | 2145 (mapc (lambda (nick) |
2146 (rcirc-put-nick-channel process nick channel)) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2147 (split-string (cadddr args) " " t)) |
66248 | 2148 (with-current-buffer (rcirc-get-temp-buffer-create process channel) |
2149 (goto-char (point-max)) | |
2150 (insert (car (last args)) " ")))) | |
2151 | |
2152 (defun rcirc-handler-366 (process sender args text) | |
2153 "RPL_ENDOFNAMES" | |
2154 (let* ((channel (cadr args)) | |
2155 (buffer (rcirc-get-temp-buffer-create process channel))) | |
2156 (with-current-buffer buffer | |
2157 (rcirc-print process sender "NAMES" channel | |
2158 (buffer-substring (point-min) (point-max)))) | |
2159 (kill-buffer buffer))) | |
2160 | |
2161 (defun rcirc-handler-433 (process sender args text) | |
2162 "ERR_NICKNAMEINUSE" | |
2163 (rcirc-handler-generic process "433" sender args text) | |
2164 (let* ((new-nick (concat (cadr args) "`"))) | |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2165 (with-rcirc-process-buffer process |
66248 | 2166 (rcirc-cmd-nick new-nick nil process)))) |
2167 | |
2168 (defun rcirc-authenticate () | |
2169 "Send authentication to process associated with current buffer. | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2170 Passwords are stored in `rcirc-authinfo' (which see)." |
66248 | 2171 (interactive) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2172 (with-rcirc-server-buffer |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2173 (dolist (i rcirc-authinfo) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2174 (let ((process (rcirc-buffer-process)) |
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2175 (server (car i)) |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2176 (nick (caddr i)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2177 (method (cadr i)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2178 (args (cdddr i))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2179 (when (and (string-match server rcirc-server) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2180 (string-match nick rcirc-nick)) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2181 (cond ((equal method 'nickserv) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2182 (rcirc-send-string |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2183 process |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2184 (concat |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2185 "PRIVMSG nickserv :identify " |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2186 (car args)))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2187 ((equal method 'chanserv) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2188 (rcirc-send-string |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2189 process |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2190 (concat |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2191 "PRIVMSG chanserv :identify " |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2192 (cadr args) " " (car args)))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2193 ((equal method 'bitlbee) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2194 (rcirc-send-string |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2195 process |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2196 (concat "PRIVMSG &bitlbee :identify " (car args)))) |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2197 (t |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2198 (message "No %S authentication method defined" |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2199 method)))))))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2200 |
66248 | 2201 (defun rcirc-handler-INVITE (process sender args text) |
2202 (rcirc-print process sender "INVITE" nil (mapconcat 'identity args " ") t)) | |
2203 | |
2204 (defun rcirc-handler-ERROR (process sender args text) | |
2205 (rcirc-print process sender "ERROR" nil (mapconcat 'identity args " "))) | |
2206 | |
2207 (defun rcirc-handler-CTCP (process target sender text) | |
2208 (if (string-match "^\\([^ ]+\\) *\\(.*\\)$" text) | |
2209 (let* ((request (upcase (match-string 1 text))) | |
2210 (args (match-string 2 text)) | |
2211 (handler (intern-soft (concat "rcirc-handler-ctcp-" request)))) | |
2212 (if (not (fboundp handler)) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2213 (rcirc-print process sender "ERROR" target |
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2214 (format "%s sent unsupported ctcp: %s" sender text) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2215 t) |
66248 | 2216 (funcall handler process target sender args) |
2217 (if (not (string= request "ACTION")) | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2218 (rcirc-print process sender "CTCP" target |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2219 (format "%s" text) t)))))) |
66248 | 2220 |
2221 (defun rcirc-handler-ctcp-VERSION (process target sender args) | |
2222 (rcirc-send-string process | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2223 (concat "NOTICE " sender |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2224 " :\C-aVERSION " rcirc-id-string |
66248 | 2225 "\C-a"))) |
2226 | |
2227 (defun rcirc-handler-ctcp-ACTION (process target sender args) | |
2228 (rcirc-print process sender "ACTION" target args t)) | |
2229 | |
2230 (defun rcirc-handler-ctcp-TIME (process target sender args) | |
2231 (rcirc-send-string process | |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2232 (concat "NOTICE " sender |
66248 | 2233 " :\C-aTIME " (current-time-string) "\C-a"))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2234 |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2235 (defun rcirc-handler-CTCP-response (process target sender message) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2236 (rcirc-print process sender "CTCP" nil message t)) |
66248 | 2237 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2238 (defgroup rcirc-faces nil |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2239 "Faces for rcirc." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2240 :group 'rcirc |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2241 :group 'faces) |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2242 |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2243 (defface rcirc-my-nick ; font-lock-function-name-face |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2244 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2245 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2246 (((class color) (min-colors 16) (background light)) (:foreground "Blue")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2247 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2248 (((class color) (min-colors 8)) (:foreground "blue" :weight bold)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2249 (t (:inverse-video t :weight bold))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2250 "The face used to highlight my messages." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2251 :group 'rcirc-faces) |
66248 | 2252 |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2253 (defface rcirc-other-nick ; font-lock-variable-name-face |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2254 '((((class grayscale) (background light)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2255 (:foreground "Gray90" :weight bold :slant italic)) |
66248 | 2256 (((class grayscale) (background dark)) |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2257 (:foreground "DimGray" :weight bold :slant italic)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2258 (((class color) (min-colors 88) (background light)) (:foreground "DarkGoldenrod")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2259 (((class color) (min-colors 88) (background dark)) (:foreground "LightGoldenrod")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2260 (((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2261 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2262 (((class color) (min-colors 8)) (:foreground "yellow" :weight light)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2263 (t (:weight bold :slant italic))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2264 "The face used to highlight other messages." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2265 :group 'rcirc-faces) |
66248 | 2266 |
70215
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2267 (defface rcirc-bright-nick |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2268 '((((class grayscale) (background light)) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2269 (:foreground "LightGray" :weight bold :underline t)) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2270 (((class grayscale) (background dark)) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2271 (:foreground "Gray50" :weight bold :underline t)) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2272 (((class color) (min-colors 88) (background light)) (:foreground "CadetBlue")) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2273 (((class color) (min-colors 88) (background dark)) (:foreground "Aquamarine")) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2274 (((class color) (min-colors 16) (background light)) (:foreground "CadetBlue")) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2275 (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine")) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2276 (((class color) (min-colors 8)) (:foreground "magenta")) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2277 (t (:weight bold :underline t))) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2278 "Face used for nicks matched by `rcirc-bright-nick-regexp'." |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2279 :group 'rcirc-faces) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2280 |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2281 (defface rcirc-dim-nick |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2282 '((t :inherit default)) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2283 "Face used for nicks matched by `rcirc-dim-nick-regexp'." |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2284 :group 'rcirc-faces) |
90d76f24753a
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-247
Miles Bader <miles@gnu.org>
parents:
69860
diff
changeset
|
2285 |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2286 (defface rcirc-server ; font-lock-comment-face |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2287 '((((class grayscale) (background light)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2288 (:foreground "DimGray" :weight bold :slant italic)) |
66248 | 2289 (((class grayscale) (background dark)) |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2290 (:foreground "LightGray" :weight bold :slant italic)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2291 (((class color) (min-colors 88) (background light)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2292 (:foreground "Firebrick")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2293 (((class color) (min-colors 88) (background dark)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2294 (:foreground "chocolate1")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2295 (((class color) (min-colors 16) (background light)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2296 (:foreground "red")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2297 (((class color) (min-colors 16) (background dark)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2298 (:foreground "red1")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2299 (((class color) (min-colors 8) (background light)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2300 ) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2301 (((class color) (min-colors 8) (background dark)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2302 ) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2303 (t (:weight bold :slant italic))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2304 "The face used to highlight server messages." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2305 :group 'rcirc-faces) |
66248 | 2306 |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2307 (defface rcirc-server-prefix ; font-lock-comment-delimiter-face |
68731
85be285e3494
(rcirc-startup-channels-alist): Add irc.freenode.net and #emacs as defaults.
Eli Zaretskii <eliz@gnu.org>
parents:
68648
diff
changeset
|
2308 '((default :inherit rcirc-server) |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2309 (((class grayscale))) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2310 (((class color) (min-colors 16))) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2311 (((class color) (min-colors 8) (background light)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2312 :foreground "red") |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2313 (((class color) (min-colors 8) (background dark)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2314 :foreground "red1")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2315 "The face used to highlight server prefixes." |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2316 :group 'rcirc-faces) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2317 |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2318 (defface rcirc-timestamp |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2319 '((t (:inherit default))) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2320 "The face used to highlight timestamps." |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2321 :group 'rcirc-faces) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2322 |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2323 (defface rcirc-nick-in-message ; font-lock-keyword-face |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2324 '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2325 (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2326 (((class color) (min-colors 88) (background light)) (:foreground "Purple")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2327 (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2328 (((class color) (min-colors 16) (background light)) (:foreground "Purple")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2329 (((class color) (min-colors 16) (background dark)) (:foreground "Cyan")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2330 (((class color) (min-colors 8)) (:foreground "cyan" :weight bold)) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2331 (t (:weight bold))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2332 "The face used to highlight instances of nick within messages." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2333 :group 'rcirc-faces) |
66248 | 2334 |
67014
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2335 (defface rcirc-prompt ; comint-highlight-prompt |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2336 '((((min-colors 88) (background dark)) (:foreground "cyan1")) |
d3d8e2bcfa98
(rcirc-mangle-text): Add bold face property without replacing existing
Eli Zaretskii <eliz@gnu.org>
parents:
66703
diff
changeset
|
2337 (((background dark)) (:foreground "cyan")) |
66248 | 2338 (t (:foreground "dark blue"))) |
68563
979fba30166f
(rcirc-debug): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68079
diff
changeset
|
2339 "The face used to highlight prompts." |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2340 :group 'rcirc-faces) |
66248 | 2341 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2342 (defface rcirc-mode-line-nick |
66248 | 2343 '((t (:bold t))) |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2344 "The face used indicate activity directed at you." |
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2345 :group 'rcirc-faces) |
69860
000a5d4aa083
(rcirc-default-server): Rename from rcirc-server.
Eli Zaretskii <eliz@gnu.org>
parents:
69694
diff
changeset
|
2346 |
66248 | 2347 |
66703
6cfb275aa300
Use split-string OMIT-NULLS argument.
Eli Zaretskii <eliz@gnu.org>
parents:
66272
diff
changeset
|
2348 ;; When using M-x flyspell-mode, only check words after the prompt |
66248 | 2349 (put 'rcirc-mode 'flyspell-mode-predicate 'rcirc-looking-at-input) |
2350 (defun rcirc-looking-at-input () | |
2351 "Returns true if point is past the input marker." | |
2352 (>= (point) rcirc-prompt-end-marker)) | |
2353 | |
2354 | |
2355 (provide 'rcirc) | |
66258 | 2356 |
2357 ;; arch-tag: b471b7e8-6b5a-4399-b2c6-a3c78dfc8ffb | |
66248 | 2358 ;;; rcirc.el ends here |