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