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