annotate lisp/net/rcirc.el @ 90317:34c8b755296d

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