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