Added comment.
[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., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, 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   "Variables saved after each session is completed."
47   :type 'string
48   :group 'riece-options)
49
50 (defcustom riece-debug nil
51   "If non-nil, random debug spews."
52   :type 'boolean
53   :group 'riece-options)
54
55 (defcustom riece-command-prefix "\C-c"
56   "Key sequence to be used as prefix for command mode key bindings."
57   :type 'string
58   :group 'riece-options)
59
60 (defgroup riece-looks nil
61   "Related to look and feel"
62   :prefix "riece-"
63   :group 'riece)
64
65 (defcustom riece-use-full-window t
66   "If non-nil, whole Emacs window is used to display dialogue."
67   :type 'boolean
68   :group 'riece-looks)
69
70 (defcustom riece-window-center-line -2
71   "Line number of center point in window when scrolling.
72 If nil, erases the entire frame and then redraws with point in the
73 center of the window.  Negative means relative to bottom of window.
74 See the document of the function `recenter'."
75   :type 'integer
76   :group 'riece-looks)
77
78 (defcustom riece-directory (expand-file-name "~/.riece")
79   "Where to look for data files."
80   :type 'directory
81   :group 'riece-options)
82
83 (defcustom riece-addon-directory
84   (expand-file-name "addons" riece-directory)
85   "Where to look for add-on files."
86   :type 'directory
87   :group 'riece-options)
88
89 (defcustom riece-variables-file
90   (expand-file-name "init" riece-directory)
91   "Where to look for variables."
92   :type 'file
93   :group 'riece-options)
94
95 (defcustom riece-saved-variables-file
96   (expand-file-name "save" riece-directory)
97   "Where to look for variables.
98 This file was saved the last session."
99   :type 'file
100   :group 'riece-options)
101
102 (defcustom riece-variables-files
103   (list riece-saved-variables-file riece-variables-file)
104   "Where to look for variables.  Helps to remove clutter from your .emacs.
105 This feature is most likely to dissappear in near future.  The preferred
106 way is to put Riece variables on .emacs or file loaded from there."
107   :type '(repeat (file :tag "Initialization File"))
108   :group 'riece-options)
109
110 (defcustom riece-addons '(riece-highlight
111                           riece-ctcp
112                           riece-guess
113                           riece-unread
114                           riece-history
115                           riece-url
116                           riece-button
117                           riece-menu
118                           riece-icon
119                           riece-ignore
120                           riece-log
121                           riece-toolbar
122                           riece-alias
123                           riece-ctlseq
124                           riece-keyword)
125   "Add-ons insinuated into Riece."
126   :type '(repeat symbol)
127   :group 'riece-options)
128
129 (defgroup riece-server nil
130   "Server settings"
131   :prefix "riece-"
132   :group 'riece)
133
134 (defgroup riece-channel nil
135   "Channel settings"
136   :prefix "riece-"
137   :group 'riece)
138
139 (define-widget 'riece-service-spec 'radio
140   "Edit service spec entries"
141   :convert-widget 'riece-service-spec-convert)
142
143 (defun riece-service-spec-convert (widget)
144   (widget-put widget :args '((integer :tag "Port Number")
145                              (string :tag "Name")))
146   widget)
147
148 (define-widget 'riece-server-spec 'repeat
149   "Edit server spec entries"
150   :match (lambda (widget value)
151            (eval `(and ,@(mapcar
152                           (lambda (entry)
153                             (or (stringp (cdr entry))
154                                 (listp (cdr entry))))
155                           value))))
156   :convert-widget 'riece-server-spec-convert)
157
158 (defun riece-server-spec-convert (widget)
159   (let* ((host '(const :format "" :value :host))
160          (service '(const :format "" :value :service))
161          (host
162           `(group :inline t ,host (string :tag "Host")))
163          (service
164           `(group :inline t ,service riece-service-spec))
165          (spec
166           `(cons (string :tag "Name")
167                  (radio (string :tag "Host")
168                         (list ,host ,service))))
169          (args (list spec)))
170     (widget-put widget :args args)
171     widget))
172
173 (defcustom riece-server-alist nil
174   "An alist mapping server names to plist."
175   :type 'riece-server-spec
176   :group 'riece-server)
177
178 (defcustom riece-server (getenv "IRCSERVER")
179   "IRC server host we are connecting to."
180   :type 'string
181   :group 'riece-server)
182
183 (defcustom riece-protocol 'irc
184   "Protocol support."
185   :type 'symbol
186   :group 'riece-server)
187
188 (defcustom riece-max-send-size 512
189   "Maximum size of messages to be sent at a time."
190   :type 'integer
191   :group 'riece-server)
192
193 (defcustom riece-send-delay 2
194   "Duration of multiple send."
195   :type 'integer
196   :group 'riece-server)
197   
198 (defcustom riece-default-password (getenv "IRCPASSWORD")
199   "Your password."
200   :type '(radio (string :tag "Password")
201                 (const :tag "No" nil))
202   :group 'riece-server)
203
204 (defcustom riece-username nil
205   "Your user name."
206   :type 'string
207   :group 'riece-server)
208
209 (defcustom riece-nickname (or (getenv "IRCNICK")
210                               (user-real-login-name))
211   "Your nickname."
212   :type 'string
213   :group 'riece-server)
214
215 (defcustom riece-startup-channel-list nil
216   "A list of channels to join automatically at startup."
217   :type '(repeat (choice (string :tag "Channel")
218                          (list (string :tag "Channel") (string :tag "Key"))))
219   :group 'riece-channel)
220
221 (defcustom riece-startup-server-list nil
222   "A list of servers to connect automatically at startup."
223   :type '(repeat (string :tag "Server"))
224   :group 'riece-server)
225
226 (defcustom riece-retry-with-new-nickname nil
227   "When nickname has already been in use, grow-tail automatically."
228   :type 'boolean
229   :group 'riece-server)
230
231 (defcustom riece-quit-timeout 10
232   "Quit timeout when there is no response from server."
233   :type '(radio (integer :tag "Seconds")
234                 (const nil))
235   :group 'riece-server)
236
237 (defcustom riece-default-open-connection-function #'open-network-stream
238   "Default function used for connecting to an IRC server."
239   :type 'function
240   :group 'riece-server)
241
242 (defcustom riece-channel-buffer-mode t
243   "When non-nil, Riece will display a channel buffer."
244   :type 'boolean
245   :group 'riece-looks)
246
247 (defcustom riece-others-buffer-mode t
248   "When non-nil, Riece will display an \"*Others*\" buffer."
249   :type 'boolean
250   :group 'riece-looks)
251
252 (defcustom riece-user-list-buffer-mode t
253   "When non-nil, Riece will display a nick list buffer."
254   :type 'boolean
255   :group 'riece-looks)
256
257 (defcustom riece-channel-list-buffer-mode t
258   "When non-nil, Riece will display a channel list buffer."
259   :type 'boolean
260   :group 'riece-looks)
261
262 (defcustom riece-default-freeze nil
263   "Channel buffer local freeze flag is on at starting."
264   :type 'boolean
265   :group 'riece-looks)
266
267 (defcustom riece-default-channel-binding nil
268   "The channel list to bind the channel number when joining."
269   :type '(repeat (radio (string :tag "Bound Channel")
270                         (const nil)))
271   :group 'riece-channel)
272
273 (defcustom riece-blink-parens nil
274   "Should we blink matching parenthesis in the command buffer?"
275   :type 'boolean
276   :group 'riece-options)
277
278 (defcustom riece-quit-message (riece-extended-version)
279   "Default quit message."
280   :type '(string :tag "Quit message")
281   :group 'riece-options)
282
283 (defcustom riece-part-message nil
284   "Default part message."
285   :type '(choice (const :tag "No message" nil)
286                  (string :tag "Part message"))
287   :group 'riece-options)
288
289 (defcustom riece-away-message "Gone"
290   "Default away message."
291   :type '(string :tag "Away message")
292   :group 'riece-options)
293
294 (defcustom riece-gather-channel-modes nil
295   "If non-nil, gather channel modes when we join a channel."
296   :type 'boolean
297   :group 'riece-options)
298
299 (defcustom riece-buffer-dispose-function #'kill-buffer
300   "Function called after the buffer was disposed."
301   :type 'function
302   :group 'riece-options)
303
304 (defcustom riece-shrink-buffer-idle-time-delay 5
305   "Number of idle seconds to wait before shrinking channel buffers."
306   :type 'integer
307   :group 'riece-options)
308
309 (defcustom riece-max-buffer-size nil
310   "Maximum size of channel buffers."
311   :type '(radio (integer :tag "Number of characters")
312                 (const nil))
313   :group 'riece-options)
314
315 (defcustom riece-shrink-buffer-remove-chars (/ riece-max-send-size 2)
316   "Number of chars removed when shrinking channel buffers."
317   :type 'integer
318   :group 'riece-options)
319
320 (defcustom riece-format-time-function #'current-time-string
321   "Function to convert the specified time to the human readable form."
322   :type 'function
323   :group 'riece-options)
324
325 (provide 'riece-options)
326
327 ;;; riece-options.el ends here