Fixed.
[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                           riece-mcat)
136   "Add-ons insinuated into Riece."
137   :type '(repeat symbol)
138   :group 'riece-options)
139
140 (defgroup riece-server nil
141   "Server settings."
142   :prefix "riece-"
143   :group 'riece)
144
145 (defgroup riece-channel nil
146   "Channel settings."
147   :prefix "riece-"
148   :group 'riece)
149
150 (define-widget 'riece-service-spec 'radio
151   "Edit service spec entries"
152   :convert-widget 'riece-service-spec-convert)
153
154 (defun riece-service-spec-convert (widget)
155   (widget-put widget :args '((integer :tag "Port Number")
156                              (string :tag "Name")))
157   widget)
158
159 (define-widget 'riece-server-spec 'repeat
160   "Edit server spec entries"
161   :match (lambda (widget value)
162            (eval `(and ,@(mapcar
163                           (lambda (entry)
164                             (or (stringp (cdr entry))
165                                 (listp (cdr entry))))
166                           value))))
167   :convert-widget 'riece-server-spec-convert)
168
169 (defun riece-server-spec-convert (widget)
170   (let* ((host '(const :format "" :value :host))
171          (service '(const :format "" :value :service))
172          (host
173           `(group :inline t ,host (string :tag "Host")))
174          (service
175           `(group :inline t ,service riece-service-spec))
176          (spec
177           `(cons (string :tag "Name")
178                  (radio (string :tag "Host")
179                         (list ,host ,service))))
180          (args (list spec)))
181     (widget-put widget :args args)
182     widget))
183
184 (defcustom riece-server-alist nil
185   "An alist mapping server names to plist."
186   :type 'riece-server-spec
187   :group 'riece-server)
188
189 (defcustom riece-server (getenv "IRCSERVER")
190   "IRC server host we are connecting to."
191   :type 'string
192   :group 'riece-server)
193
194 (defcustom riece-protocol 'irc
195   "Protocol support."
196   :type 'symbol
197   :group 'riece-server)
198
199 (defcustom riece-max-send-size 512
200   "Maximum size of messages to be sent at a time."
201   :type 'integer
202   :group 'riece-server)
203
204 (defcustom riece-send-delay 2
205   "Duration of multiple send."
206   :type 'integer
207   :group 'riece-server)
208   
209 (defcustom riece-default-password (getenv "IRCPASSWORD")
210   "Your password."
211   :type '(radio (string :tag "Password")
212                 (const :tag "No" nil))
213   :group 'riece-server)
214
215 (defcustom riece-username nil
216   "Your login name."
217   :type 'string
218   :group 'riece-server)
219
220 (defcustom riece-realname nil
221   "Your user name."
222   :type 'string
223   :group 'riece-server)
224
225 (defcustom riece-nickname (or (getenv "IRCNICK")
226                               (user-real-login-name))
227   "Your nickname."
228   :type 'string
229   :group 'riece-server)
230
231 (defcustom riece-startup-channel-list nil
232   "A list of channels to join automatically at startup."
233   :type '(repeat (choice (string :tag "Channel")
234                          (list (string :tag "Channel") (string :tag "Key"))))
235   :group 'riece-channel)
236
237 (defcustom riece-startup-server-list nil
238   "A list of servers to connect automatically at startup."
239   :type '(repeat (string :tag "Server"))
240   :group 'riece-server)
241
242 (defcustom riece-retry-with-new-nickname nil
243   "When nickname has already been in use, grow-tail automatically."
244   :type 'boolean
245   :group 'riece-server)
246
247 (defcustom riece-quit-timeout 1
248   "Quit timeout when there is no response from server."
249   :type '(radio (integer :tag "Seconds")
250                 (const nil))
251   :group 'riece-server)
252
253 (defcustom riece-default-open-connection-function #'open-network-stream
254   "Default function used for connecting to an IRC server."
255   :type 'function
256   :group 'riece-server)
257
258 (defcustom riece-user-cache-max-size 512
259   "Maximum size of cache of user names."
260   :type 'integer
261   :group 'riece-server)
262
263 (defcustom riece-channel-cache-max-size 512
264   "Maximum size of cache of channel names."
265   :type 'integer
266   :group 'riece-server)
267
268 (defcustom riece-channel-buffer-mode t
269   "When non-nil, Riece will display a channel buffer."
270   :type 'boolean
271   :group 'riece-looks)
272
273 (defcustom riece-others-buffer-mode t
274   "When non-nil, Riece will display an \"*Others*\" buffer."
275   :type 'boolean
276   :group 'riece-looks)
277
278 (defcustom riece-user-list-buffer-mode t
279   "When non-nil, Riece will display a nick list buffer."
280   :type 'boolean
281   :group 'riece-looks)
282
283 (defcustom riece-channel-list-buffer-mode t
284   "When non-nil, Riece will display a channel list buffer."
285   :type 'boolean
286   :group 'riece-looks)
287
288 (defcustom riece-default-freeze nil
289   "Channel buffer local freeze flag is on at starting."
290   :type 'boolean
291   :group 'riece-looks)
292
293 (defcustom riece-default-channel-binding nil
294   "The channel list to bind the channel number when joining."
295   :type '(repeat (radio (string :tag "Bound Channel")
296                         (const nil)))
297   :group 'riece-channel)
298
299 (defcustom riece-blink-parens nil
300   "Should we blink matching parenthesis in the command buffer?"
301   :type 'boolean
302   :group 'riece-options)
303
304 (defcustom riece-quit-message (riece-extended-version)
305   "Default quit message."
306   :type '(string :tag "Quit message")
307   :group 'riece-options)
308
309 (defcustom riece-part-message nil
310   "Default part message."
311   :type '(choice (const :tag "No message" nil)
312                  (string :tag "Part message"))
313   :group 'riece-options)
314
315 (defcustom riece-away-message "Gone"
316   "Default away message."
317   :type '(string :tag "Away message")
318   :group 'riece-options)
319
320 (defcustom riece-gather-channel-modes nil
321   "If non-nil, gather channel modes when we join a channel."
322   :type 'boolean
323   :group 'riece-options)
324
325 (defcustom riece-buffer-dispose-function #'kill-buffer
326   "Function called after the buffer was disposed."
327   :type 'function
328   :group 'riece-options)
329
330 (defcustom riece-format-time-function #'current-time-string
331   "Function to convert the specified time to the human readable form."
332   :type 'function
333   :group 'riece-options)
334
335 (provide 'riece-options)
336
337 ;;; riece-options.el ends here