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