* riece-mcat.el (riece-mcat-update): New function.
[riece] / lisp / riece-options.el
1 ;;; riece-options.el --- customization
2 ;; Copyright (C) 1998-2003 Daiki Ueno
3
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
5 ;; Created: 1998-09-28
6 ;; Keywords: IRC, riece
7
8 ;; This file is part of Riece.
9
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
24
25 ;;; Code:
26
27 (require 'riece-version)
28 (require 'riece-globals)
29
30 ;; User modifiable variables.
31 (defgroup riece nil
32   "Riece specific customize group.")
33
34 (defgroup riece-options nil
35   "Riece user customizable variables."
36   :prefix "riece-"
37   :group 'riece)
38
39 (defcustom riece-saved-forms
40   '(riece-server-alist
41     riece-channel-buffer-mode
42     riece-others-buffer-mode
43     riece-user-list-buffer-mode
44     riece-channel-list-buffer-mode
45     riece-layout
46     riece-addons)
47   "Variables saved after each session is completed."
48   :type 'string
49   :group 'riece-options)
50
51 (defcustom riece-debug nil
52   "If non-nil, random debug spews."
53   :type 'boolean
54   :group 'riece-options)
55
56 (defcustom riece-command-prefix "\C-c"
57   "Key sequence to be used as prefix for command mode key bindings."
58   :type 'string
59   :group 'riece-options)
60
61 (defgroup riece-looks nil
62   "Look and feel."
63   :prefix "riece-"
64   :group 'riece)
65
66 (defcustom riece-use-full-window t
67   "If non-nil, whole Emacs window is used to display dialogue."
68   :type 'boolean
69   :group 'riece-looks)
70
71 (defcustom riece-window-center-line -2
72   "Line number of center point in window when scrolling.
73 If nil, erases the entire frame and then redraws with point in the
74 center of the window.  Negative means relative to bottom of window.
75 See the document of the function `recenter'."
76   :type 'integer
77   :group 'riece-looks)
78
79 (defcustom riece-directory (expand-file-name "~/.riece")
80   "Where to look for startup files."
81   :type 'directory
82   :group 'riece-options)
83
84 (defcustom riece-addon-directory
85   (expand-file-name "addons" riece-directory)
86   "Where to look for add-on files."
87   :type 'directory
88   :group 'riece-options)
89
90 (defcustom riece-data-directory
91   (if (fboundp 'locate-data-directory)
92       (locate-data-directory "riece")
93     (file-name-directory load-file-name))
94   "Where to look for data files."
95   :type 'directory
96   :group 'riece-options)
97
98 (defcustom riece-variables-file
99   (expand-file-name "init" riece-directory)
100   "Where to look for variables."
101   :type 'file
102   :group 'riece-options)
103
104 (defcustom riece-saved-variables-file
105   (expand-file-name "save" riece-directory)
106   "Where to look for variables.
107 This file was saved the last session."
108   :type 'file
109   :group 'riece-options)
110
111 (defcustom riece-variables-files
112   (list riece-saved-variables-file riece-variables-file)
113   "Where to look for variables.  Helps to remove clutter from your .emacs.
114 This feature is most likely to dissappear in near future.  The preferred
115 way is to put Riece variables on .emacs or file loaded from there."
116   :type '(repeat (file :tag "Initialization File"))
117   :group 'riece-options)
118
119 (defcustom riece-addons '(riece-highlight
120                           riece-ctcp
121                           riece-guess
122                           riece-unread
123                           riece-history
124                           riece-url
125                           riece-button
126                           riece-menu
127                           riece-icon
128                           riece-ignore
129                           riece-log
130                           riece-toolbar
131                           riece-alias
132                           riece-ctlseq
133                           riece-keyword
134                           riece-shrink-buffer)
135   "Add-ons insinuated into Riece."
136   :type '(repeat symbol)
137   :group 'riece-options)
138
139 (defgroup riece-server nil
140   "Server settings."
141   :prefix "riece-"
142   :group 'riece)
143
144 (defgroup riece-channel nil
145   "Channel settings."
146   :prefix "riece-"
147   :group 'riece)
148
149 (define-widget 'riece-service-spec 'radio
150   "Edit service spec entries"
151   :convert-widget 'riece-service-spec-convert)
152
153 (defun riece-service-spec-convert (widget)
154   (widget-put widget :args '((integer :tag "Port Number")
155                              (string :tag "Name")))
156   widget)
157
158 (define-widget 'riece-server-spec 'repeat
159   "Edit server spec entries"
160   :match (lambda (widget value)
161            (eval `(and ,@(mapcar
162                           (lambda (entry)
163                             (or (stringp (cdr entry))
164                                 (listp (cdr entry))))
165                           value))))
166   :convert-widget 'riece-server-spec-convert)
167
168 (defun riece-server-spec-convert (widget)
169   (let* ((host '(const :format "" :value :host))
170          (service '(const :format "" :value :service))
171          (host
172           `(group :inline t ,host (string :tag "Host")))
173          (service
174           `(group :inline t ,service riece-service-spec))
175          (spec
176           `(cons (string :tag "Name")
177                  (radio (string :tag "Host")
178                         (list ,host ,service))))
179          (args (list spec)))
180     (widget-put widget :args args)
181     widget))
182
183 (defcustom riece-server-alist nil
184   "An alist mapping server names to plist."
185   :type 'riece-server-spec
186   :group 'riece-server)
187
188 (defcustom riece-server (getenv "IRCSERVER")
189   "IRC server host we are connecting to."
190   :type 'string
191   :group 'riece-server)
192
193 (defcustom riece-protocol 'irc
194   "Protocol support."
195   :type 'symbol
196   :group 'riece-server)
197
198 (defcustom riece-max-send-size 512
199   "Maximum size of messages to be sent at a time."
200   :type 'integer
201   :group 'riece-server)
202
203 (defcustom riece-send-delay 2
204   "Duration of multiple send."
205   :type 'integer
206   :group 'riece-server)
207   
208 (defcustom riece-default-password (getenv "IRCPASSWORD")
209   "Your password."
210   :type '(radio (string :tag "Password")
211                 (const :tag "No" nil))
212   :group 'riece-server)
213
214 (defcustom riece-username nil
215   "Your login name."
216   :type 'string
217   :group 'riece-server)
218
219 (defcustom riece-realname nil
220   "Your user name."
221   :type 'string
222   :group 'riece-server)
223
224 (defcustom riece-nickname (or (getenv "IRCNICK")
225                               (user-real-login-name))
226   "Your nickname."
227   :type 'string
228   :group 'riece-server)
229
230 (defcustom riece-startup-channel-list nil
231   "A list of channels to join automatically at startup."
232   :type '(repeat (choice (string :tag "Channel")
233                          (list (string :tag "Channel") (string :tag "Key"))))
234   :group 'riece-channel)
235
236 (defcustom riece-startup-server-list nil
237   "A list of servers to connect automatically at startup."
238   :type '(repeat (string :tag "Server"))
239   :group 'riece-server)
240
241 (defcustom riece-retry-with-new-nickname nil
242   "When nickname has already been in use, grow-tail automatically."
243   :type 'boolean
244   :group 'riece-server)
245
246 (defcustom riece-quit-timeout 1
247   "Quit timeout when there is no response from server."
248   :type '(radio (integer :tag "Seconds")
249                 (const nil))
250   :group 'riece-server)
251
252 (defcustom riece-default-open-connection-function #'open-network-stream
253   "Default function used for connecting to an IRC server."
254   :type 'function
255   :group 'riece-server)
256
257 (defcustom riece-user-cache-max-size 512
258   "Maximum size of cache of user names."
259   :type 'integer
260   :group 'riece-server)
261
262 (defcustom riece-channel-cache-max-size 512
263   "Maximum size of cache of channel names."
264   :type 'integer
265   :group 'riece-server)
266
267 (defcustom riece-channel-buffer-mode t
268   "When non-nil, Riece will display a channel buffer."
269   :type 'boolean
270   :group 'riece-looks)
271
272 (defcustom riece-others-buffer-mode t
273   "When non-nil, Riece will display an \"*Others*\" buffer."
274   :type 'boolean
275   :group 'riece-looks)
276
277 (defcustom riece-user-list-buffer-mode t
278   "When non-nil, Riece will display a nick list buffer."
279   :type 'boolean
280   :group 'riece-looks)
281
282 (defcustom riece-channel-list-buffer-mode t
283   "When non-nil, Riece will display a channel list buffer."
284   :type 'boolean
285   :group 'riece-looks)
286
287 (defcustom riece-default-freeze nil
288   "Channel buffer local freeze flag is on at starting."
289   :type 'boolean
290   :group 'riece-looks)
291
292 (defcustom riece-default-channel-binding nil
293   "The channel list to bind the channel number when joining."
294   :type '(repeat (radio (string :tag "Bound Channel")
295                         (const nil)))
296   :group 'riece-channel)
297
298 (defcustom riece-blink-parens nil
299   "Should we blink matching parenthesis in the command buffer?"
300   :type 'boolean
301   :group 'riece-options)
302
303 (defcustom riece-quit-message (riece-extended-version)
304   "Default quit message."
305   :type '(string :tag "Quit message")
306   :group 'riece-options)
307
308 (defcustom riece-part-message nil
309   "Default part message."
310   :type '(choice (const :tag "No message" nil)
311                  (string :tag "Part message"))
312   :group 'riece-options)
313
314 (defcustom riece-away-message "Gone"
315   "Default away message."
316   :type '(string :tag "Away message")
317   :group 'riece-options)
318
319 (defcustom riece-gather-channel-modes nil
320   "If non-nil, gather channel modes when we join a channel."
321   :type 'boolean
322   :group 'riece-options)
323
324 (defcustom riece-buffer-dispose-function #'kill-buffer
325   "Function called after the buffer was disposed."
326   :type 'function
327   :group 'riece-options)
328
329 (defcustom riece-format-time-function #'current-time-string
330   "Function to convert the specified time to the human readable form."
331   :type 'function
332   :group 'riece-options)
333
334 (provide 'riece-options)
335
336 ;;; riece-options.el ends here